Skip to content

Commit

Permalink
update optional types
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Oct 9, 2024
1 parent 7bdc48e commit 79a287c
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 58 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## v2

### v2.0.0-alpha.6

- Update optional types on `Webhooks`
- Make optional types on `Fqdns`, `Ips`, `Messages` and `StorageBuckets` resources more strict

### v2.0.0-alpha.5

- Remove `ClientStateUpdate` resource
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0-alpha.5
2.0.0-alpha.6
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "telnyx",
"version": "2.0.0-alpha.5",
"version": "2.0.0-alpha.6",
"description": "Telnyx API Node SDK",
"keywords": [
"telnyx",
Expand Down
20 changes: 10 additions & 10 deletions types/FqdnsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ declare module 'telnyx' {
type FqdnsDelResponse =
paths['/fqdns/{id}']['delete']['responses']['200']['content']['application/json'];

type FqdnsCreateParams =
| NonNullable<
paths['/fqdns']['post']['requestBody']
>['content']['application/json']
| Record<string, never>;
type FqdnsCreateOptionalParams = NonNullable<
paths['/fqdns']['post']['requestBody']
>['content']['application/json'];

type FqdnsCreateParams = FqdnsCreateOptionalParams | Record<string, never>;

type FqdnsCreateResponse =
paths['/fqdns']['post']['responses']['201']['content']['application/json'];
Expand All @@ -36,11 +36,11 @@ declare module 'telnyx' {
type FqdnsUpdateId =
paths['/fqdns/{id}']['patch']['parameters']['path']['id'];

type FqdnsUpdateParams =
| NonNullable<
paths['/fqdns/{id}']['patch']['requestBody']
>['content']['application/json']
| Record<string, never>;
type FqdnsUpdateOptionalParams = NonNullable<
paths['/fqdns/{id}']['patch']['requestBody']
>['content']['application/json'];

type FqdnsUpdateParams = FqdnsUpdateOptionalParams | Record<string, never>;

type FqdnsUpdateResponse =
paths['/fqdns/{id}']['patch']['responses']['200']['content']['application/json'];
Expand Down
20 changes: 10 additions & 10 deletions types/IpsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ declare module 'telnyx' {
type IpsDelResponse =
paths['/ips/{id}']['delete']['responses']['200']['content']['application/json'];

type IpsCreateParams =
| NonNullable<
paths['/ips']['post']['requestBody']
>['content']['application/json']
| Record<string, never>;
type IpsCreateOptionalParams = NonNullable<
paths['/ips']['post']['requestBody']
>['content']['application/json'];

type IpsCreateParams = IpsCreateOptionalParams | Record<string, never>;

type IpsCreateResponse =
paths['/ips']['post']['responses']['201']['content']['application/json'];
Expand All @@ -32,11 +32,11 @@ declare module 'telnyx' {

type IpsUpdateId = paths['/ips/{id}']['patch']['parameters']['path']['id'];

type IpsUpdateParams =
| NonNullable<
paths['/ips/{id}']['patch']['requestBody']
>['content']['application/json']
| Record<string, never>;
type IpsUpdateOptionalParams = NonNullable<
paths['/ips/{id}']['patch']['requestBody']
>['content']['application/json'];

type IpsUpdateParams = IpsUpdateOptionalParams | Record<string, never>;

type IpsUpdateResponse =
paths['/ips/{id}']['patch']['responses']['200']['content']['application/json'];
Expand Down
40 changes: 25 additions & 15 deletions types/MessagesResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import {paths} from './TelnyxAPI.js';

declare module 'telnyx' {
namespace Telnyx {
type MessagesCreateOptionalParams = NonNullable<
paths['/messages']['post']['requestBody']
>['content']['application/json'];

type MessagesCreateParams =
| NonNullable<
paths['/messages']['post']['requestBody']
>['content']['application/json']
| MessagesCreateOptionalParams
| Record<string, never>;

type MessagesCreateResponse =
Expand All @@ -17,37 +19,45 @@ declare module 'telnyx' {
type MessagesRetrieveResponse =
paths['/messages/{id}']['get']['responses']['200']['content']['application/json'];

type MessagesGroupMmsCreateOptionalParams = NonNullable<
paths['/messages/group_mms']['post']['requestBody']
>['content']['application/json'];

type MessagesGroupMmsCreateParams =
| NonNullable<
paths['/messages/group_mms']['post']['requestBody']
>['content']['application/json']
| MessagesGroupMmsCreateOptionalParams
| Record<string, never>;

type MessagesGroupMmsCreateResponse =
paths['/messages/group_mms']['post']['responses']['200']['content']['application/json'];

type MessagesLongCodeCreateOptionalParams = NonNullable<
paths['/messages/long_code']['post']['requestBody']
>['content']['application/json'];

type MessagesLongCodeCreateParams =
| NonNullable<
paths['/messages/long_code']['post']['requestBody']
>['content']['application/json']
| MessagesLongCodeCreateOptionalParams
| Record<string, never>;

type MessagesLongCodeCreateResponse =
paths['/messages/long_code']['post']['responses']['200']['content']['application/json'];

type MessagesShortCodeCreateOptionalParams = NonNullable<
paths['/messages/short_code']['post']['requestBody']
>['content']['application/json'];

type MessagesShortCodeCreateParams =
| NonNullable<
paths['/messages/short_code']['post']['requestBody']
>['content']['application/json']
| MessagesShortCodeCreateOptionalParams
| Record<string, never>;

type MessagesShortCodeCreateResponse =
paths['/messages/short_code']['post']['responses']['200']['content']['application/json'];

type MessagesNumberPoolCreateOptionalParams = NonNullable<
paths['/messages/number_pool']['post']['requestBody']
>['content']['application/json'];

type MessagesNumberPoolCreateParams =
| NonNullable<
paths['/messages/number_pool']['post']['requestBody']
>['content']['application/json']
| MessagesNumberPoolCreateOptionalParams
| Record<string, never>;

type MessagesNumberPoolCreateResponse =
Expand Down
19 changes: 8 additions & 11 deletions types/StorageBucketsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ declare module 'telnyx' {
type StorageBucketsDelSSLCertificateName =
paths['/storage/buckets/{bucketName}/ssl_certificate']['delete']['parameters']['path']['bucketName'];

type StorageBucketsAddSSLCertificateOptionalParam =
paths['/storage/buckets/{bucketName}/ssl_certificate']['put']['requestBody'];
type StorageBucketsAddSSLCertificateOptionalParams = NonNullable<
paths['/storage/buckets/{bucketName}/ssl_certificate']['put']['requestBody']
>['content']['multipart/form-data'];

type StorageBucketsAddSSLCertificateParam<
T extends StorageBucketsAddSSLCertificateOptionalParam,
> = T extends undefined
? undefined
: T extends {content: {'multipart/form-data': infer U}}
? U
: never;
type StorageBucketsAddSSLCertificateParams =
| StorageBucketsAddSSLCertificateOptionalParams
| Record<string, never>;

type StorageBucketsSSLCertificateResponse =
paths['/storage/buckets/{bucketName}/ssl_certificate']['get']['responses']['200']['content']['application/json'];
Expand All @@ -59,9 +56,9 @@ declare module 'telnyx' {
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.StorageBucketsSSLCertificateResponse>>;

addSslCertificate<T extends StorageBucketsAddSSLCertificateOptionalParam>(
addSslCertificate(
bucketName: StorageBucketsSSLCertificateName,
params: StorageBucketsAddSSLCertificateParam<T>,
params: StorageBucketsAddSSLCertificateParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.StorageBucketsSSLCertificateResponse>>;

Expand Down
16 changes: 8 additions & 8 deletions types/Webhooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ declare module 'telnyx' {
DEFAULT_TOLERANCE: number;
constructEvent: (
payload: WebhookPayload,
signatureHeader: WebhookHeader,
timestampHeader: WebhookHeader,
publicKey: string,
tolerance: number,
signatureHeader: WebhookHeader | undefined,
timestampHeader: string | undefined,
publicKey: Uint8Array,
tolerance?: number,
) => unknown;
signature: {
verifySignature: (
payload: string,
payload: WebhookPayload,
signatureHeader: WebhookHeader | undefined,
timestampHeader: WebhookHeader | undefined,
publicKey: string,
tolerance: number,
timestampHeader: string,
publicKey: Uint8Array,
tolerance?: number,
) => boolean;
};
}
Expand Down

0 comments on commit 79a287c

Please sign in to comment.