DataApi class
Data-specific operations client for interacting with Data API Builder GraphQL endpoints.
Use the createDataApi factory function to create instances instead of instantiating directly.
Constructors
| Data |
Creates a data API client. Prefer the |
Methods
| get |
Get a GraphQL client for a specific entity. |
| get |
Get all available entity names. In a Proxy-based client, this returns all entity names that have been accessed. |
Constructor Details
DataApi<TSchema>(ApiClient)
Creates a data API client. Prefer the createDataApi factory over calling
this constructor directly.
new DataApi(apiClient: ApiClient)
Parameters
- apiClient
- ApiClient
The underlying HTTP client used to issue GraphQL requests.
Method Details
getClient<K>(K)
Get a GraphQL client for a specific entity.
function getClient<K>(entityName: K): GraphQLEntityClient<TSchema, K>
Parameters
- entityName
-
K
The entity name to get a client for (a key of TSchema).
Returns
GraphQLEntityClient<TSchema, K>
A typed GraphQLEntityClient for the entity. Clients are cached per entity.
getEntityNames()
Get all available entity names. In a Proxy-based client, this returns all entity names that have been accessed.
function getEntityNames(): (keyof TSchema)[]
Returns
(keyof TSchema)[]
The list of entity names for which clients have been created.