@leadping/sdk 1.0.33 → 1.0.35
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 +52 -22
- package/dist/analytics/my/index.d.ts +1 -1
- package/dist/leads/intake/index.d.ts +2 -2
- package/dist/models/index.d.ts +232 -232
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +464 -464
- package/dist/models/index.js.map +1 -1
- package/dist/notifications/markAllRead/index.d.ts +3 -3
- package/dist/notifications/markAllRead/index.d.ts.map +1 -1
- package/dist/notifications/markAllRead/index.js +4 -2
- package/dist/notifications/markAllRead/index.js.map +1 -1
- package/dist/notifications/unreadCount/index.d.ts +3 -3
- package/dist/notifications/unreadCount/index.d.ts.map +1 -1
- package/dist/notifications/unreadCount/index.js +4 -2
- package/dist/notifications/unreadCount/index.js.map +1 -1
- package/dist/phoneNumbers/item/status/index.d.ts +1 -1
- package/dist/phoneNumbers/item/warmup/index.d.ts +1 -1
- package/dist/sms/media/index.d.ts +2 -2
- package/dist/sms/media/index.d.ts.map +1 -1
- package/dist/sms/media/index.js +4 -2
- package/dist/sms/media/index.js.map +1 -1
- package/dist/sources/item/metrics/index.d.ts +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,47 +5,77 @@
|
|
|
5
5
|
|
|
6
6
|
#  Leadping TypeScript SDK
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The official, type-safe TypeScript and JavaScript SDK for the Leadping API. Use it to integrate lead management, conversations, SMS and calling, automations, reporting, billing, and business settings into Node.js and server-side TypeScript applications.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The package is generated from the [Leadping OpenAPI specification](https://leadping.ai/docs/openapi.json) with Microsoft Kiota. It contains request builders and models; your application supplies the fetch request adapter, credentials, retry policy, and credential storage.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
npm install @leadping/sdk
|
|
14
|
-
```
|
|
12
|
+
## Installation
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
Install the SDK and Kiota's fetch adapter:
|
|
17
15
|
|
|
18
16
|
```bash
|
|
19
|
-
npm install @microsoft/kiota-http-fetchlibrary
|
|
17
|
+
npm install @leadping/sdk @microsoft/kiota-http-fetchlibrary
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
The SDK package is `@leadping/sdk`. The similarly named `@leadpingai/sdk` package is only used when consuming releases from GitHub Packages.
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
## Authentication
|
|
23
|
+
|
|
24
|
+
Set `LEADPING_API_KEY` to a WorkOS organization API key (`sk_...`). The SDK sends it as `Authorization: Bearer <credential>`. User access tokens are also supported when acting for a signed-in user; `lp_src_...` keys are only for lead-ingestion endpoints. See [API authentication](https://leadping.ai/docs/api-authentication). Do not expose organization or source keys in browser code.
|
|
25
|
+
|
|
26
|
+
## Create a client
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
Kiota's API-key authentication provider can place the complete Bearer value in the `Authorization` header:
|
|
30
29
|
|
|
31
30
|
```ts
|
|
32
31
|
import { createLeadpingOpenApiClient } from "@leadping/sdk";
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
import {
|
|
33
|
+
ApiKeyAuthenticationProvider,
|
|
34
|
+
ApiKeyLocation,
|
|
35
|
+
} from "@microsoft/kiota-abstractions";
|
|
36
|
+
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
|
|
37
|
+
|
|
38
|
+
const credential = process.env.LEADPING_API_KEY;
|
|
39
|
+
if (!credential) {
|
|
40
|
+
throw new Error("LEADPING_API_KEY is not set.");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const authProvider = new ApiKeyAuthenticationProvider(
|
|
44
|
+
`Bearer ${credential}`,
|
|
45
|
+
"Authorization",
|
|
46
|
+
ApiKeyLocation.Header,
|
|
47
|
+
new Set(["api.leadping.ai"]),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const adapter = new FetchRequestAdapter(authProvider);
|
|
35
51
|
const client = createLeadpingOpenApiClient(adapter);
|
|
36
52
|
|
|
37
|
-
const
|
|
53
|
+
const lead = await client.leads.byId("lead-id").get();
|
|
54
|
+
console.log(lead?.id);
|
|
38
55
|
```
|
|
39
56
|
|
|
40
|
-
|
|
57
|
+
The client defaults to `https://api.leadping.ai`.
|
|
58
|
+
|
|
59
|
+
## Common operations
|
|
60
|
+
|
|
61
|
+
Request builders mirror the API path. Methods such as `byId()` select a resource; terminal methods send the request.
|
|
41
62
|
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
```ts
|
|
64
|
+
// Requires a user access token.
|
|
65
|
+
const currentUser = await client.users.me.get();
|
|
66
|
+
|
|
67
|
+
// Retrieve organization resources by ID.
|
|
68
|
+
const source = await client.sources.byId("source-id").get();
|
|
69
|
+
const lead = await client.leads.byId("lead-id").get();
|
|
70
|
+
```
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
Create and update operations accept generated request-body types exported by `@leadping/sdk`.
|
|
46
73
|
|
|
47
|
-
##
|
|
74
|
+
## Resources
|
|
48
75
|
|
|
49
|
-
- [
|
|
76
|
+
- [Leadping introduction](https://leadping.ai/docs/introduction)
|
|
77
|
+
- [API authentication](https://leadping.ai/docs/api-authentication)
|
|
50
78
|
- [API reference](https://leadping.ai/docs/api-reference)
|
|
79
|
+
- [OpenAPI specification](https://leadping.ai/docs/openapi.json)
|
|
80
|
+
- [npm package](https://www.npmjs.com/package/@leadping/sdk)
|
|
51
81
|
- [License](LICENSE)
|
|
@@ -27,7 +27,7 @@ export interface MyRequestBuilderGetQueryParameters {
|
|
|
27
27
|
/**
|
|
28
28
|
* Optional number of recent days to include when explicit timestamps are not supplied.
|
|
29
29
|
*/
|
|
30
|
-
days?:
|
|
30
|
+
days?: string;
|
|
31
31
|
/**
|
|
32
32
|
* Optional exclusive end timestamp for the analytics period.
|
|
33
33
|
*/
|
|
@@ -64,7 +64,7 @@ export interface IntakeRequestBuilderGetQueryParameters {
|
|
|
64
64
|
/**
|
|
65
65
|
* Direct-post price supplied by the lead source during intake.
|
|
66
66
|
*/
|
|
67
|
-
directPostPrice?:
|
|
67
|
+
directPostPrice?: string;
|
|
68
68
|
/**
|
|
69
69
|
* Email address for the person represented by this lead intake request.
|
|
70
70
|
*/
|
|
@@ -104,7 +104,7 @@ export interface IntakeRequestBuilderGetQueryParameters {
|
|
|
104
104
|
/**
|
|
105
105
|
* Lead price or transaction price supplied to the Leadping API.
|
|
106
106
|
*/
|
|
107
|
-
price?:
|
|
107
|
+
price?: string;
|
|
108
108
|
/**
|
|
109
109
|
* Product or offer associated with the lead or source.
|
|
110
110
|
*/
|