• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-typescript-sdk-gen / 6814673855

09 Nov 2023 04:31PM UTC coverage: 31.432% (+1.3%) from 30.127%
6814673855

Pull #41

github

web-flow
Merge 3aec2106f into 1aa8f5afc
Pull Request #41: codegen output 13ed41f186c7473db272e90659610b17

1501 of 9137 branches covered (0.0%)

Branch coverage included in aggregate %.

492 of 992 new or added lines in 75 files covered. (49.6%)

160 existing lines in 14 files now uncovered.

5124 of 11940 relevant lines covered (42.91%)

27.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/src/managers/collaborationAllowlistEntries.generated.ts
1
import { serializeCollaborationAllowlistEntries } from '../schemas.generated.js';
2
import { deserializeCollaborationAllowlistEntries } from '../schemas.generated.js';
70✔
3
import { serializeClientError } from '../schemas.generated.js';
4
import { deserializeClientError } from '../schemas.generated.js';
5
import { serializeCollaborationAllowlistEntry } from '../schemas.generated.js';
6
import { deserializeCollaborationAllowlistEntry } from '../schemas.generated.js';
70✔
7
import { CollaborationAllowlistEntries } from '../schemas.generated.js';
8
import { ClientError } from '../schemas.generated.js';
9
import { CollaborationAllowlistEntry } from '../schemas.generated.js';
10
import { Authentication } from '../auth.js';
11
import { NetworkSession } from '../network.js';
12
import { prepareParams } from '../utils.js';
70✔
13
import { toString } from '../utils.js';
70✔
14
import { ByteStream } from '../utils.js';
15
import { CancellationToken } from '../utils.js';
16
import { sdToJson } from '../json.js';
17
import { fetch } from '../fetch.js';
70✔
18
import { FetchOptions } from '../fetch.js';
19
import { FetchResponse } from '../fetch.js';
20
import { SerializedData } from '../json.js';
21
import { sdIsEmpty } from '../json.js';
22
import { sdIsBoolean } from '../json.js';
23
import { sdIsNumber } from '../json.js';
24
import { sdIsString } from '../json.js';
70✔
25
import { sdIsList } from '../json.js';
26
import { sdIsMap } from '../json.js';
27
export interface GetCollaborationWhitelistEntriesQueryParamsArg {
28
  readonly marker?: string;
29
  readonly limit?: number;
30
}
31
export class GetCollaborationWhitelistEntriesHeadersArg {
70✔
32
  readonly extraHeaders?: {
2✔
33
    readonly [key: string]: undefined | string;
34
  } = {};
35
  constructor(
36
    fields:
37
      | Omit<GetCollaborationWhitelistEntriesHeadersArg, 'extraHeaders'>
38
      | Partial<
39
          Pick<GetCollaborationWhitelistEntriesHeadersArg, 'extraHeaders'>
40
        >
41
  ) {
42
    Object.assign(this, fields);
2✔
43
  }
44
}
45
export type CreateCollaborationWhitelistEntryRequestBodyArgDirectionField =
46
  | 'inbound'
47
  | 'outbound'
48
  | 'both';
49
export interface CreateCollaborationWhitelistEntryRequestBodyArg {
50
  readonly domain: string;
51
  readonly direction: CreateCollaborationWhitelistEntryRequestBodyArgDirectionField;
52
}
53
export class CreateCollaborationWhitelistEntryHeadersArg {
70✔
54
  readonly extraHeaders?: {
2✔
55
    readonly [key: string]: undefined | string;
56
  } = {};
57
  constructor(
58
    fields:
59
      | Omit<CreateCollaborationWhitelistEntryHeadersArg, 'extraHeaders'>
60
      | Partial<
61
          Pick<CreateCollaborationWhitelistEntryHeadersArg, 'extraHeaders'>
62
        >
63
  ) {
64
    Object.assign(this, fields);
2✔
65
  }
66
}
67
export class GetCollaborationWhitelistEntryByIdHeadersArg {
70✔
68
  readonly extraHeaders?: {
4✔
69
    readonly [key: string]: undefined | string;
70
  } = {};
71
  constructor(
72
    fields:
73
      | Omit<GetCollaborationWhitelistEntryByIdHeadersArg, 'extraHeaders'>
74
      | Partial<
75
          Pick<GetCollaborationWhitelistEntryByIdHeadersArg, 'extraHeaders'>
76
        >
77
  ) {
78
    Object.assign(this, fields);
4✔
79
  }
80
}
81
export class DeleteCollaborationWhitelistEntryByIdHeadersArg {
70✔
82
  readonly extraHeaders?: {
2✔
83
    readonly [key: string]: undefined | string;
84
  } = {};
85
  constructor(
86
    fields:
87
      | Omit<DeleteCollaborationWhitelistEntryByIdHeadersArg, 'extraHeaders'>
88
      | Partial<
89
          Pick<DeleteCollaborationWhitelistEntryByIdHeadersArg, 'extraHeaders'>
90
        >
91
  ) {
92
    Object.assign(this, fields);
2✔
93
  }
94
}
95
export class CollaborationAllowlistEntriesManager {
70✔
96
  readonly auth?: Authentication;
97
  readonly networkSession?: NetworkSession;
98
  constructor(
99
    fields: Omit<
100
      CollaborationAllowlistEntriesManager,
101
      | 'getCollaborationWhitelistEntries'
102
      | 'createCollaborationWhitelistEntry'
103
      | 'getCollaborationWhitelistEntryById'
104
      | 'deleteCollaborationWhitelistEntryById'
105
    >
106
  ) {
107
    Object.assign(this, fields);
104✔
108
  }
109
  async getCollaborationWhitelistEntries(
110
    queryParams: GetCollaborationWhitelistEntriesQueryParamsArg = {} satisfies GetCollaborationWhitelistEntriesQueryParamsArg,
2✔
111
    headers: GetCollaborationWhitelistEntriesHeadersArg = new GetCollaborationWhitelistEntriesHeadersArg(
2✔
112
      {}
113
    ),
114
    cancellationToken?: CancellationToken
115
  ): Promise<CollaborationAllowlistEntries> {
116
    const queryParamsMap: {
117
      readonly [key: string]: string;
118
    } = prepareParams({
2✔
119
      ['marker']: toString(queryParams.marker) as string,
120
      ['limit']: toString(queryParams.limit) as string,
121
    });
122
    const headersMap: {
123
      readonly [key: string]: string;
124
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
125
    const response: FetchResponse = (await fetch(
2✔
126
      ''.concat(
127
        'https://api.box.com/2.0/collaboration_whitelist_entries'
128
      ) as string,
129
      {
130
        method: 'GET',
131
        params: queryParamsMap,
132
        headers: headersMap,
133
        responseFormat: 'json',
134
        auth: this.auth,
135
        networkSession: this.networkSession,
136
        cancellationToken: cancellationToken,
137
      } satisfies FetchOptions
138
    )) as FetchResponse;
139
    return deserializeCollaborationAllowlistEntries(response.data);
2✔
140
  }
141
  async createCollaborationWhitelistEntry(
142
    requestBody: CreateCollaborationWhitelistEntryRequestBodyArg,
143
    headers: CreateCollaborationWhitelistEntryHeadersArg = new CreateCollaborationWhitelistEntryHeadersArg(
2✔
144
      {}
145
    ),
146
    cancellationToken?: CancellationToken
147
  ): Promise<CollaborationAllowlistEntry> {
148
    const headersMap: {
149
      readonly [key: string]: string;
150
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
151
    const response: FetchResponse = (await fetch(
2✔
152
      ''.concat(
153
        'https://api.box.com/2.0/collaboration_whitelist_entries'
154
      ) as string,
155
      {
156
        method: 'POST',
157
        headers: headersMap,
158
        data: serializeCreateCollaborationWhitelistEntryRequestBodyArg(
159
          requestBody
160
        ),
161
        contentType: 'application/json',
162
        responseFormat: 'json',
163
        auth: this.auth,
164
        networkSession: this.networkSession,
165
        cancellationToken: cancellationToken,
166
      } satisfies FetchOptions
167
    )) as FetchResponse;
168
    return deserializeCollaborationAllowlistEntry(response.data);
2✔
169
  }
170
  async getCollaborationWhitelistEntryById(
171
    collaborationWhitelistEntryId: string,
172
    headers: GetCollaborationWhitelistEntryByIdHeadersArg = new GetCollaborationWhitelistEntryByIdHeadersArg(
4✔
173
      {}
174
    ),
175
    cancellationToken?: CancellationToken
176
  ): Promise<CollaborationAllowlistEntry> {
177
    const headersMap: {
178
      readonly [key: string]: string;
179
    } = prepareParams({ ...{}, ...headers.extraHeaders });
4✔
180
    const response: FetchResponse = (await fetch(
4✔
181
      ''.concat(
182
        'https://api.box.com/2.0/collaboration_whitelist_entries/',
183
        toString(collaborationWhitelistEntryId) as string
184
      ) as string,
185
      {
186
        method: 'GET',
187
        headers: headersMap,
188
        responseFormat: 'json',
189
        auth: this.auth,
190
        networkSession: this.networkSession,
191
        cancellationToken: cancellationToken,
192
      } satisfies FetchOptions
193
    )) as FetchResponse;
194
    return deserializeCollaborationAllowlistEntry(response.data);
2✔
195
  }
196
  async deleteCollaborationWhitelistEntryById(
197
    collaborationWhitelistEntryId: string,
198
    headers: DeleteCollaborationWhitelistEntryByIdHeadersArg = new DeleteCollaborationWhitelistEntryByIdHeadersArg(
2✔
199
      {}
200
    ),
201
    cancellationToken?: CancellationToken
202
  ): Promise<undefined> {
203
    const headersMap: {
204
      readonly [key: string]: string;
205
    } = prepareParams({ ...{}, ...headers.extraHeaders });
2✔
206
    const response: FetchResponse = (await fetch(
2✔
207
      ''.concat(
208
        'https://api.box.com/2.0/collaboration_whitelist_entries/',
209
        toString(collaborationWhitelistEntryId) as string
210
      ) as string,
211
      {
212
        method: 'DELETE',
213
        headers: headersMap,
214
        responseFormat: void 0,
215
        auth: this.auth,
216
        networkSession: this.networkSession,
217
        cancellationToken: cancellationToken,
218
      } satisfies FetchOptions
219
    )) as FetchResponse;
220
    return void 0;
2✔
221
  }
222
}
223
export function serializeCreateCollaborationWhitelistEntryRequestBodyArgDirectionField(
70✔
224
  val: CreateCollaborationWhitelistEntryRequestBodyArgDirectionField
225
): SerializedData {
226
  return val;
2✔
227
}
228
export function deserializeCreateCollaborationWhitelistEntryRequestBodyArgDirectionField(
70✔
229
  val: any
230
): CreateCollaborationWhitelistEntryRequestBodyArgDirectionField {
NEW
231
  if (!sdIsString(val)) {
×
232
    throw 'Expecting a string for "CreateCollaborationWhitelistEntryRequestBodyArgDirectionField"';
×
233
  }
234
  if (val == 'inbound') {
×
235
    return 'inbound';
×
236
  }
237
  if (val == 'outbound') {
×
238
    return 'outbound';
×
239
  }
240
  if (val == 'both') {
×
241
    return 'both';
×
242
  }
243
  throw ''.concat('Invalid value: ', val) as string;
×
244
}
245
export function serializeCreateCollaborationWhitelistEntryRequestBodyArg(
70✔
246
  val: CreateCollaborationWhitelistEntryRequestBodyArg
247
): SerializedData {
248
  return {
2✔
249
    ['domain']: val.domain,
250
    ['direction']:
251
      serializeCreateCollaborationWhitelistEntryRequestBodyArgDirectionField(
252
        val.direction
253
      ),
254
  };
255
}
256
export function deserializeCreateCollaborationWhitelistEntryRequestBodyArg(
70✔
257
  val: any
258
): CreateCollaborationWhitelistEntryRequestBodyArg {
259
  const domain: string = val.domain;
×
260
  const direction: CreateCollaborationWhitelistEntryRequestBodyArgDirectionField =
261
    deserializeCreateCollaborationWhitelistEntryRequestBodyArgDirectionField(
×
262
      val.direction
263
    );
264
  return {
×
265
    domain: domain,
266
    direction: direction,
267
  } satisfies CreateCollaborationWhitelistEntryRequestBodyArg;
268
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc