1.0.0-rc.14 • Published 4 years ago

odl-graphql-client v1.0.0-rc.14

Weekly downloads
57
License
-
Repository
github
Last release
4 years ago

odl-graphql-client

This helps to create a client point to fetch data from backend is built with odl-graphql

Installation

Use npm to install

npm install --save odl-graphql-client

Use yarn to install

yarn add odl-graphql-client

Usage

import ODLGraphqlClient from 'odl-graphql-client';
import {ODLGraphQLClientOptions} from 'odl-graphql-client/types'

constructor() {
    const endpoint = '<your-graphql-server>';
    const options : ODLGraphQLClientOptions = {authenticationToken: '<your-authentication-token>', headers: "<your-custom-header-key-value>"};
    this.graphqlFetcher = new ODLGraphqlClient(endpoint, options); // options is optional
}

Methods

All methods are served with asynchronous.

Method NameDescriptionParams
queryManyAsyncSupport to query many record on an entityentityName: string, queryParams: QueryParams, selectFields?: string[] - optional
queryOneAsyncSupport to query one record on an entityentityName: string, queryParams: QueryParams, selectFields?: string[] - optional
getByIdAsyncSupport to get a record by id on an entityentityName: string, id: string, selectFields?: string[] - optional
countAsyncSupport to count based on a query on an entityentityName: string, query: string
addAsyncSupport to add a new record into an entity and return the new recordentityName: string, model: any, selectFields?: string[] - optional
updateAsyncSupport to update a record in an entity and return the updated recordentityName: string, id: string, model: any, selectFields?: string[] - optional
deleteAsyncSupport to delete a record in an entityentityName: string, id: string

Types

QueryParams

PropertyTypeDescription
query?stringthe linq query. Please get the further information at https://github.com/StefH/System.Linq.Dynamic.Core
include?stringThe nested entity which you want to include. You can include many entities with ','
orderBy?stringThe 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.0.0-rc.14

4 years ago

1.0.0-rc.13

4 years ago

1.0.0-rc.12

4 years ago

1.0.0-rc.11

4 years ago

1.0.0-rc.9

4 years ago

1.0.0-rc.10

4 years ago

1.0.0-rc.8

4 years ago

1.0.0-rc.7

4 years ago

1.0.0-rc.6

4 years ago

1.0.0-rc.5

4 years ago

1.0.0-rc.4

4 years ago

1.0.0-rc.3

4 years ago

1.0.0-rc.2

4 years ago

1.0.0-rc.1

4 years ago