@leadping/sdk 1.0.34 → 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/sources/item/metrics/index.d.ts +3 -3
- 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)
|
|
@@ -5,7 +5,7 @@ import { type BaseRequestBuilder, type RequestConfiguration, type RequestInforma
|
|
|
5
5
|
*/
|
|
6
6
|
export interface MetricsRequestBuilder extends BaseRequestBuilder<MetricsRequestBuilder> {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* View lead creation metrics for an organization intake source, including accepted, rejected, duplicate, validation, and recent activity counts.
|
|
9
9
|
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
|
|
10
10
|
* @returns {Promise<SourceMetricsResponse>}
|
|
11
11
|
* @throws {ProblemDetails} error when the service returns a 401 status code
|
|
@@ -13,14 +13,14 @@ export interface MetricsRequestBuilder extends BaseRequestBuilder<MetricsRequest
|
|
|
13
13
|
*/
|
|
14
14
|
get(requestConfiguration?: RequestConfiguration<MetricsRequestBuilderGetQueryParameters> | undefined): Promise<SourceMetricsResponse | undefined>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* View lead creation metrics for an organization intake source, including accepted, rejected, duplicate, validation, and recent activity counts.
|
|
17
17
|
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
|
|
18
18
|
* @returns {RequestInformation}
|
|
19
19
|
*/
|
|
20
20
|
toGetRequestInformation(requestConfiguration?: RequestConfiguration<MetricsRequestBuilderGetQueryParameters> | undefined): RequestInformation;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* View lead creation metrics for an organization intake source, including accepted, rejected, duplicate, validation, and recent activity counts.
|
|
24
24
|
*/
|
|
25
25
|
export interface MetricsRequestBuilderGetQueryParameters {
|
|
26
26
|
/**
|
package/package.json
CHANGED