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

box / box-typescript-sdk-gen / 13155027420

05 Feb 2025 10:12AM UTC coverage: 42.622% (-0.006%) from 42.628%
13155027420

Pull #509

github

web-flow
Merge 697e537ab into 026c9372e
Pull Request #509: test: Fix flaky test in search module (box/box-codegen#659)

4052 of 16047 branches covered (25.25%)

Branch coverage included in aggregate %.

13 of 35 new or added lines in 3 files covered. (37.14%)

5 existing lines in 2 files now uncovered.

14323 of 27065 relevant lines covered (52.92%)

92.41 hits per line

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

24.68
/src/schemas/aiItemBase.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 AiItemBaseTypeField = 'file';
10
export class AiItemBase {
144✔
11
  /**
12
   * The ID of the file. */
13
  readonly id!: string;
14
  /**
15
   * The type of the item. Currently the value can be `file` only. */
16
  readonly type: AiItemBaseTypeField = 'file' as AiItemBaseTypeField;
6✔
17
  /**
18
   * The content of the item, often the text representation. */
19
  readonly content?: string;
20
  readonly rawData?: SerializedData;
21
  constructor(
22
    fields: Omit<AiItemBase, 'type'> & Partial<Pick<AiItemBase, 'type'>>,
23
  ) {
24
    if (fields.id !== undefined) {
6✔
25
      this.id = fields.id;
6✔
26
    }
27
    if (fields.type !== undefined) {
6!
UNCOV
28
      this.type = fields.type;
×
29
    }
30
    if (fields.content !== undefined) {
6!
UNCOV
31
      this.content = fields.content;
×
32
    }
33
    if (fields.rawData !== undefined) {
6!
34
      this.rawData = fields.rawData;
×
35
    }
36
  }
37
}
38
export interface AiItemBaseInput {
39
  /**
40
   * The ID of the file. */
41
  readonly id: string;
42
  /**
43
   * The type of the item. Currently the value can be `file` only. */
44
  readonly type?: AiItemBaseTypeField;
45
  /**
46
   * The content of the item, often the text representation. */
47
  readonly content?: string;
48
  readonly rawData?: SerializedData;
49
}
50
export function serializeAiItemBaseTypeField(
144✔
51
  val: AiItemBaseTypeField,
52
): SerializedData {
53
  return val;
6✔
54
}
55
export function deserializeAiItemBaseTypeField(
144✔
56
  val: SerializedData,
57
): AiItemBaseTypeField {
58
  if (val == 'file') {
×
59
    return val;
×
60
  }
61
  throw new BoxSdkError({ message: "Can't deserialize AiItemBaseTypeField" });
×
62
}
63
export function serializeAiItemBase(val: AiItemBase): SerializedData {
144✔
64
  return {
6✔
65
    ['id']: val.id,
66
    ['type']: serializeAiItemBaseTypeField(val.type),
67
    ['content']: val.content,
68
  };
69
}
70
export function deserializeAiItemBase(val: SerializedData): AiItemBase {
144✔
71
  if (!sdIsMap(val)) {
×
72
    throw new BoxSdkError({ message: 'Expecting a map for "AiItemBase"' });
×
73
  }
74
  if (val.id == void 0) {
×
75
    throw new BoxSdkError({
×
76
      message: 'Expecting "id" of type "AiItemBase" to be defined',
77
    });
78
  }
79
  if (!sdIsString(val.id)) {
×
80
    throw new BoxSdkError({
×
81
      message: 'Expecting string for "id" of type "AiItemBase"',
82
    });
83
  }
84
  const id: string = val.id;
×
85
  if (val.type == void 0) {
×
86
    throw new BoxSdkError({
×
87
      message: 'Expecting "type" of type "AiItemBase" to be defined',
88
    });
89
  }
90
  const type: AiItemBaseTypeField = deserializeAiItemBaseTypeField(val.type);
×
91
  if (!(val.content == void 0) && !sdIsString(val.content)) {
×
92
    throw new BoxSdkError({
×
93
      message: 'Expecting string for "content" of type "AiItemBase"',
94
    });
95
  }
96
  const content: undefined | string =
97
    val.content == void 0 ? void 0 : val.content;
×
98
  return { id: id, type: type, content: content } satisfies AiItemBase;
×
99
}
100
export function serializeAiItemBaseInput(val: AiItemBaseInput): SerializedData {
144✔
101
  return {
×
102
    ['id']: val.id,
103
    ['type']:
104
      val.type == void 0 ? val.type : serializeAiItemBaseTypeField(val.type),
×
105
    ['content']: val.content,
106
  };
107
}
108
export function deserializeAiItemBaseInput(
144✔
109
  val: SerializedData,
110
): AiItemBaseInput {
111
  if (!sdIsMap(val)) {
×
112
    throw new BoxSdkError({ message: 'Expecting a map for "AiItemBaseInput"' });
×
113
  }
114
  if (val.id == void 0) {
×
115
    throw new BoxSdkError({
×
116
      message: 'Expecting "id" of type "AiItemBaseInput" to be defined',
117
    });
118
  }
119
  if (!sdIsString(val.id)) {
×
120
    throw new BoxSdkError({
×
121
      message: 'Expecting string for "id" of type "AiItemBaseInput"',
122
    });
123
  }
124
  const id: string = val.id;
×
125
  const type: undefined | AiItemBaseTypeField =
126
    val.type == void 0 ? void 0 : deserializeAiItemBaseTypeField(val.type);
×
127
  if (!(val.content == void 0) && !sdIsString(val.content)) {
×
128
    throw new BoxSdkError({
×
129
      message: 'Expecting string for "content" of type "AiItemBaseInput"',
130
    });
131
  }
132
  const content: undefined | string =
133
    val.content == void 0 ? void 0 : val.content;
×
134
  return { id: id, type: type, content: content } satisfies AiItemBaseInput;
×
135
}
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