@product-live/api-sdk v3.0.0
Product-live sdk
This sdk aims at simplifying access to the Product-Live public API.
Installing
Install the library with the following command:
npm i @product-live/sdk
Usage
Instantiation
For its creation, the apiClient must be provided with an AuthenticationProvider and a RequestAdapter
import {ApiKeyAuthenticationProvider, ApiKeyLocation} from '@microsoft/kiota-abstractions';
import {FetchRequestAdapter} from '@microsoft/kiota-http-fetchlibrary';
import {createApiClient} from './index';
const authenticationProvider = new ApiKeyAuthenticationProvider(
key,
'X-Api-Key',
ApiKeyLocation.Header
);
const requestAdapter = new FetchRequestAdapter(authenticationProvider);
requestAdapter.baseUrl = url;
const apiClient = createApiClient(requestAdapter);The library provides a simplified entry point for the most usual case
import {setup} from './index';
const apiClient = setup(key, url);It is currently recommended to use the latter method when the project is of "type": "module"
Call
Once instantiated, the client may be called on any API available. The methods use will always reflect the targeted url and the http verb.
For instance, to obtain a list of audit logs, we need a GET request on url /v1/audit_logs. The corresponding call will be:
const auditLogsList = await apiClient.v1.audit_logs.get();Additional parameters
Additional parameters may be provided depending on the targeted API
- url parameters: a method byId(id: string) will be available in the functions chain
const item = await apiClient.v1.items.byId(itemId).get();- body: for API calls requiring it, a body will be expected as the call function first argument
const newVariable = await apiClient.v1.data_factory.variables.post({
key: 'some-key',
name: 'explicit-name',
value: 'value'
});- headers and query parameters: all calling methods accept a RequestConfiguration as a last argument. This object is a json containing a headers and/or queryParameters object, with the necessary values inside. Note that the autocomplete is not available for the content of
headers
const patitionsList = await apiClient.v1.partitions.get({
queryParameters: { tableId: tableId },
headers: { 'X-Context': contextAccountId }
});Compatibility
The library provides both cjs and esm version.
5 months ago
7 months ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago