Skip to content

Commit

Permalink
fix AI resource
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Oct 2, 2024
1 parent 990cf09 commit 3f6138c
Show file tree
Hide file tree
Showing 35 changed files with 439 additions and 113 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v2

### v2.0.0-alpha.2

- Fix `AI` resource methods and created nested structure

### v2.0.0-alpha.1

- Update actions workflow versions to v4 and `.npmignore` to v2
Expand Down Expand Up @@ -43,7 +47,6 @@
- Remove duplicated `BulkPhoneNumberCampaigns` resource
- Remove duplicated `BulkPhoneNumberOperations` resource


## v1

### v1.26.2
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.1
2.0.0-alpha.2
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.1",
"version": "2.0.0-alpha.2",
"description": "Telnyx API Node SDK",
"keywords": [
"telnyx",
Expand Down
43 changes: 0 additions & 43 deletions src/resources/AI.ts

This file was deleted.

25 changes: 25 additions & 0 deletions src/resources/AiAssistants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import TelnyxResource from '../TelnyxResource';
const telnyxMethod = TelnyxResource.method;

export const AiAssistants = TelnyxResource.extend({
path: 'ai/assistants',
includeBasic: ['list', 'create'],

retrieve: telnyxMethod({
method: 'GET',
path: '/{assistant_id}',
urlParams: ['assistant_id'],
}),

update: telnyxMethod({
method: 'POST',
path: '/{assistant_id}',
urlParams: ['assistant_id'],
}),

del: telnyxMethod({
method: 'DELETE',
path: '/{assistant_id}',
urlParams: ['assistant_id'],
}),
});
6 changes: 6 additions & 0 deletions src/resources/AiAudioTranscriptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import TelnyxResource from '../TelnyxResource';

export const AiAudioTranscriptions = TelnyxResource.extend({
path: 'ai/audio/transcriptions',
includeBasic: ['create'],
});
6 changes: 6 additions & 0 deletions src/resources/AiChatCompletions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import TelnyxResource from '../TelnyxResource';

export const AiChatCompletions = TelnyxResource.extend({
path: 'ai/chat/completions',
includeBasic: ['create'],
});
13 changes: 13 additions & 0 deletions src/resources/AiEmbeddings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import TelnyxResource from '../TelnyxResource';
const telnyxMethod = TelnyxResource.method;

export const AiEmbeddings = TelnyxResource.extend({
path: 'ai/embeddings',
includeBasic: ['list', 'create'],

retrieve: telnyxMethod({
method: 'GET',
path: '/{task_id}',
urlParams: ['task_id'],
}),
});
19 changes: 19 additions & 0 deletions src/resources/AiEmbeddingsBuckets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import TelnyxResource from '../TelnyxResource';
const telnyxMethod = TelnyxResource.method;

export const AiEmbeddingsBuckets = TelnyxResource.extend({
path: 'ai/embeddings/buckets',
includeBasic: ['list'],

retrieve: telnyxMethod({
method: 'GET',
path: '/{bucket_name}',
urlParams: ['bucket_name'],
}),

del: telnyxMethod({
method: 'DELETE',
path: '/{bucket_name}',
urlParams: ['bucket_name'],
}),
});
6 changes: 6 additions & 0 deletions src/resources/AiEmbeddingsSimilaritySearch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import TelnyxResource from '../TelnyxResource';

export const AiEmbeddingsSimilaritySearch = TelnyxResource.extend({
path: 'ai/embeddings/similarity-search',
includeBasic: ['create'],
});
6 changes: 6 additions & 0 deletions src/resources/AiModels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import TelnyxResource from '../TelnyxResource';

export const AiModels = TelnyxResource.extend({
path: 'ai/models',
includeBasic: ['list'],
});
6 changes: 6 additions & 0 deletions src/resources/AiSummarize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import TelnyxResource from '../TelnyxResource';

export const AiSummarize = TelnyxResource.extend({
path: 'ai/summarize',
includeBasic: ['create'],
});
1 change: 0 additions & 1 deletion src/resources/Conferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const Conferences = TelnyxResource.extend({

participants: telnyxMethod({
method: 'GET',

path: '/{conferenceId}/participants',
urlParams: ['conferenceId'],
}),
Expand Down
18 changes: 16 additions & 2 deletions src/telnyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ import {ActionsSimCards} from './resources/ActionsSimCards';
import {ActivateDeactivateBulkCredentials} from './resources/ActivateDeactivateBulkCredentials';
import {Addresses} from './resources/Addresses';
import {AutorespConfigs} from './resources/AutorespConfigs';
import {AI} from './resources/AI';
import {AiAssistants} from './resources/AiAssistants';
import {AiAudioTranscriptions} from './resources/AiAudioTranscriptions';
import {AiChatCompletions} from './resources/AiChatCompletions';
import {AiEmbeddings} from './resources/AiEmbeddings';
import {AiEmbeddingsBuckets} from './resources/AiEmbeddingsBuckets';
import {AiEmbeddingsSimilaritySearch} from './resources/AiEmbeddingsSimilaritySearch';
import {AiModels} from './resources/AiModels';
import {AiSummarize} from './resources/AiSummarize';
import {AuthenticationProviders} from './resources/AuthenticationProviders';
import {AvailablePhoneNumbers} from './resources/AvailablePhoneNumbers';
import {Balance} from './resources/Balance';
Expand Down Expand Up @@ -190,7 +197,14 @@ export function createTelnyx() {
ActivateDeactivateBulkCredentials,
Addresses,
AutorespConfigs,
AI,
AiAssistants,
AiAudioTranscriptions,
AiChatCompletions,
AiEmbeddings,
AiEmbeddingsBuckets,
AiEmbeddingsSimilaritySearch,
AiModels,
AiSummarize,
AuthenticationProviders,
AvailablePhoneNumbers,
Balance,
Expand Down
2 changes: 1 addition & 1 deletion types/AccessIpRangesResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare module 'telnyx' {
paths['/access_ip_ranges']['get']['parameters']['query'];

type AccessIpRangesListResponse =
paths['/access_ip_ranges']['get']['responses']['200']['content']['application/json']['data'];
paths['/access_ip_ranges']['get']['responses']['200']['content']['application/json'];

type AccessIpRangesDelId =
paths['/access_ip_ranges/{access_ip_range_id}']['delete']['parameters']['path']['access_ip_range_id'];
Expand Down
10 changes: 5 additions & 5 deletions types/AddressesResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ declare module 'telnyx' {
paths['/addresses/{id}']['get']['parameters']['query'];

type AddressesRetrieveResponse =
paths['/addresses/{id}']['get']['responses']['200']['content']['application/json']['data'];
paths['/addresses/{id}']['get']['responses']['200']['content']['application/json'];

type AddressesCreateParams =
paths['/addresses']['post']['requestBody']['content']['application/json'];

type AddressesCreateResponse =
paths['/addresses']['post']['responses']['200']['content']['application/json']['data'];
paths['/addresses']['post']['responses']['200']['content']['application/json'];

type AddressesValidateParams =
paths['/addresses/actions/validate']['post']['requestBody']['content']['application/json'];

type AddressesValidateResponse =
paths['/addresses/actions/validate']['post']['responses']['200']['content']['application/json']['data'];
paths['/addresses/actions/validate']['post']['responses']['200']['content']['application/json'];

type AddressesListParams =
paths['/addresses']['get']['parameters']['query'];

type AddressesListResponse =
paths['/addresses']['get']['responses']['200']['content']['application/json']['data'];
paths['/addresses']['get']['responses']['200']['content']['application/json'];

type AddressesDelId =
paths['/addresses/{id}']['delete']['parameters']['path']['id'];
Expand All @@ -36,7 +36,7 @@ declare module 'telnyx' {
paths['/addresses/{id}']['delete']['parameters']['query'];

type AddressesDelResponse =
paths['/addresses/{id}']['delete']['responses']['200']['content']['application/json']['data'];
paths['/addresses/{id}']['delete']['responses']['200']['content']['application/json'];

type AddressesNestedMethods = {
del: AddressesResource['del'];
Expand Down
69 changes: 69 additions & 0 deletions types/AiAssistantsResource.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {paths} from './TelnyxAPI.js';

declare module 'telnyx' {
namespace Telnyx {
type AiAssistantsRetrieveId =
paths['/ai/assistants/{assistant_id}']['get']['parameters']['path']['assistant_id'];

type AiAssistantsRetrieveResponse =
paths['/ai/assistants/{assistant_id}']['get']['responses']['200']['content']['application/json'];

type AiAssistantsListParams =
paths['/ai/assistants']['get']['parameters']['query'];

type AiAssistantsListResponse =
paths['/ai/assistants']['get']['responses']['200']['content']['application/json'];

type AiAssistantsCreateParams =
paths['/ai/assistants']['post']['requestBody']['content']['application/json'];

type AiAssistantsCreateResponse =
paths['/ai/assistants']['post']['responses']['200']['content']['application/json'];

type AiAssistantsDelId =
paths['/ai/assistants/{assistant_id}']['delete']['parameters']['path']['assistant_id'];

type AiAssistantsDelParams =
paths['/ai/assistants/{assistant_id}']['delete']['parameters']['query'];

type AiAssistantsDelResponse =
paths['/ai/assistants/{assistant_id}']['delete']['responses']['200']['content']['application/json'];

type AiAssistantsUpdateId =
paths['/ai/assistants/{assistant_id}']['post']['parameters']['path']['assistant_id'];

type AiAssistantsUpdateParams =
paths['/ai/assistants/{assistant_id}']['post']['requestBody']['content']['application/json'];

type AiAssistantsUpdateResponse =
paths['/ai/assistants/{assistant_id}']['post']['responses']['200']['content']['application/json'];

class AiAssistantsResource {
retrieve(
id: AiAssistantsRetrieveId,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAssistantsRetrieveResponse>>;

list(
params?: AiAssistantsListParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAssistantsListResponse>>;

create(
params: AiAssistantsCreateParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAssistantsCreateResponse>>;

del(
id: AiAssistantsDelId,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAssistantsDelResponse>>;

update(
id: AiAssistantsUpdateId,
params: AiAssistantsUpdateParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAssistantsUpdateResponse>>;
}
}
}
18 changes: 18 additions & 0 deletions types/AiAudioTranscriptionsResource.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {paths} from './TelnyxAPI.js';

declare module 'telnyx' {
namespace Telnyx {
type AiAudioTranscriptionsCreateParams =
paths['/ai/audio/transcriptions']['post']['requestBody']['content']['multipart/form-data'];

type AiAudioTranscriptionsCreateResponse =
paths['/ai/audio/transcriptions']['post']['responses']['200']['content']['application/json'];

class AiAudioTranscriptionsResource {
create(
params: AiAudioTranscriptionsCreateParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiAudioTranscriptionsCreateResponse>>;
}
}
}
18 changes: 18 additions & 0 deletions types/AiChatCompletionsResource.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {paths} from './TelnyxAPI.js';

declare module 'telnyx' {
namespace Telnyx {
type AiChatCompletionsCreateParams =
paths['/ai/chat/completions']['post']['requestBody']['content']['application/json'];

type AiChatCompletionsCreateResponse =
paths['/ai/chat/completions']['post']['responses']['200']['content']['application/json'];

class AiChatCompletionsResource {
create(
params: AiChatCompletionsCreateParams,
options?: RequestOptions,
): Promise<Telnyx.Response<Telnyx.AiChatCompletionsCreateResponse>>;
}
}
}
Loading

0 comments on commit 3f6138c

Please sign in to comment.