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

box / box-typescript-sdk-gen / 16500038122

24 Jul 2025 02:42PM UTC coverage: 42.377% (-0.1%) from 42.481%
16500038122

Pull #674

github

web-flow
Merge b97a4a593 into 52c4e2f80
Pull Request #674: feat: Archive Public API (box/box-openapi#540)

4462 of 18307 branches covered (24.37%)

Branch coverage included in aggregate %.

47 of 180 new or added lines in 5 files covered. (26.11%)

1 existing line in 1 file now uncovered.

16490 of 31135 relevant lines covered (52.96%)

151.28 hits per line

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

11.83
/src/schemas/v2025R0/archiveV2025R0.generated.ts
1
import { BoxSdkError } from '../../box/errors.js';
237✔
2
import { SerializedData } from '../../serialization/json.js';
3
import { sdIsEmpty } from '../../serialization/json.js';
4
import { sdIsBoolean } from '../../serialization/json.js';
5
import { sdIsNumber } from '../../serialization/json.js';
237✔
6
import { sdIsString } from '../../serialization/json.js';
237✔
7
import { sdIsList } from '../../serialization/json.js';
8
import { sdIsMap } from '../../serialization/json.js';
237✔
9
export type ArchiveV2025R0TypeField = 'archive';
10
export class ArchiveV2025R0 {
237✔
11
  /**
12
   * The unique identifier that represents an archive. */
13
  readonly id!: string;
14
  /**
15
   * The value will always be `archive`. */
NEW
16
  readonly type: ArchiveV2025R0TypeField = 'archive' as ArchiveV2025R0TypeField;
×
17
  /**
18
   * The name of the archive.
19
   *
20
   * The following restrictions to the archive name apply: names containing
21
   * non-printable ASCII characters, forward and backward slashes
22
   * (`/`, `\`), names with trailing spaces, and names `.` and `..` are
23
   * not allowed. */
24
  readonly name!: string;
25
  /**
26
   * The size of the archive in bytes. */
27
  readonly size!: number;
28
  readonly rawData?: SerializedData;
29
  constructor(
30
    fields: Omit<ArchiveV2025R0, 'type'> &
31
      Partial<Pick<ArchiveV2025R0, 'type'>>,
32
  ) {
NEW
33
    if (fields.id !== undefined) {
×
NEW
34
      this.id = fields.id;
×
35
    }
NEW
36
    if (fields.type !== undefined) {
×
NEW
37
      this.type = fields.type;
×
38
    }
NEW
39
    if (fields.name !== undefined) {
×
NEW
40
      this.name = fields.name;
×
41
    }
NEW
42
    if (fields.size !== undefined) {
×
NEW
43
      this.size = fields.size;
×
44
    }
NEW
45
    if (fields.rawData !== undefined) {
×
NEW
46
      this.rawData = fields.rawData;
×
47
    }
48
  }
49
}
50
export interface ArchiveV2025R0Input {
51
  /**
52
   * The unique identifier that represents an archive. */
53
  readonly id: string;
54
  /**
55
   * The value will always be `archive`. */
56
  readonly type?: ArchiveV2025R0TypeField;
57
  /**
58
   * The name of the archive.
59
   *
60
   * The following restrictions to the archive name apply: names containing
61
   * non-printable ASCII characters, forward and backward slashes
62
   * (`/`, `\`), names with trailing spaces, and names `.` and `..` are
63
   * not allowed. */
64
  readonly name: string;
65
  /**
66
   * The size of the archive in bytes. */
67
  readonly size: number;
68
  readonly rawData?: SerializedData;
69
}
70
export function serializeArchiveV2025R0TypeField(
237✔
71
  val: ArchiveV2025R0TypeField,
72
): SerializedData {
NEW
73
  return val;
×
74
}
75
export function deserializeArchiveV2025R0TypeField(
237✔
76
  val: SerializedData,
77
): ArchiveV2025R0TypeField {
NEW
78
  if (val == 'archive') {
×
NEW
79
    return val;
×
80
  }
NEW
81
  throw new BoxSdkError({
×
82
    message: "Can't deserialize ArchiveV2025R0TypeField",
83
  });
84
}
85
export function serializeArchiveV2025R0(val: ArchiveV2025R0): SerializedData {
237✔
NEW
86
  return {
×
87
    ['id']: val.id,
88
    ['type']: serializeArchiveV2025R0TypeField(val.type),
89
    ['name']: val.name,
90
    ['size']: val.size,
91
  };
92
}
93
export function deserializeArchiveV2025R0(val: SerializedData): ArchiveV2025R0 {
237✔
NEW
94
  if (!sdIsMap(val)) {
×
NEW
95
    throw new BoxSdkError({ message: 'Expecting a map for "ArchiveV2025R0"' });
×
96
  }
NEW
97
  if (val.id == void 0) {
×
NEW
98
    throw new BoxSdkError({
×
99
      message: 'Expecting "id" of type "ArchiveV2025R0" to be defined',
100
    });
101
  }
NEW
102
  if (!sdIsString(val.id)) {
×
NEW
103
    throw new BoxSdkError({
×
104
      message: 'Expecting string for "id" of type "ArchiveV2025R0"',
105
    });
106
  }
NEW
107
  const id: string = val.id;
×
NEW
108
  if (val.type == void 0) {
×
NEW
109
    throw new BoxSdkError({
×
110
      message: 'Expecting "type" of type "ArchiveV2025R0" to be defined',
111
    });
112
  }
NEW
113
  const type: ArchiveV2025R0TypeField = deserializeArchiveV2025R0TypeField(
×
114
    val.type,
115
  );
NEW
116
  if (val.name == void 0) {
×
NEW
117
    throw new BoxSdkError({
×
118
      message: 'Expecting "name" of type "ArchiveV2025R0" to be defined',
119
    });
120
  }
NEW
121
  if (!sdIsString(val.name)) {
×
NEW
122
    throw new BoxSdkError({
×
123
      message: 'Expecting string for "name" of type "ArchiveV2025R0"',
124
    });
125
  }
NEW
126
  const name: string = val.name;
×
NEW
127
  if (val.size == void 0) {
×
NEW
128
    throw new BoxSdkError({
×
129
      message: 'Expecting "size" of type "ArchiveV2025R0" to be defined',
130
    });
131
  }
NEW
132
  if (!sdIsNumber(val.size)) {
×
NEW
133
    throw new BoxSdkError({
×
134
      message: 'Expecting number for "size" of type "ArchiveV2025R0"',
135
    });
136
  }
NEW
137
  const size: number = val.size;
×
NEW
138
  return {
×
139
    id: id,
140
    type: type,
141
    name: name,
142
    size: size,
143
  } satisfies ArchiveV2025R0;
144
}
145
export function serializeArchiveV2025R0Input(
237✔
146
  val: ArchiveV2025R0Input,
147
): SerializedData {
NEW
148
  return {
×
149
    ['id']: val.id,
150
    ['type']:
151
      val.type == void 0
×
152
        ? val.type
153
        : serializeArchiveV2025R0TypeField(val.type),
154
    ['name']: val.name,
155
    ['size']: val.size,
156
  };
157
}
158
export function deserializeArchiveV2025R0Input(
237✔
159
  val: SerializedData,
160
): ArchiveV2025R0Input {
NEW
161
  if (!sdIsMap(val)) {
×
NEW
162
    throw new BoxSdkError({
×
163
      message: 'Expecting a map for "ArchiveV2025R0Input"',
164
    });
165
  }
NEW
166
  if (val.id == void 0) {
×
NEW
167
    throw new BoxSdkError({
×
168
      message: 'Expecting "id" of type "ArchiveV2025R0Input" to be defined',
169
    });
170
  }
NEW
171
  if (!sdIsString(val.id)) {
×
NEW
172
    throw new BoxSdkError({
×
173
      message: 'Expecting string for "id" of type "ArchiveV2025R0Input"',
174
    });
175
  }
NEW
176
  const id: string = val.id;
×
177
  const type: undefined | ArchiveV2025R0TypeField =
NEW
178
    val.type == void 0 ? void 0 : deserializeArchiveV2025R0TypeField(val.type);
×
NEW
179
  if (val.name == void 0) {
×
NEW
180
    throw new BoxSdkError({
×
181
      message: 'Expecting "name" of type "ArchiveV2025R0Input" to be defined',
182
    });
183
  }
NEW
184
  if (!sdIsString(val.name)) {
×
NEW
185
    throw new BoxSdkError({
×
186
      message: 'Expecting string for "name" of type "ArchiveV2025R0Input"',
187
    });
188
  }
NEW
189
  const name: string = val.name;
×
NEW
190
  if (val.size == void 0) {
×
NEW
191
    throw new BoxSdkError({
×
192
      message: 'Expecting "size" of type "ArchiveV2025R0Input" to be defined',
193
    });
194
  }
NEW
195
  if (!sdIsNumber(val.size)) {
×
NEW
196
    throw new BoxSdkError({
×
197
      message: 'Expecting number for "size" of type "ArchiveV2025R0Input"',
198
    });
199
  }
NEW
200
  const size: number = val.size;
×
NEW
201
  return {
×
202
    id: id,
203
    type: type,
204
    name: name,
205
    size: size,
206
  } satisfies ArchiveV2025R0Input;
207
}
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