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

box / box-typescript-sdk-gen / 11616599821

31 Oct 2024 05:11PM UTC coverage: 41.667% (-0.06%) from 41.724%
11616599821

Pull #393

github

web-flow
Merge 7c00c545e into 6ec417e6f
Pull Request #393: test: Expanding test in search manager (box/box-codegen#593)

4050 of 16840 branches covered (24.05%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

17 existing lines in 5 files now uncovered.

13362 of 24948 relevant lines covered (53.56%)

77.88 hits per line

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

28.47
/src/schemas/searchResultsWithSharedLinks.generated.ts
1
import { serializeSearchResultWithSharedLink } from './searchResultWithSharedLink.generated.js';
140✔
2
import { deserializeSearchResultWithSharedLink } from './searchResultWithSharedLink.generated.js';
140✔
3
import { SearchResultWithSharedLink } from './searchResultWithSharedLink.generated.js';
4
import { BoxSdkError } from '../box/errors.js';
140✔
5
import { SerializedData } from '../serialization/json.js';
6
import { sdIsEmpty } from '../serialization/json.js';
7
import { sdIsBoolean } from '../serialization/json.js';
8
import { sdIsNumber } from '../serialization/json.js';
140✔
9
import { sdIsString } from '../serialization/json.js';
10
import { sdIsList } from '../serialization/json.js';
140✔
11
import { sdIsMap } from '../serialization/json.js';
140✔
12
export type SearchResultsWithSharedLinksTypeField =
13
  'search_results_with_shared_links';
14
export class SearchResultsWithSharedLinks {
140✔
15
  /**
16
   * One greater than the offset of the last entry in the search results.
17
   * The total number of entries in the collection may be less than
18
   * `total_count`. */
19
  readonly totalCount?: number;
20
  /**
21
   * The limit that was used for this search. This will be the same as the
22
   * `limit` query parameter unless that value exceeded the maximum value
23
   * allowed. */
24
  readonly limit?: number;
25
  /**
26
   * The 0-based offset of the first entry in this set. This will be the same
27
   * as the `offset` query parameter used. */
28
  readonly offset?: number;
29
  /**
30
   * Specifies the response as search result items with shared links */
31
  readonly type: SearchResultsWithSharedLinksTypeField =
×
32
    'search_results_with_shared_links' as SearchResultsWithSharedLinksTypeField;
33
  /**
34
   * The search results for the query provided, including the
35
   * additional information about any shared links through
36
   * which the item has been shared with the user. */
37
  readonly entries?: readonly SearchResultWithSharedLink[];
38
  readonly rawData?: SerializedData;
39
  constructor(
40
    fields: Omit<SearchResultsWithSharedLinks, 'type'> &
41
      Partial<Pick<SearchResultsWithSharedLinks, 'type'>>
42
  ) {
43
    if (fields.totalCount) {
×
44
      this.totalCount = fields.totalCount;
×
45
    }
46
    if (fields.limit) {
×
47
      this.limit = fields.limit;
×
48
    }
49
    if (fields.offset) {
×
50
      this.offset = fields.offset;
×
51
    }
52
    if (fields.type) {
×
53
      this.type = fields.type;
×
54
    }
55
    if (fields.entries) {
×
56
      this.entries = fields.entries;
×
57
    }
58
    if (fields.rawData) {
×
59
      this.rawData = fields.rawData;
×
60
    }
61
  }
62
}
63
export interface SearchResultsWithSharedLinksInput {
64
  /**
65
   * One greater than the offset of the last entry in the search results.
66
   * The total number of entries in the collection may be less than
67
   * `total_count`. */
68
  readonly totalCount?: number;
69
  /**
70
   * The limit that was used for this search. This will be the same as the
71
   * `limit` query parameter unless that value exceeded the maximum value
72
   * allowed. */
73
  readonly limit?: number;
74
  /**
75
   * The 0-based offset of the first entry in this set. This will be the same
76
   * as the `offset` query parameter used. */
77
  readonly offset?: number;
78
  /**
79
   * Specifies the response as search result items with shared links */
80
  readonly type?: SearchResultsWithSharedLinksTypeField;
81
  /**
82
   * The search results for the query provided, including the
83
   * additional information about any shared links through
84
   * which the item has been shared with the user. */
85
  readonly entries?: readonly SearchResultWithSharedLink[];
86
  readonly rawData?: SerializedData;
87
}
88
export function serializeSearchResultsWithSharedLinksTypeField(
140✔
89
  val: SearchResultsWithSharedLinksTypeField
90
): SerializedData {
91
  return val;
×
92
}
93
export function deserializeSearchResultsWithSharedLinksTypeField(
140✔
94
  val: SerializedData
95
): SearchResultsWithSharedLinksTypeField {
96
  if (val == 'search_results_with_shared_links') {
2✔
97
    return val;
2✔
98
  }
99
  throw new BoxSdkError({
×
100
    message: "Can't deserialize SearchResultsWithSharedLinksTypeField",
101
  });
102
}
103
export function serializeSearchResultsWithSharedLinks(
140✔
104
  val: SearchResultsWithSharedLinks
105
): SerializedData {
106
  return {
×
107
    ['total_count']: val.totalCount == void 0 ? void 0 : val.totalCount,
×
108
    ['limit']: val.limit == void 0 ? void 0 : val.limit,
×
109
    ['offset']: val.offset == void 0 ? void 0 : val.offset,
×
110
    ['type']: serializeSearchResultsWithSharedLinksTypeField(val.type),
111
    ['entries']:
112
      val.entries == void 0
×
113
        ? void 0
114
        : (val.entries.map(function (
115
            item: SearchResultWithSharedLink
116
          ): SerializedData {
117
            return serializeSearchResultWithSharedLink(item);
×
118
          }) as readonly any[]),
119
  };
120
}
121
export function deserializeSearchResultsWithSharedLinks(
140✔
122
  val: SerializedData
123
): SearchResultsWithSharedLinks {
124
  if (!sdIsMap(val)) {
2!
125
    throw new BoxSdkError({
×
126
      message: 'Expecting a map for "SearchResultsWithSharedLinks"',
127
    });
128
  }
129
  if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) {
2!
130
    throw new BoxSdkError({
×
131
      message:
132
        'Expecting number for "total_count" of type "SearchResultsWithSharedLinks"',
133
    });
134
  }
135
  const totalCount: undefined | number =
136
    val.total_count == void 0 ? void 0 : val.total_count;
2!
137
  if (!(val.limit == void 0) && !sdIsNumber(val.limit)) {
2!
138
    throw new BoxSdkError({
×
139
      message:
140
        'Expecting number for "limit" of type "SearchResultsWithSharedLinks"',
141
    });
142
  }
143
  const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit;
2!
144
  if (!(val.offset == void 0) && !sdIsNumber(val.offset)) {
2!
145
    throw new BoxSdkError({
×
146
      message:
147
        'Expecting number for "offset" of type "SearchResultsWithSharedLinks"',
148
    });
149
  }
150
  const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset;
2!
151
  if (val.type == void 0) {
2!
152
    throw new BoxSdkError({
×
153
      message:
154
        'Expecting "type" of type "SearchResultsWithSharedLinks" to be defined',
155
    });
156
  }
157
  const type: SearchResultsWithSharedLinksTypeField =
158
    deserializeSearchResultsWithSharedLinksTypeField(val.type);
2✔
159
  if (!(val.entries == void 0) && !sdIsList(val.entries)) {
2!
160
    throw new BoxSdkError({
×
161
      message:
162
        'Expecting array for "entries" of type "SearchResultsWithSharedLinks"',
163
    });
164
  }
165
  const entries: undefined | readonly SearchResultWithSharedLink[] =
166
    val.entries == void 0
2!
167
      ? void 0
168
      : sdIsList(val.entries)
2!
169
      ? (val.entries.map(function (
170
          itm: SerializedData
171
        ): SearchResultWithSharedLink {
UNCOV
172
          return deserializeSearchResultWithSharedLink(itm);
×
173
        }) as readonly any[])
174
      : [];
175
  return {
2✔
176
    totalCount: totalCount,
177
    limit: limit,
178
    offset: offset,
179
    type: type,
180
    entries: entries,
181
  } satisfies SearchResultsWithSharedLinks;
182
}
183
export function serializeSearchResultsWithSharedLinksInput(
140✔
184
  val: SearchResultsWithSharedLinksInput
185
): SerializedData {
186
  return {
×
187
    ['total_count']: val.totalCount == void 0 ? void 0 : val.totalCount,
×
188
    ['limit']: val.limit == void 0 ? void 0 : val.limit,
×
189
    ['offset']: val.offset == void 0 ? void 0 : val.offset,
×
190
    ['type']:
191
      val.type == void 0
×
192
        ? void 0
193
        : serializeSearchResultsWithSharedLinksTypeField(val.type),
194
    ['entries']:
195
      val.entries == void 0
×
196
        ? void 0
197
        : (val.entries.map(function (
198
            item: SearchResultWithSharedLink
199
          ): SerializedData {
200
            return serializeSearchResultWithSharedLink(item);
×
201
          }) as readonly any[]),
202
  };
203
}
204
export function deserializeSearchResultsWithSharedLinksInput(
140✔
205
  val: SerializedData
206
): SearchResultsWithSharedLinksInput {
207
  if (!sdIsMap(val)) {
×
208
    throw new BoxSdkError({
×
209
      message: 'Expecting a map for "SearchResultsWithSharedLinksInput"',
210
    });
211
  }
212
  if (!(val.total_count == void 0) && !sdIsNumber(val.total_count)) {
×
213
    throw new BoxSdkError({
×
214
      message:
215
        'Expecting number for "total_count" of type "SearchResultsWithSharedLinksInput"',
216
    });
217
  }
218
  const totalCount: undefined | number =
219
    val.total_count == void 0 ? void 0 : val.total_count;
×
220
  if (!(val.limit == void 0) && !sdIsNumber(val.limit)) {
×
221
    throw new BoxSdkError({
×
222
      message:
223
        'Expecting number for "limit" of type "SearchResultsWithSharedLinksInput"',
224
    });
225
  }
226
  const limit: undefined | number = val.limit == void 0 ? void 0 : val.limit;
×
227
  if (!(val.offset == void 0) && !sdIsNumber(val.offset)) {
×
228
    throw new BoxSdkError({
×
229
      message:
230
        'Expecting number for "offset" of type "SearchResultsWithSharedLinksInput"',
231
    });
232
  }
233
  const offset: undefined | number = val.offset == void 0 ? void 0 : val.offset;
×
234
  const type: undefined | SearchResultsWithSharedLinksTypeField =
235
    val.type == void 0
×
236
      ? void 0
237
      : deserializeSearchResultsWithSharedLinksTypeField(val.type);
238
  if (!(val.entries == void 0) && !sdIsList(val.entries)) {
×
239
    throw new BoxSdkError({
×
240
      message:
241
        'Expecting array for "entries" of type "SearchResultsWithSharedLinksInput"',
242
    });
243
  }
244
  const entries: undefined | readonly SearchResultWithSharedLink[] =
245
    val.entries == void 0
×
246
      ? void 0
247
      : sdIsList(val.entries)
×
248
      ? (val.entries.map(function (
249
          itm: SerializedData
250
        ): SearchResultWithSharedLink {
251
          return deserializeSearchResultWithSharedLink(itm);
×
252
        }) as readonly any[])
253
      : [];
254
  return {
×
255
    totalCount: totalCount,
256
    limit: limit,
257
    offset: offset,
258
    type: type,
259
    entries: entries,
260
  } satisfies SearchResultsWithSharedLinksInput;
261
}
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