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

box / box-typescript-sdk-gen / 12870156465

20 Jan 2025 02:28PM UTC coverage: 42.419%. First build
12870156465

push

github

web-flow
feat: Use extensible enums (box/box-codegen#639) (#487)

3990 of 15999 branches covered (24.94%)

Branch coverage included in aggregate %.

0 of 408 new or added lines in 104 files covered. (0.0%)

14249 of 26998 relevant lines covered (52.78%)

93.02 hits per line

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

15.91
/src/schemas/completionRuleVariable.generated.ts
1
import { BoxSdkError } from '../box/errors.js';
144✔
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';
6
import { sdIsString } from '../serialization/json.js';
144✔
7
import { sdIsList } from '../serialization/json.js';
8
import { sdIsMap } from '../serialization/json.js';
144✔
9
export type CompletionRuleVariableTypeField = 'variable';
10
export type CompletionRuleVariableVariableTypeField =
11
  | 'task_completion_rule'
12
  | string;
13
export type CompletionRuleVariableVariableValueField =
14
  | 'all_assignees'
15
  | 'any_assignees'
16
  | string;
17
export class CompletionRuleVariable {
144✔
18
  /**
19
   * Completion
20
   * Rule object type.
21
   *  */
22
  readonly type: CompletionRuleVariableTypeField =
×
23
    'variable' as CompletionRuleVariableTypeField;
24
  /**
25
   * Variable type
26
   * for the Completion
27
   * Rule object.
28
   *  */
29
  readonly variableType: CompletionRuleVariableVariableTypeField =
×
30
    'task_completion_rule' as CompletionRuleVariableVariableTypeField;
31
  /**
32
   * Variable
33
   * values for a completion
34
   * rule.
35
   *  */
36
  readonly variableValue!: CompletionRuleVariableVariableValueField;
37
  readonly rawData?: SerializedData;
38
  constructor(
39
    fields: Omit<CompletionRuleVariable, 'type' | 'variableType'> &
40
      Partial<Pick<CompletionRuleVariable, 'type' | 'variableType'>>,
41
  ) {
42
    if (fields.type !== undefined) {
×
43
      this.type = fields.type;
×
44
    }
45
    if (fields.variableType !== undefined) {
×
46
      this.variableType = fields.variableType;
×
47
    }
48
    if (fields.variableValue !== undefined) {
×
49
      this.variableValue = fields.variableValue;
×
50
    }
51
    if (fields.rawData !== undefined) {
×
52
      this.rawData = fields.rawData;
×
53
    }
54
  }
55
}
56
export interface CompletionRuleVariableInput {
57
  /**
58
   * Completion
59
   * Rule object type.
60
   *  */
61
  readonly type?: CompletionRuleVariableTypeField;
62
  /**
63
   * Variable type
64
   * for the Completion
65
   * Rule object.
66
   *  */
67
  readonly variableType?: CompletionRuleVariableVariableTypeField;
68
  /**
69
   * Variable
70
   * values for a completion
71
   * rule.
72
   *  */
73
  readonly variableValue: CompletionRuleVariableVariableValueField;
74
  readonly rawData?: SerializedData;
75
}
76
export function serializeCompletionRuleVariableTypeField(
144✔
77
  val: CompletionRuleVariableTypeField,
78
): SerializedData {
79
  return val;
×
80
}
81
export function deserializeCompletionRuleVariableTypeField(
144✔
82
  val: SerializedData,
83
): CompletionRuleVariableTypeField {
84
  if (val == 'variable') {
×
85
    return val;
×
86
  }
87
  throw new BoxSdkError({
×
88
    message: "Can't deserialize CompletionRuleVariableTypeField",
89
  });
90
}
91
export function serializeCompletionRuleVariableVariableTypeField(
144✔
92
  val: CompletionRuleVariableVariableTypeField,
93
): SerializedData {
94
  return val;
×
95
}
96
export function deserializeCompletionRuleVariableVariableTypeField(
144✔
97
  val: SerializedData,
98
): CompletionRuleVariableVariableTypeField {
99
  if (val == 'task_completion_rule') {
×
100
    return val;
×
101
  }
NEW
102
  if (sdIsString(val)) {
×
NEW
103
    return val;
×
104
  }
105
  throw new BoxSdkError({
×
106
    message: "Can't deserialize CompletionRuleVariableVariableTypeField",
107
  });
108
}
109
export function serializeCompletionRuleVariableVariableValueField(
144✔
110
  val: CompletionRuleVariableVariableValueField,
111
): SerializedData {
112
  return val;
×
113
}
114
export function deserializeCompletionRuleVariableVariableValueField(
144✔
115
  val: SerializedData,
116
): CompletionRuleVariableVariableValueField {
117
  if (val == 'all_assignees') {
×
118
    return val;
×
119
  }
120
  if (val == 'any_assignees') {
×
121
    return val;
×
122
  }
NEW
123
  if (sdIsString(val)) {
×
NEW
124
    return val;
×
125
  }
126
  throw new BoxSdkError({
×
127
    message: "Can't deserialize CompletionRuleVariableVariableValueField",
128
  });
129
}
130
export function serializeCompletionRuleVariable(
144✔
131
  val: CompletionRuleVariable,
132
): SerializedData {
133
  return {
×
134
    ['type']: serializeCompletionRuleVariableTypeField(val.type),
135
    ['variable_type']: serializeCompletionRuleVariableVariableTypeField(
136
      val.variableType,
137
    ),
138
    ['variable_value']: serializeCompletionRuleVariableVariableValueField(
139
      val.variableValue,
140
    ),
141
  };
142
}
143
export function deserializeCompletionRuleVariable(
144✔
144
  val: SerializedData,
145
): CompletionRuleVariable {
146
  if (!sdIsMap(val)) {
×
147
    throw new BoxSdkError({
×
148
      message: 'Expecting a map for "CompletionRuleVariable"',
149
    });
150
  }
151
  if (val.type == void 0) {
×
152
    throw new BoxSdkError({
×
153
      message:
154
        'Expecting "type" of type "CompletionRuleVariable" to be defined',
155
    });
156
  }
157
  const type: CompletionRuleVariableTypeField =
158
    deserializeCompletionRuleVariableTypeField(val.type);
×
159
  if (val.variable_type == void 0) {
×
160
    throw new BoxSdkError({
×
161
      message:
162
        'Expecting "variable_type" of type "CompletionRuleVariable" to be defined',
163
    });
164
  }
165
  const variableType: CompletionRuleVariableVariableTypeField =
166
    deserializeCompletionRuleVariableVariableTypeField(val.variable_type);
×
167
  if (val.variable_value == void 0) {
×
168
    throw new BoxSdkError({
×
169
      message:
170
        'Expecting "variable_value" of type "CompletionRuleVariable" to be defined',
171
    });
172
  }
173
  const variableValue: CompletionRuleVariableVariableValueField =
174
    deserializeCompletionRuleVariableVariableValueField(val.variable_value);
×
175
  return {
×
176
    type: type,
177
    variableType: variableType,
178
    variableValue: variableValue,
179
  } satisfies CompletionRuleVariable;
180
}
181
export function serializeCompletionRuleVariableInput(
144✔
182
  val: CompletionRuleVariableInput,
183
): SerializedData {
184
  return {
×
185
    ['type']:
186
      val.type == void 0
×
187
        ? val.type
188
        : serializeCompletionRuleVariableTypeField(val.type),
189
    ['variableType']:
190
      val.variableType == void 0
×
191
        ? val.variableType
192
        : serializeCompletionRuleVariableVariableTypeField(val.variableType),
193
    ['variable_value']: serializeCompletionRuleVariableVariableValueField(
194
      val.variableValue,
195
    ),
196
  };
197
}
198
export function deserializeCompletionRuleVariableInput(
144✔
199
  val: SerializedData,
200
): CompletionRuleVariableInput {
201
  if (!sdIsMap(val)) {
×
202
    throw new BoxSdkError({
×
203
      message: 'Expecting a map for "CompletionRuleVariableInput"',
204
    });
205
  }
206
  const type: undefined | CompletionRuleVariableTypeField =
207
    val.type == void 0
×
208
      ? void 0
209
      : deserializeCompletionRuleVariableTypeField(val.type);
210
  const variableType: undefined | CompletionRuleVariableVariableTypeField =
211
    val.variableType == void 0
×
212
      ? void 0
213
      : deserializeCompletionRuleVariableVariableTypeField(val.variableType);
214
  if (val.variable_value == void 0) {
×
215
    throw new BoxSdkError({
×
216
      message:
217
        'Expecting "variable_value" of type "CompletionRuleVariableInput" to be defined',
218
    });
219
  }
220
  const variableValue: CompletionRuleVariableVariableValueField =
221
    deserializeCompletionRuleVariableVariableValueField(val.variable_value);
×
222
  return {
×
223
    type: type,
224
    variableType: variableType,
225
    variableValue: variableValue,
226
  } satisfies CompletionRuleVariableInput;
227
}
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

© 2026 Coveralls, Inc