Skip to content

Commit da3410b

Browse files
feat(api): manual updates
1 parent 7c248bf commit da3410b

51 files changed

Lines changed: 4985 additions & 1033 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-npm.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/release-doctor.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-dm-0c710dc4fefdad48dd557a0a8b810ac6669d0e174b0cd9487e7d414cd414bc26.yml
3-
openapi_spec_hash: 4b45018f8a92b70b0d9866b30f8dd2be
4-
config_hash: 938a49721ef26a1b08f96d43c68f2aab
1+
configured_endpoints: 44
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-dm-433bfd8c688a6b6d2d4f964bb59121d692798f4e2bb6cb47f6110c4f0e1f638d.yml
3+
openapi_spec_hash: 5378295d401c8c1152c1946cc7dbd69f
4+
config_hash: 64ada5a5574e037e7ada612d3df30ae8

CONTRIBUTING.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g
4242
To install via git:
4343

4444
```sh
45-
$ npm install git+ssh://git@github.com:sentdm/sent-dm-typescript.git
45+
$ npm install git+ssh://git@github.com:stainless-sdks/sent-dm-typescript.git
4646
```
4747

4848
Alternatively, to link a local copy of the repo:
4949

5050
```sh
5151
# Clone
52-
$ git clone https://www.github.com/sentdm/sent-dm-typescript
52+
$ git clone https://www.github.com/stainless-sdks/sent-dm-typescript
5353
$ cd sent-dm-typescript
5454

5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link @sentdm/sentdm
58+
$ yarn link sent-dm
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global @sentdm/sentdm
63+
$ pnpm link -—global sent-dm
6464
```
6565

6666
## Running tests
@@ -91,17 +91,3 @@ To format and fix all lint issues automatically:
9191
```sh
9292
$ pnpm fix
9393
```
94-
95-
## Publishing and releases
96-
97-
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98-
the changes aren't made through the automated pipeline, you may want to make releases manually.
99-
100-
### Publish with a GitHub workflow
101-
102-
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/sentdm/sent-dm-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103-
104-
### Publish manually
105-
106-
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107-
the environment.

README.md

Lines changed: 77 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sent Dm TypeScript API Library
22

3-
[![NPM version](<https://img.shields.io/npm/v/@sentdm/sentdm.svg?label=npm%20(stable)>)](https://npmjs.org/package/@sentdm/sentdm) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@sentdm/sentdm)
3+
[![NPM version](<https://img.shields.io/npm/v/sent-dm.svg?label=npm%20(stable)>)](https://npmjs.org/package/sent-dm) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/sent-dm)
44

55
This library provides convenient access to the Sent Dm REST API from server-side TypeScript or JavaScript.
66

@@ -11,27 +11,35 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install @sentdm/sentdm
14+
npm install git+ssh://git@github.com:stainless-sdks/sent-dm-typescript.git
1515
```
1616

17+
> [!NOTE]
18+
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install sent-dm`
19+
1720
## Usage
1821

1922
The full API of this library can be found in [api.md](api.md).
2023

2124
<!-- prettier-ignore -->
2225
```js
23-
import SentDm from '@sentdm/sentdm';
26+
import SentDm from 'sent-dm';
2427

2528
const client = new SentDm({
2629
apiKey: process.env['SENT_DM_API_KEY'], // This is the default and can be omitted
27-
senderID: process.env['SENT_DM_SENDER_ID'], // This is the default and can be omitted
2830
});
2931

30-
await client.messages.sendToPhone({
31-
phoneNumber: '+1234567890',
32-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
33-
templateVariables: { name: 'John Doe', order_id: '12345' },
32+
const response = await client.messages.send({
33+
channel: ['sms', 'whatsapp'],
34+
template: {
35+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
36+
name: 'order_confirmation',
37+
parameters: { name: 'John Doe', order_id: '12345' },
38+
},
39+
to: ['+14155551234', '+14155555678'],
3440
});
41+
42+
console.log(response.data);
3543
```
3644

3745
### Request & Response types
@@ -40,19 +48,22 @@ This library includes TypeScript definitions for all request params and response
4048

4149
<!-- prettier-ignore -->
4250
```ts
43-
import SentDm from '@sentdm/sentdm';
51+
import SentDm from 'sent-dm';
4452

4553
const client = new SentDm({
4654
apiKey: process.env['SENT_DM_API_KEY'], // This is the default and can be omitted
47-
senderID: process.env['SENT_DM_SENDER_ID'], // This is the default and can be omitted
4855
});
4956

50-
const params: SentDm.MessageSendToPhoneParams = {
51-
phoneNumber: '+1234567890',
52-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
53-
templateVariables: { name: 'John Doe', order_id: '12345' },
57+
const params: SentDm.MessageSendParams = {
58+
channel: ['sms'],
59+
template: {
60+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
61+
name: 'order_confirmation',
62+
parameters: { name: 'John Doe', order_id: '12345' },
63+
},
64+
to: ['+14155551234'],
5465
};
55-
await client.messages.sendToPhone(params);
66+
const response: SentDm.MessageSendResponse = await client.messages.send(params);
5667
```
5768

5869
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -66,10 +77,14 @@ a subclass of `APIError` will be thrown:
6677
<!-- prettier-ignore -->
6778
```ts
6879
const response = await client.messages
69-
.sendToPhone({
70-
phoneNumber: '+1234567890',
71-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
72-
templateVariables: { name: 'John Doe', order_id: '12345' },
80+
.send({
81+
channel: ['sms'],
82+
template: {
83+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
84+
name: 'order_confirmation',
85+
parameters: { name: 'John Doe', order_id: '12345' },
86+
},
87+
to: ['+14155551234'],
7388
})
7489
.catch(async (err) => {
7590
if (err instanceof SentDm.APIError) {
@@ -111,10 +126,14 @@ const client = new SentDm({
111126
});
112127

113128
// Or, configure per-request:
114-
await client.messages.sendToPhone({
115-
phoneNumber: '+1234567890',
116-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
117-
templateVariables: { name: 'John Doe', order_id: '12345' },
129+
await client.messages.send({
130+
channel: ['sms'],
131+
template: {
132+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
133+
name: 'order_confirmation',
134+
parameters: { name: 'John Doe', order_id: '12345' },
135+
},
136+
to: ['+14155551234'],
118137
}, {
119138
maxRetries: 5,
120139
});
@@ -132,10 +151,14 @@ const client = new SentDm({
132151
});
133152

134153
// Override per-request:
135-
await client.messages.sendToPhone({
136-
phoneNumber: '+1234567890',
137-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
138-
templateVariables: { name: 'John Doe', order_id: '12345' },
154+
await client.messages.send({
155+
channel: ['sms'],
156+
template: {
157+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
158+
name: 'order_confirmation',
159+
parameters: { name: 'John Doe', order_id: '12345' },
160+
},
161+
to: ['+14155551234'],
139162
}, {
140163
timeout: 5 * 1000,
141164
});
@@ -160,24 +183,32 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
160183
const client = new SentDm();
161184

162185
const response = await client.messages
163-
.sendToPhone({
164-
phoneNumber: '+1234567890',
165-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
166-
templateVariables: { name: 'John Doe', order_id: '12345' },
186+
.send({
187+
channel: ['sms'],
188+
template: {
189+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
190+
name: 'order_confirmation',
191+
parameters: { name: 'John Doe', order_id: '12345' },
192+
},
193+
to: ['+14155551234'],
167194
})
168195
.asResponse();
169196
console.log(response.headers.get('X-My-Header'));
170197
console.log(response.statusText); // access the underlying Response object
171198

172-
const { data: result, response: raw } = await client.messages
173-
.sendToPhone({
174-
phoneNumber: '+1234567890',
175-
templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
176-
templateVariables: { name: 'John Doe', order_id: '12345' },
199+
const { data: response, response: raw } = await client.messages
200+
.send({
201+
channel: ['sms'],
202+
template: {
203+
id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
204+
name: 'order_confirmation',
205+
parameters: { name: 'John Doe', order_id: '12345' },
206+
},
207+
to: ['+14155551234'],
177208
})
178209
.withResponse();
179210
console.log(raw.headers.get('X-My-Header'));
180-
console.log(result);
211+
console.log(response.data);
181212
```
182213

183214
### Logging
@@ -194,7 +225,7 @@ The log level can be configured in two ways:
194225
2. Using the `logLevel` client option (overrides the environment variable if set)
195226

196227
```ts
197-
import SentDm from '@sentdm/sentdm';
228+
import SentDm from 'sent-dm';
198229

199230
const client = new SentDm({
200231
logLevel: 'debug', // Show all log messages
@@ -222,7 +253,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
222253
below the configured level will not be sent to your logger.
223254

224255
```ts
225-
import SentDm from '@sentdm/sentdm';
256+
import SentDm from 'sent-dm';
226257
import pino from 'pino';
227258

228259
const logger = pino();
@@ -257,7 +288,7 @@ parameter. This library doesn't validate at runtime that the request matches the
257288
send will be sent as-is.
258289

259290
```ts
260-
client.messages.sendToPhone({
291+
client.messages.send({
261292
// ...
262293
// @ts-expect-error baz is not yet public
263294
baz: 'undocumented option',
@@ -291,7 +322,7 @@ globalThis.fetch = fetch;
291322
Or pass it to the client:
292323

293324
```ts
294-
import SentDm from '@sentdm/sentdm';
325+
import SentDm from 'sent-dm';
295326
import fetch from 'my-fetch';
296327

297328
const client = new SentDm({ fetch });
@@ -302,7 +333,7 @@ const client = new SentDm({ fetch });
302333
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
303334

304335
```ts
305-
import SentDm from '@sentdm/sentdm';
336+
import SentDm from 'sent-dm';
306337

307338
const client = new SentDm({
308339
fetchOptions: {
@@ -319,7 +350,7 @@ options to requests:
319350
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
320351

321352
```ts
322-
import SentDm from '@sentdm/sentdm';
353+
import SentDm from 'sent-dm';
323354
import * as undici from 'undici';
324355

325356
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -333,7 +364,7 @@ const client = new SentDm({
333364
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
334365

335366
```ts
336-
import SentDm from '@sentdm/sentdm';
367+
import SentDm from 'sent-dm';
337368

338369
const client = new SentDm({
339370
fetchOptions: {
@@ -345,7 +376,7 @@ const client = new SentDm({
345376
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
346377

347378
```ts
348-
import SentDm from 'npm:@sentdm/sentdm';
379+
import SentDm from 'npm:sent-dm';
349380

350381
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
351382
const client = new SentDm({
@@ -367,7 +398,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
367398

368399
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
369400

370-
We are keen for your feedback; please open an [issue](https://www.github.com/sentdm/sent-dm-typescript/issues) with questions, bugs, or suggestions.
401+
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sent-dm-typescript/issues) with questions, bugs, or suggestions.
371402

372403
## Requirements
373404

0 commit comments

Comments
 (0)