-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28ff778
commit e1371cc
Showing
15 changed files
with
212 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 13 | ||
configured_endpoints: 15 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-5276b9a8b8ff6771c5bb1a8310d0be63ddafa9e4806f0d81de21dd7a7a673c1b.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '../../resource'; | ||
import * as Core from '../../core'; | ||
import * as ContactsAPI from './contacts'; | ||
import * as SMSAPI from '../sms'; | ||
import * as WhatsappAPI from '../whatsapp'; | ||
import * as IDAPI from './id'; | ||
import * as PhoneAPI from './phone'; | ||
|
||
export class Contacts extends APIResource { | ||
id: IDAPI.ID = new IDAPI.ID(this._client); | ||
phone: PhoneAPI.Phone = new PhoneAPI.Phone(this._client); | ||
|
||
list(query: ContactListParams, options?: Core.RequestOptions): Core.APIPromise<unknown> { | ||
return this._client.get('/contacts', { query, ...options }); | ||
} | ||
} | ||
|
||
export interface SentDmServicesContractsDataContactDto { | ||
id?: string; | ||
|
||
availableChannels?: string; | ||
|
||
countryCode?: string; | ||
|
||
createdAt?: string; | ||
|
||
customerId?: string | null; | ||
|
||
defaultChannel?: string; | ||
|
||
nationalFormat?: string; | ||
|
||
phoneNumber?: string; | ||
|
||
smsPayloadDTO?: SMSAPI.SentDmServicesContractsDataSMSPayloadDto; | ||
|
||
updatedAt?: string; | ||
|
||
verified?: boolean; | ||
|
||
whatsappPayloadDTO?: WhatsappAPI.SentDmServicesContractsDataWhatsappPayloadDto; | ||
} | ||
|
||
export type ContactListResponse = unknown; | ||
|
||
export interface ContactListParams { | ||
customerId: string; | ||
|
||
page: number; | ||
|
||
pageSize: number; | ||
} | ||
|
||
export namespace Contacts { | ||
export import SentDmServicesContractsDataContactDto = ContactsAPI.SentDmServicesContractsDataContactDto; | ||
export import ContactListResponse = ContactsAPI.ContactListResponse; | ||
export import ContactListParams = ContactsAPI.ContactListParams; | ||
export import ID = IDAPI.ID; | ||
export import Phone = PhoneAPI.Phone; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '../../resource'; | ||
import * as Core from '../../core'; | ||
import * as ContactsAPI from './contacts'; | ||
|
||
export class ID extends APIResource { | ||
retrieve( | ||
customerId: string, | ||
id: string, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<ContactsAPI.SentDmServicesContractsDataContactDto> { | ||
return this._client.get(`/contacts/${customerId}/id/${id}`, options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
export { ID } from './id'; | ||
export { Phone } from './phone'; | ||
export { | ||
SentDmServicesContractsDataContactDto, | ||
ContactListResponse, | ||
ContactListParams, | ||
Contacts, | ||
} from './contacts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '../../resource'; | ||
import * as Core from '../../core'; | ||
import * as ContactsAPI from './contacts'; | ||
|
||
export class Phone extends APIResource { | ||
retrieve( | ||
customerId: string, | ||
phoneNumber: string, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<ContactsAPI.SentDmServicesContractsDataContactDto> { | ||
return this._client.get(`/contacts/${customerId}/phone/${phoneNumber}`, options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Sent from 'sent'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const client = new Sent({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource contacts', () => { | ||
test('list: only required params', async () => { | ||
const responsePromise = client.contacts.list({ customerId: 'customerId', page: 0, pageSize: 0 }); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('list: required and optional params', async () => { | ||
const response = await client.contacts.list({ customerId: 'customerId', page: 0, pageSize: 0 }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Sent from 'sent'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const client = new Sent({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource id', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = client.contacts.id.retrieve('customerId', 'id'); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('retrieve: request options instead of params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
client.contacts.id.retrieve('customerId', 'id', { path: '/_stainless_unknown_path' }), | ||
).rejects.toThrow(Sent.NotFoundError); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Sent from 'sent'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const client = new Sent({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource phone', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = client.contacts.phone.retrieve('customerId', 'phoneNumber'); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('retrieve: request options instead of params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
client.contacts.phone.retrieve('customerId', 'phoneNumber', { path: '/_stainless_unknown_path' }), | ||
).rejects.toThrow(Sent.NotFoundError); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters