@dynamic-labs/sdk-api 0.0.251 → 0.0.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +41 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,45 @@
1
1
  # sdk-api
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This library contains a generated TypeScript client using [openapi](https://spec.openapis.org/oas/v3.0.1). It can be used with any Javascript/Typescript project.
4
4
 
5
- ## Running unit tests
5
+ Documentation on the current set of REST APIs can be found at: https://docs.dynamic.xyz/api-reference/overview
6
6
 
7
- Run `nx test sdk-api` to execute the unit tests via [Jest](https://jestjs.io).
7
+ # APIs
8
+
9
+ - SdkApi
10
+ - These are endpoints used exclusively by the [Dynamic React SDK](https://www.npmjs.com/package/@dynamic-labs/sdk-react). Several endpoints in these APIs require a [JWT](https://docs.dynamic.xyz/react-sdk/references/user-payload#-the-jwt-update) created by the `verify` or `signin` endpoints, and are specific to a user in the SDK's environment. These APIs are typically used on a client site or frontend to enhance their customers' experience.
11
+ - Dashboard APIs
12
+ - These endpoints are used by admins of an organization to update site settings and manage users of the environment. These APIs require an [API token](https://docs.dynamic.xyz/api-reference/overview#authentication) scoped for a specific environment. These APIs are typically used on a client backend, to manage all their users' data and make corresponding settings changes that affect all users of a site.
13
+ - The most commonly used API among the dashboard APIs is `UsersApi`
14
+ - You can read about all the other available APIs [here](https://docs.dynamic.xyz/api-reference/overview)
15
+
16
+ # Examples
17
+
18
+ This section provides an example of how to use `SDKApi`. This would be similar to using the other available generated APIs, like `UsersApi` or `ExportsApi`, etc.
19
+
20
+ ### SdkApi
21
+
22
+ Initialize a new instance of the `SDKApi` class:
23
+ ```typescript
24
+ import { Configuration, SDKApi } from '@dynamic-labs/sdk-api';
25
+
26
+ const sdkApi = (jwt: string) => {
27
+ const settings = {
28
+ basePath: ApiEndpoint.getBaseUrl(),
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ },
32
+ };
33
+ settings.headers.Authorization = `Bearer ${jwt}`;
34
+ return new SDKApi(new Configuration(settings));
35
+ };
36
+ ```
37
+
38
+ Then you would be able to use it like this:
39
+ ```typescript
40
+ const response = await sdkApi(jwt).updateSelf({
41
+ environmentId,
42
+ userFields: fields, // { alias, firstName, lastName, username, ... }
43
+ });
44
+ // do something with the response
45
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-api",
3
- "version": "0.0.251",
3
+ "version": "0.0.253",
4
4
  "author": "Dynamic Labs",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {