@connectedxm/admin 1.4.0 → 1.4.2
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.
- package/README.md +41 -43
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,12 +9,47 @@ A Javascript SDK for interacting with the ConnectedXM Admin API.
|
|
|
9
9
|
To install the SDK, use npm or yarn:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install @connectedxm/admin
|
|
13
|
-
# or
|
|
14
|
-
yarn add @connectedxm/admin-sdk
|
|
12
|
+
npm install @connectedxm/admin
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
## Using
|
|
15
|
+
## OPTION 1: Using the Functions directly
|
|
16
|
+
|
|
17
|
+
Here's a basic example of how to use the SDK to fetch user data:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { AddAccountTier, AdminApiParams, GetAccount } from "@connectedxm/admin";
|
|
21
|
+
|
|
22
|
+
const ORGANIZATION_ID = "ORGANIZATION_ID";
|
|
23
|
+
const API_KEY = "API_KEY";
|
|
24
|
+
|
|
25
|
+
const ACCOUNT_ID = "INPUT_AN_ACCOUNT_ID";
|
|
26
|
+
const NEW_TIER_ID = "INPUT_AN_ACCOUNT_TIER_ID";
|
|
27
|
+
|
|
28
|
+
const adminApiParams: AdminApiParams = {
|
|
29
|
+
apiUrl: "https://admin-api.connected.dev",
|
|
30
|
+
apiKey: API_KEY,
|
|
31
|
+
organizationId: ORGANIZATION_ID,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Example: Get account
|
|
35
|
+
let { data: account } = await GetAccount({
|
|
36
|
+
accountId: ACCOUNT_ID,
|
|
37
|
+
adminApiParams,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log(JSON.stringify(account, null, 2));
|
|
41
|
+
|
|
42
|
+
// Example: Add account tier
|
|
43
|
+
let { data } = await AddAccountTier({
|
|
44
|
+
adminApiParams,
|
|
45
|
+
accountId: ACCOUNT_ID,
|
|
46
|
+
tierId: NEW_TIER_ID,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log(JSON.stringify(data, null, 2));
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## OPTION: 2 Using with React Query Hooks
|
|
18
53
|
|
|
19
54
|
First wrap your application in both QueryClientProvider and a ConnectedXMProvider
|
|
20
55
|
|
|
@@ -27,7 +62,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
|
|
27
62
|
|
|
28
63
|
const getToken = (): string => {
|
|
29
64
|
// GETS YOUR ACCESS TOKEN FOR THE SIGNED IN USER
|
|
30
|
-
return "";
|
|
65
|
+
return "ACCESS_TOKEN";
|
|
31
66
|
};
|
|
32
67
|
|
|
33
68
|
return (
|
|
@@ -51,7 +86,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
|
|
51
86
|
}
|
|
52
87
|
```
|
|
53
88
|
|
|
54
|
-
|
|
89
|
+
Inside of any react component you can use the exported react-query hook
|
|
55
90
|
|
|
56
91
|
```tsx
|
|
57
92
|
const Component = ({ accountId }: { accountId: string }) => {
|
|
@@ -67,40 +102,3 @@ const Component = ({ accountId }: { accountId: string }) => {
|
|
|
67
102
|
);
|
|
68
103
|
};
|
|
69
104
|
```
|
|
70
|
-
|
|
71
|
-
## Using the Functions directly
|
|
72
|
-
|
|
73
|
-
Here's a basic example of how to use the SDK to fetch user data:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import { AddAccountTier, AdminApiParams, GetAccount } from "@connectedxm/admin";
|
|
77
|
-
|
|
78
|
-
const ORGANIZATION_ID = "ORGANIZATION_ID";
|
|
79
|
-
const API_KEY = "API_KEY";
|
|
80
|
-
|
|
81
|
-
const ACCOUNT_ID = "INPUT_AN_ACCOUNT_ID";
|
|
82
|
-
const NEW_TIER_ID = "INPUT_AN_ACCOUNT_TIER_ID";
|
|
83
|
-
|
|
84
|
-
const adminApiParams: AdminApiParams = {
|
|
85
|
-
apiUrl: "https://admin-api.connected.dev",
|
|
86
|
-
apiKey: API_KEY,
|
|
87
|
-
organizationId: ORGANIZATION_ID,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// Example: Get account
|
|
91
|
-
let { data: account } = await GetAccount({
|
|
92
|
-
accountId: ACCOUNT_ID,
|
|
93
|
-
adminApiParams,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
console.log(JSON.stringify(account, null, 2));
|
|
97
|
-
|
|
98
|
-
// Example: Add account tier
|
|
99
|
-
let { data } = await AddAccountTier({
|
|
100
|
-
adminApiParams,
|
|
101
|
-
accountId: ACCOUNT_ID,
|
|
102
|
-
tierId: NEW_TIER_ID,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
console.log(JSON.stringify(data, null, 2));
|
|
106
|
-
```
|
package/dist/index.d.mts
CHANGED
|
@@ -1356,6 +1356,7 @@ interface Organization extends BaseOrganization {
|
|
|
1356
1356
|
maxImageCount: number | null;
|
|
1357
1357
|
maxVideoMins: number | null;
|
|
1358
1358
|
locales: string[];
|
|
1359
|
+
googleServices: string | null;
|
|
1359
1360
|
}
|
|
1360
1361
|
interface OrganizationTrigger {
|
|
1361
1362
|
id: number;
|
|
@@ -3524,6 +3525,7 @@ interface OrganizationUpdateInputs {
|
|
|
3524
3525
|
appAdaptiveIconId?: string | null;
|
|
3525
3526
|
appSplashScreenId?: string | null;
|
|
3526
3527
|
locales?: string[] | null;
|
|
3528
|
+
googleServices?: string | null;
|
|
3527
3529
|
}
|
|
3528
3530
|
interface PaymentIntentPurchaseMetadataInputs {
|
|
3529
3531
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1356,6 +1356,7 @@ interface Organization extends BaseOrganization {
|
|
|
1356
1356
|
maxImageCount: number | null;
|
|
1357
1357
|
maxVideoMins: number | null;
|
|
1358
1358
|
locales: string[];
|
|
1359
|
+
googleServices: string | null;
|
|
1359
1360
|
}
|
|
1360
1361
|
interface OrganizationTrigger {
|
|
1361
1362
|
id: number;
|
|
@@ -3524,6 +3525,7 @@ interface OrganizationUpdateInputs {
|
|
|
3524
3525
|
appAdaptiveIconId?: string | null;
|
|
3525
3526
|
appSplashScreenId?: string | null;
|
|
3526
3527
|
locales?: string[] | null;
|
|
3528
|
+
googleServices?: string | null;
|
|
3527
3529
|
}
|
|
3528
3530
|
interface PaymentIntentPurchaseMetadataInputs {
|
|
3529
3531
|
}
|