diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a01d5..77a1e84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## v2 +### v2.0.0-alpha.3 + +- Update typing on Nested Resources + ### v2.0.0-alpha.2 - Fix `AI` resource methods and created nested structure diff --git a/README.md b/README.md index 3f769a2..897b13e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Build Status](https://github.com/team-telnyx/telnyx-node/workflows/CI/badge.svg)](https://github.com/team-telnyx/telnyx-node/actions) [![Downloads](https://img.shields.io/npm/dm/telnyx.svg)](https://www.npmjs.com/package/telnyx) [![Try on RunKit](https://badge.runkitcdn.com/telnyx.svg)](https://runkit.com/npm/telnyx) +[![Code Style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier") [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://joinslack.telnyx.com/) The Telnyx Node library provides convenient access to the Telnyx API from diff --git a/VERSION b/VERSION index 453787a..4640d57 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0-alpha.2 +2.0.0-alpha.3 diff --git a/package-lock.json b/package-lock.json index 31ae193..0e29439 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "telnyx", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "telnyx", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "license": "MIT", "devDependencies": { "@eslint/js": "^9.10.0", diff --git a/package.json b/package.json index a6b97c8..b6dd14f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telnyx", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "description": "Telnyx API Node SDK", "keywords": [ "telnyx", diff --git a/src/resources/Addresses.ts b/src/resources/Addresses.ts index 7859c20..41763f8 100644 --- a/src/resources/Addresses.ts +++ b/src/resources/Addresses.ts @@ -26,8 +26,6 @@ export const Addresses = TelnyxResource.extend({ list: telnyxMethod({ method: 'GET', methodType: 'list', - - transformResponseData: transformResponseData, }), create: telnyxMethod({ diff --git a/types/AddressesResource.d.ts b/types/AddressesResource.d.ts index afb5f2b..ec1a9bd 100644 --- a/types/AddressesResource.d.ts +++ b/types/AddressesResource.d.ts @@ -48,7 +48,11 @@ declare module 'telnyx' { options?: RequestOptions, ): Promise< Telnyx.Response< - Telnyx.AddressesRetrieveResponse & AddressesNestedMethods + Telnyx.AddressesRetrieveResponse & + NestedResponseData< + AddressesRetrieveResponse['data'], + AddressesNestedMethods + > > >; @@ -56,7 +60,13 @@ declare module 'telnyx' { params: AddressesCreateParams, options?: RequestOptions, ): Promise< - Telnyx.Response + Telnyx.Response< + Telnyx.AddressesCreateResponse & + NestedResponseData< + AddressesCreateResponse['data'], + AddressesNestedMethods + > + > >; validate( diff --git a/types/CallsResource.d.ts b/types/CallsResource.d.ts index c0d2f73..05d7b6a 100644 --- a/types/CallsResource.d.ts +++ b/types/CallsResource.d.ts @@ -172,14 +172,20 @@ declare module 'telnyx' { params: CallsCreateParams, options?: RequestOptions, ): Promise< - Telnyx.Response + Telnyx.Response< + Telnyx.CallsCreateResponse & + NestedResponseData + > >; dial( params: CallsCreateParams, options?: RequestOptions, ): Promise< - Telnyx.Response + Telnyx.Response< + Telnyx.CallsCreateResponse & + NestedResponseData + > >; answer( diff --git a/types/MessagingProfilesResource.d.ts b/types/MessagingProfilesResource.d.ts index 119db7e..e3e6aa0 100644 --- a/types/MessagingProfilesResource.d.ts +++ b/types/MessagingProfilesResource.d.ts @@ -76,7 +76,10 @@ declare module 'telnyx' { ): Promise< Telnyx.Response< Telnyx.MessagingProfilesCreateResponse & - MessagingProfilesNestedMethods + NestedResponseData< + MessagingProfilesCreateResponse['data'], + MessagingProfilesNestedMethods + > > >; @@ -97,7 +100,10 @@ declare module 'telnyx' { ): Promise< Telnyx.Response< Telnyx.MessagingProfilesRetrieveResponse & - MessagingProfilesNestedMethods + NestedResponseData< + MessagingProfilesRetrieveResponse['data'], + MessagingProfilesNestedMethods + > > >; diff --git a/types/lib.d.ts b/types/lib.d.ts index 0260d22..ea1c74e 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -33,6 +33,8 @@ declare module 'telnyx' { headers?: Record; } + export type NestedResponseData = {data?: T & N}; + export type Response = T & { lastResponse: { headers: Record;