1.2.2 • Published 3 years ago
graphql-door-client v1.2.2
odl-graphql-client
This helps to create a client point to fetch data from backend is built with GraphQLDoorNet
Installation
Use npm to install
npm install --save odl-graphql-client
Use yarn to install
yarn add odl-graphql-client
Usage
import GraphQLDoorClient from 'graphql-door-client';
import {GraphQLDoorClientOptions} from 'graphql-door-client/types'
constructor() {
const endpoint = '<your-graphql-server>';
const options : GraphQLDoorClientOptions = {authenticationToken: '<your-authentication-token>', headers: "<your-custom-header-key-value>"};
this.graphqlFetcher = new GraphQLDoorClient(endpoint, options); // options is optional
}
Methods
All methods are served with asynchronous.
Method Name | Description | Params |
---|---|---|
queryManyAsync | Support to query many record on an entity | entityName: string, queryParams: QueryParams, selectFields?: string[] - optional |
queryOneAsync | Support to query one record on an entity | entityName: string, queryParams: QueryParams, selectFields?: string[] - optional |
getByIdAsync | Support to get a record by id on an entity | entityName: string, id: string, selectFields?: string[] - optional |
countAsync | Support to count based on a query on an entity | entityName: string, query: string |
addAsync | Support to add a new record into an entity and return the new record | entityName: string, model: any, selectFields?: string[] - optional |
updateAsync | Support to update a record in an entity and return the updated record | entityName: string, id: string, model: any, selectFields?: string[] - optional |
deleteAsync | Support to delete a record in an entity | entityName: string, id: string |
Types
QueryParams
Property | Type | Description |
---|---|---|
query? | string | the linq query. Please get the further information at https://github.com/StefH/System.Linq.Dynamic.Core |
include? | string | The nested entity which you want to include. You can include many entities with ',' |
orderBy? | string | The property which you want to order by, default is ASC, for contrary, just add "desc" after the prop name. Example: {orderBy: 'name desc'} |
page? | number | |
pageSize? | number |
1.2.2
3 years ago
1.2.0
4 years ago
1.2.1
4 years ago
1.1.16
5 years ago
1.1.15
5 years ago
1.1.14
5 years ago
1.1.13
5 years ago
1.1.12
5 years ago
1.1.11
5 years ago
1.1.10
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.0
5 years ago