3.0.0 • Published 5 months ago

@product-live/api-sdk v3.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

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.

3.0.0

5 months ago

3.0.0-preview.0

7 months ago

2.38.0

1 year ago

2.26.0

2 years ago

2.23.0

2 years ago

2.22.0

2 years ago

2.20.0

2 years ago

2.19.0

2 years ago

2.13.0

2 years ago

2.12.0

2 years ago

2.10.0

2 years ago

2.8.1

2 years ago

2.5.1

2 years ago

2.4.1

3 years ago

2.3.1

3 years ago

2.2.0-dev

3 years ago

2.2.0-stage

3 years ago

2.1.0-stage

3 years ago

2.1.0

3 years ago

1.90.0-stage

3 years ago

1.90.0-dev

3 years ago

1.89.1

3 years ago

1.88.0

3 years ago

1.88.0-dev

3 years ago

1.88.0-stage

3 years ago

1.87.0

3 years ago

1.87.0-stage

3 years ago

1.87.0-dev

3 years ago