Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow querying in REST API and GraphQL #995

Merged
merged 1 commit into from
Jul 31, 2022
Merged

[Feature] Allow querying in REST API and GraphQL #995

merged 1 commit into from
Jul 31, 2022

Conversation

donrestarone
Copy link
Contributor

Addresses: #888

Allow querying in REST API and GraphQL

Allows PARTIAL and EXACT match querying

REST API query demo

Screen.Recording.2022-07-22.at.2.22.50.PM.mov

GQL API query demo

Screen.Recording.2022-07-22.at.1.14.11.PM.mov

Sample queries

GraphQL

{ 
  apiNamespaces(slug: "support_request") { 
  	id 
    apiResources(properties: {
      product:{ option: "PARTIAL", value: "nikean" }
    }) {
      id
      properties
    }
	} 
}

Screen Shot 2022-07-31 at 1 29 46 PM

Co-authored-by: Pralish Kayastha [email protected]

Addresses: #888


# Allow querying in REST API and GraphQL

Allows `PARTIAL` and `EXACT` match querying


## REST API query demo


https://user-images.githubusercontent.com/35935196/180443733-61e75634-5f86-4777-a21f-7959a5cff734.mov




## GQL API query demo


https://user-images.githubusercontent.com/35935196/180443718-721d97c9-f2ab-418e-af7f-23c3c5faa66e.mov



## Sample queries

### GraphQL 

``` gql
{ 
  apiNamespaces(slug: "support_request") { 
  	id 
    apiResources(properties: {
      product:{ option: "PARTIAL", value: "nikean" }
    }) {
      id
      properties
    }
	} 
}

```
<img width="1728" alt="Screen Shot 2022-07-31 at 1 29 46 PM" src="https://user-images.githubusercontent.com/35935196/182038364-d10d51d3-e5ff-46a1-84ec-443aa862b7ea.png">


Co-authored-by: Pralish Kayastha <[email protected]>
@donrestarone
Copy link
Contributor Author

donrestarone commented Jul 31, 2022

Acceptance Criteria:

  1. Landing page animation on Restarone.com is not broken ✅
  2. Allows querying by GQL ✅

@donrestarone
Copy link
Contributor Author

donrestarone commented Jul 31, 2022

⚠️ temporarily deploying to restarone.com for validating the REST API changes ✔️

@donrestarone donrestarone marked this pull request as ready for review July 31, 2022 18:00
@donrestarone donrestarone added Passing UAT on Staging ✅ not generally available - deployed to Restarone.Solutions and removed Pending UAT on Staging 🔴 labels Jul 31, 2022
@donrestarone donrestarone merged commit b637e71 into master Jul 31, 2022
@donrestarone donrestarone deleted the rc branch July 31, 2022 19:21
donrestarone added a commit that referenced this pull request Sep 15, 2022
Addresses: #267


guide for querying: #995 *need better docs*

## Demo
https://user-images.githubusercontent.com/35935196/185770631-67a9aed9-bc09-47bd-b437-17e35cc824c6.mov

## Demo Sortable

https://user-images.githubusercontent.com/50227291/188428768-00232faa-7fc0-4bf7-aae4-3e6714c171a8.mov




## HOW TO USE

#### Api Resource Index

- create snippet with identifier same as api_namespace slug
- Variables available on snippet: @api_resources & @api_namespace
- Render the snippet on any page with this helper: {{cms:helper render_api_namespace_resource_index 'identifier'}}
- Is filterable using query params, eg: http://lvh.me:5250/?properties={"synced":"false"}

#### Api Resource show

- create snippet with  identifier as api_namespace slug with '-show' at the end, eg: people-show
- Variables available on snippet: @api_resource & @api_namespace
- Render the snippet on any page with this helper: {{cms:helper render_api_namespace_resource 'identifier'}}
- id query params is mandetory, will raise 404 otherwise. eg: http://lvh.me:5250/?id=123


``` ruby
{{ cms:helper api_namespace_resource_index 'slug', scope: { properties:  { property: value } } }}
```




for sorting you can do something like: 

``` ruby
{{ cms:helper render_api_namespace_resource_index 'cars', scope: { properties:  { published: 'true' }, order: { created_at: 'DESC' } } }}
```
donrestarone added a commit that referenced this pull request Sep 15, 2022
Addresses: #267


guide for querying: #995 *need better docs*

## Demo
https://user-images.githubusercontent.com/35935196/185770631-67a9aed9-bc09-47bd-b437-17e35cc824c6.mov

## Demo Sortable

https://user-images.githubusercontent.com/50227291/188428768-00232faa-7fc0-4bf7-aae4-3e6714c171a8.mov




## HOW TO USE

#### Api Resource Index

- create snippet with identifier same as api_namespace slug
- Variables available on snippet: @api_resources & @api_namespace
- Render the snippet on any page with this helper: {{cms:helper render_api_namespace_resource_index 'identifier'}}
- Is filterable using query params, eg: http://lvh.me:5250/?properties={"synced":"false"}

#### Api Resource show

- create snippet with  identifier as api_namespace slug with '-show' at the end, eg: people-show
- Variables available on snippet: @api_resource & @api_namespace
- Render the snippet on any page with this helper: {{cms:helper render_api_namespace_resource 'identifier'}}
- id query params is mandetory, will raise 404 otherwise. eg: http://lvh.me:5250/?id=123


``` ruby
{{ cms:helper api_namespace_resource_index 'slug', scope: { properties:  { property: value } } }}
```




for sorting you can do something like: 

``` ruby
{{ cms:helper render_api_namespace_resource_index 'cars', scope: { properties:  { published: 'true' }, order: { created_at: 'DESC' } } }}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passing UAT on Staging ✅ not generally available - deployed to Restarone.Solutions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant