cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.3.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/calls/calls.ts

180lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import * as Core from '../../core';
4import { APIResource } from '../../resource';
5import * as TURNAPI from './turn/turn';
6import { SinglePage } from '../../pagination';
7
8export class Calls extends APIResource {
9 turn: TURNAPI.TURN = new TURNAPI.TURN(this._client);
10
11 /**
12 * Creates a new Cloudflare calls app. An app is an unique enviroment where each
13 * Session can access all Tracks within the app.
14 */
15 create(params: CallCreateParams, options?: Core.RequestOptions): Core.APIPromise<CallsAppWithSecret> {
16 const { account_id, ...body } = params;
17 return (
18 this._client.post(`/accounts/${account_id}/calls/apps`, { body, ...options }) as Core.APIPromise<{
19 result: CallsAppWithSecret;
20 }>
21 )._thenUnwrap((obj) => obj.result);
22 }
23
24 /**
25 * Edit details for a single app.
26 */
27 update(appId: string, params: CallUpdateParams, options?: Core.RequestOptions): Core.APIPromise<CallsApp> {
28 const { account_id, ...body } = params;
29 return (
30 this._client.put(`/accounts/${account_id}/calls/apps/${appId}`, {
31 body,
32 ...options,
33 }) as Core.APIPromise<{ result: CallsApp }>
34 )._thenUnwrap((obj) => obj.result);
35 }
36
37 /**
38 * Lists all apps in the Cloudflare account
39 */
40 list(
41 params: CallListParams,
42 options?: Core.RequestOptions,
43 ): Core.PagePromise<CallListResponsesSinglePage, CallListResponse> {
44 const { account_id } = params;
45 return this._client.getAPIList(
46 `/accounts/${account_id}/calls/apps`,
47 CallListResponsesSinglePage,
48 options,
49 );
50 }
51
52 /**
53 * Deletes an app from Cloudflare Calls
54 */
55 delete(appId: string, params: CallDeleteParams, options?: Core.RequestOptions): Core.APIPromise<CallsApp> {
56 const { account_id } = params;
57 return (
58 this._client.delete(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{
59 result: CallsApp;
60 }>
61 )._thenUnwrap((obj) => obj.result);
62 }
63
64 /**
65 * Fetches details for a single Calls app.
66 */
67 get(appId: string, params: CallGetParams, options?: Core.RequestOptions): Core.APIPromise<CallsApp> {
68 const { account_id } = params;
69 return (
70 this._client.get(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{
71 result: CallsApp;
72 }>
73 )._thenUnwrap((obj) => obj.result);
74 }
75}
76
77export class CallListResponsesSinglePage extends SinglePage<CallListResponse> {}
78
79export interface CallsApp {
80 /**
81 * The date and time the item was created.
82 */
83 created?: string;
84
85 /**
86 * The date and time the item was last modified.
87 */
88 modified?: string;
89
90 /**
91 * A short description of Calls app, not shown to end users.
92 */
93 name?: string;
94
95 /**
96 * A Cloudflare-generated unique identifier for a item.
97 */
98 uid?: string;
99}
100
101export interface CallsAppWithSecret {
102 /**
103 * The date and time the item was created.
104 */
105 created?: string;
106
107 /**
108 * The date and time the item was last modified.
109 */
110 modified?: string;
111
112 /**
113 * A short description of Calls app, not shown to end users.
114 */
115 name?: string;
116
117 /**
118 * Bearer token
119 */
120 secret?: string;
121
122 /**
123 * A Cloudflare-generated unique identifier for a item.
124 */
125 uid?: string;
126}
127
128/**
129 * Bearer token
130 */
131export type CallListResponse = string;
132
133export interface CallCreateParams {
134 /**
135 * Path param: The account identifier tag.
136 */
137 account_id: string;
138
139 /**
140 * Body param: A short description of Calls app, not shown to end users.
141 */
142 name?: string;
143}
144
145export interface CallUpdateParams {
146 /**
147 * Path param: The account identifier tag.
148 */
149 account_id: string;
150
151 /**
152 * Body param: A short description of Calls app, not shown to end users.
153 */
154 name?: string;
155}
156
157export interface CallListParams {
158 /**
159 * The account identifier tag.
160 */
161 account_id: string;
162}
163
164export interface CallDeleteParams {
165 /**
166 * The account identifier tag.
167 */
168 account_id: string;
169}
170
171export interface CallGetParams {
172 /**
173 * The account identifier tag.
174 */
175 account_id: string;
176}
177
178export namespace Calls {
179 export import TURN = TURNAPI.TURN;
180}
181