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

box / box-typescript-sdk-gen / 12373074501

17 Dec 2024 12:32PM UTC coverage: 43.446% (+0.05%) from 43.401%
12373074501

Pull #450

github

web-flow
Merge 2b9f7a5b0 into 03d7f3ef2
Pull Request #450: docs: remove parameter from Sign page (box/box-openapi#489)

3911 of 15217 branches covered (25.7%)

Branch coverage included in aggregate %.

6 of 12 new or added lines in 1 file covered. (50.0%)

8 existing lines in 6 files now uncovered.

13670 of 25249 relevant lines covered (54.14%)

81.18 hits per line

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

52.91
/src/schemas/signRequestSigner.generated.ts
1
import { serializeSignRequestCreateSignerRoleField } from './signRequestCreateSigner.generated.js';
2
import { deserializeSignRequestCreateSignerRoleField } from './signRequestCreateSigner.generated.js';
140✔
3
import { serializeSignRequestCreateSigner } from './signRequestCreateSigner.generated.js';
140✔
4
import { deserializeSignRequestCreateSigner } from './signRequestCreateSigner.generated.js';
5
import { serializeSignRequestSignerInput } from './signRequestSignerInput.generated.js';
140✔
6
import { deserializeSignRequestSignerInput } from './signRequestSignerInput.generated.js';
140✔
7
import { serializeDateTime } from '../internal/utils.js';
140✔
8
import { deserializeDateTime } from '../internal/utils.js';
140✔
9
import { SignRequestCreateSignerRoleField } from './signRequestCreateSigner.generated.js';
10
import { SignRequestCreateSigner } from './signRequestCreateSigner.generated.js';
11
import { SignRequestSignerInput } from './signRequestSignerInput.generated.js';
12
import { BoxSdkError } from '../box/errors.js';
140✔
13
import { DateTime } from '../internal/utils.js';
14
import { SerializedData } from '../serialization/json.js';
15
import { sdIsEmpty } from '../serialization/json.js';
16
import { sdIsBoolean } from '../serialization/json.js';
140✔
17
import { sdIsNumber } from '../serialization/json.js';
140✔
18
import { sdIsString } from '../serialization/json.js';
140✔
19
import { sdIsList } from '../serialization/json.js';
140✔
20
import { sdIsMap } from '../serialization/json.js';
140✔
21
export type SignRequestSignerSignerDecisionTypeField = 'signed' | 'declined';
22
export interface SignRequestSignerSignerDecisionField {
23
  /**
24
   * Type of decision made by the signer. */
25
  readonly type?: SignRequestSignerSignerDecisionTypeField;
26
  /**
27
   * Date and Time that the decision was made. */
28
  readonly finalizedAt?: DateTime;
29
  /**
30
   * Additional info about the decision, such as the decline reason from the signer. */
31
  readonly additionalInfo?: string | null;
32
  readonly rawData?: SerializedData;
33
}
34
export type SignRequestSigner = SignRequestCreateSigner & {
35
  /**
36
   * Set to `true` if the signer views the document */
37
  readonly hasViewedDocument?: boolean;
38
  /**
39
   * Final decision made by the signer. */
40
  readonly signerDecision?: SignRequestSignerSignerDecisionField | null;
41
  readonly inputs?: readonly SignRequestSignerInput[];
42
  /**
43
   * URL to direct a signer to for signing */
44
  readonly embedUrl?: string | null;
45
  /**
46
   * This URL is specifically designed for
47
   * signing documents within an HTML `iframe` tag.
48
   * It will be returned in the response
49
   * only if the `embed_url_external_user_id`
50
   * parameter was passed in the
51
   * `create Box Sign request` call. */
52
  readonly iframeableEmbedUrl?: string | null;
53
};
54
export function serializeSignRequestSignerSignerDecisionTypeField(
140✔
55
  val: SignRequestSignerSignerDecisionTypeField,
56
): SerializedData {
57
  return val;
×
58
}
59
export function deserializeSignRequestSignerSignerDecisionTypeField(
140✔
60
  val: SerializedData,
61
): SignRequestSignerSignerDecisionTypeField {
62
  if (val == 'signed') {
×
63
    return val;
×
64
  }
65
  if (val == 'declined') {
×
66
    return val;
×
67
  }
68
  throw new BoxSdkError({
×
69
    message: "Can't deserialize SignRequestSignerSignerDecisionTypeField",
70
  });
71
}
72
export function serializeSignRequestSignerSignerDecisionField(
140✔
73
  val: SignRequestSignerSignerDecisionField,
74
): SerializedData {
75
  return {
×
76
    ['type']:
77
      val.type == void 0
×
78
        ? val.type
79
        : serializeSignRequestSignerSignerDecisionTypeField(val.type),
80
    ['finalized_at']:
81
      val.finalizedAt == void 0
×
82
        ? val.finalizedAt
83
        : serializeDateTime(val.finalizedAt),
84
    ['additional_info']: val.additionalInfo,
85
  };
86
}
87
export function deserializeSignRequestSignerSignerDecisionField(
140✔
88
  val: SerializedData,
89
): SignRequestSignerSignerDecisionField {
90
  if (!sdIsMap(val)) {
×
91
    throw new BoxSdkError({
×
92
      message: 'Expecting a map for "SignRequestSignerSignerDecisionField"',
93
    });
94
  }
95
  const type: undefined | SignRequestSignerSignerDecisionTypeField =
96
    val.type == void 0
×
97
      ? void 0
98
      : deserializeSignRequestSignerSignerDecisionTypeField(val.type);
99
  if (!(val.finalized_at == void 0) && !sdIsString(val.finalized_at)) {
×
100
    throw new BoxSdkError({
×
101
      message:
102
        'Expecting string for "finalized_at" of type "SignRequestSignerSignerDecisionField"',
103
    });
104
  }
105
  const finalizedAt: undefined | DateTime =
106
    val.finalized_at == void 0 ? void 0 : deserializeDateTime(val.finalized_at);
×
107
  if (!(val.additional_info == void 0) && !sdIsString(val.additional_info)) {
×
108
    throw new BoxSdkError({
×
109
      message:
110
        'Expecting string for "additional_info" of type "SignRequestSignerSignerDecisionField"',
111
    });
112
  }
113
  const additionalInfo: undefined | string =
114
    val.additional_info == void 0 ? void 0 : val.additional_info;
×
115
  return {
×
116
    type: type,
117
    finalizedAt: finalizedAt,
118
    additionalInfo: additionalInfo,
119
  } satisfies SignRequestSignerSignerDecisionField;
120
}
121
export function serializeSignRequestSigner(
140✔
122
  val: SignRequestSigner,
123
): SerializedData {
124
  const base: any = serializeSignRequestCreateSigner(val);
×
125
  if (!sdIsMap(base)) {
×
126
    throw new BoxSdkError({
×
127
      message: 'Expecting a map for "SignRequestSigner"',
128
    });
129
  }
130
  return {
×
131
    ...base,
132
    ...{
133
      ['has_viewed_document']: val.hasViewedDocument,
134
      ['signer_decision']:
135
        val.signerDecision == void 0
×
136
          ? val.signerDecision
137
          : serializeSignRequestSignerSignerDecisionField(val.signerDecision),
138
      ['inputs']:
139
        val.inputs == void 0
×
140
          ? val.inputs
141
          : (val.inputs.map(function (
142
              item: SignRequestSignerInput,
143
            ): SerializedData {
144
              return serializeSignRequestSignerInput(item);
×
145
            }) as readonly any[]),
146
      ['embed_url']: val.embedUrl,
147
      ['iframeable_embed_url']: val.iframeableEmbedUrl,
148
    },
149
  };
150
}
151
export function deserializeSignRequestSigner(
140✔
152
  val: SerializedData,
153
): SignRequestSigner {
154
  if (!sdIsMap(val)) {
22!
155
    throw new BoxSdkError({
×
156
      message: 'Expecting a map for "SignRequestSigner"',
157
    });
158
  }
159
  if (
22!
160
    !(val.has_viewed_document == void 0) &&
44✔
161
    !sdIsBoolean(val.has_viewed_document)
162
  ) {
163
    throw new BoxSdkError({
×
164
      message:
165
        'Expecting boolean for "has_viewed_document" of type "SignRequestSigner"',
166
    });
167
  }
168
  const hasViewedDocument: undefined | boolean =
169
    val.has_viewed_document == void 0 ? void 0 : val.has_viewed_document;
22!
170
  const signerDecision: undefined | SignRequestSignerSignerDecisionField =
171
    val.signer_decision == void 0
22!
172
      ? void 0
173
      : deserializeSignRequestSignerSignerDecisionField(val.signer_decision);
174
  if (!(val.inputs == void 0) && !sdIsList(val.inputs)) {
22!
175
    throw new BoxSdkError({
×
176
      message: 'Expecting array for "inputs" of type "SignRequestSigner"',
177
    });
178
  }
179
  const inputs: undefined | readonly SignRequestSignerInput[] =
180
    val.inputs == void 0
22!
181
      ? void 0
182
      : sdIsList(val.inputs)
22!
183
        ? (val.inputs.map(function (
184
            itm: SerializedData,
185
          ): SignRequestSignerInput {
186
            return deserializeSignRequestSignerInput(itm);
×
187
          }) as readonly any[])
188
        : [];
189
  if (!(val.embed_url == void 0) && !sdIsString(val.embed_url)) {
22!
190
    throw new BoxSdkError({
×
191
      message: 'Expecting string for "embed_url" of type "SignRequestSigner"',
192
    });
193
  }
194
  const embedUrl: undefined | string =
195
    val.embed_url == void 0 ? void 0 : val.embed_url;
22✔
196
  if (
22!
197
    !(val.iframeable_embed_url == void 0) &&
30✔
198
    !sdIsString(val.iframeable_embed_url)
199
  ) {
200
    throw new BoxSdkError({
×
201
      message:
202
        'Expecting string for "iframeable_embed_url" of type "SignRequestSigner"',
203
    });
204
  }
205
  const iframeableEmbedUrl: undefined | string =
206
    val.iframeable_embed_url == void 0 ? void 0 : val.iframeable_embed_url;
22✔
207
  if (!(val.email == void 0) && !sdIsString(val.email)) {
22!
208
    throw new BoxSdkError({
×
209
      message: 'Expecting string for "email" of type "SignRequestSigner"',
210
    });
211
  }
212
  const email: undefined | string = val.email == void 0 ? void 0 : val.email;
22!
213
  const role: undefined | SignRequestCreateSignerRoleField =
214
    val.role == void 0
22!
215
      ? void 0
216
      : deserializeSignRequestCreateSignerRoleField(val.role);
217
  if (!(val.is_in_person == void 0) && !sdIsBoolean(val.is_in_person)) {
22!
218
    throw new BoxSdkError({
×
219
      message:
220
        'Expecting boolean for "is_in_person" of type "SignRequestSigner"',
221
    });
222
  }
223
  const isInPerson: undefined | boolean =
224
    val.is_in_person == void 0 ? void 0 : val.is_in_person;
22!
225
  if (!(val.order == void 0) && !sdIsNumber(val.order)) {
22!
226
    throw new BoxSdkError({
×
227
      message: 'Expecting number for "order" of type "SignRequestSigner"',
228
    });
229
  }
230
  const order: undefined | number = val.order == void 0 ? void 0 : val.order;
22!
231
  if (
22!
232
    !(val.embed_url_external_user_id == void 0) &&
30✔
233
    !sdIsString(val.embed_url_external_user_id)
234
  ) {
235
    throw new BoxSdkError({
×
236
      message:
237
        'Expecting string for "embed_url_external_user_id" of type "SignRequestSigner"',
238
    });
239
  }
240
  const embedUrlExternalUserId: undefined | string =
241
    val.embed_url_external_user_id == void 0
22✔
242
      ? void 0
243
      : val.embed_url_external_user_id;
244
  if (!(val.redirect_url == void 0) && !sdIsString(val.redirect_url)) {
22!
245
    throw new BoxSdkError({
×
246
      message:
247
        'Expecting string for "redirect_url" of type "SignRequestSigner"',
248
    });
249
  }
250
  const redirectUrl: undefined | string =
251
    val.redirect_url == void 0 ? void 0 : val.redirect_url;
22✔
252
  if (
22!
253
    !(val.declined_redirect_url == void 0) &&
38✔
254
    !sdIsString(val.declined_redirect_url)
255
  ) {
256
    throw new BoxSdkError({
×
257
      message:
258
        'Expecting string for "declined_redirect_url" of type "SignRequestSigner"',
259
    });
260
  }
261
  const declinedRedirectUrl: undefined | string =
262
    val.declined_redirect_url == void 0 ? void 0 : val.declined_redirect_url;
22✔
263
  if (!(val.login_required == void 0) && !sdIsBoolean(val.login_required)) {
22!
264
    throw new BoxSdkError({
×
265
      message:
266
        'Expecting boolean for "login_required" of type "SignRequestSigner"',
267
    });
268
  }
269
  const loginRequired: undefined | boolean =
270
    val.login_required == void 0 ? void 0 : val.login_required;
22!
271
  if (!(val.password == void 0) && !sdIsString(val.password)) {
22!
UNCOV
272
    throw new BoxSdkError({
×
273
      message: 'Expecting string for "password" of type "SignRequestSigner"',
274
    });
275
  }
276
  const password: undefined | string =
277
    val.password == void 0 ? void 0 : val.password;
22!
278
  if (!(val.signer_group_id == void 0) && !sdIsString(val.signer_group_id)) {
22!
279
    throw new BoxSdkError({
×
280
      message:
281
        'Expecting string for "signer_group_id" of type "SignRequestSigner"',
282
    });
283
  }
284
  const signerGroupId: undefined | string =
285
    val.signer_group_id == void 0 ? void 0 : val.signer_group_id;
22✔
286
  if (
22!
287
    !(val.suppress_notifications == void 0) &&
44✔
288
    !sdIsBoolean(val.suppress_notifications)
289
  ) {
290
    throw new BoxSdkError({
×
291
      message:
292
        'Expecting boolean for "suppress_notifications" of type "SignRequestSigner"',
293
    });
294
  }
295
  const suppressNotifications: undefined | boolean =
296
    val.suppress_notifications == void 0 ? void 0 : val.suppress_notifications;
22!
297
  return {
22✔
298
    hasViewedDocument: hasViewedDocument,
299
    signerDecision: signerDecision,
300
    inputs: inputs,
301
    embedUrl: embedUrl,
302
    iframeableEmbedUrl: iframeableEmbedUrl,
303
    email: email,
304
    role: role,
305
    isInPerson: isInPerson,
306
    order: order,
307
    embedUrlExternalUserId: embedUrlExternalUserId,
308
    redirectUrl: redirectUrl,
309
    declinedRedirectUrl: declinedRedirectUrl,
310
    loginRequired: loginRequired,
311
    password: password,
312
    signerGroupId: signerGroupId,
313
    suppressNotifications: suppressNotifications,
314
  } satisfies SignRequestSigner;
315
}
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