Skip to content

Commit 78d193d

Browse files
feat(api): api update (#37)
1 parent 3ec3190 commit 78d193d

5 files changed

Lines changed: 110 additions & 14 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-6e9b1263cf6d720224f647537949aef5bbf794efd14e08055bed7d31b523b0a8.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-f8b7e23cec932020dc713b51d2b154f2365d151e4c0be0a785195f5cd3c78134.yml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ You can use the `maxRetries` option to configure or disable this:
138138
// Configure the default for all requests:
139139
const client = new Grid({
140140
maxRetries: 0, // default is 2
141+
apiKey: 'My API Key',
141142
});
142143

143144
// Or, configure per-request:
@@ -155,6 +156,7 @@ Requests time out after one minute by default. You can configure this with a `ti
155156
// Configure the default for all requests:
156157
const client = new Grid({
157158
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
159+
apiKey: 'My API Key',
158160
});
159161

160162
// Override per-request:

src/client.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ export class Grid {
186186
return;
187187
}
188188

189-
protected authHeaders(opts: FinalRequestOptions): Headers | undefined {
190-
return new Headers({ Authorization: `Bearer ${this.apiKey}` });
191-
}
192-
193189
/**
194190
* Basic re-implementation of `qs.stringify` for primitive types.
195191
*/
@@ -640,7 +636,6 @@ export class Grid {
640636
...getPlatformHeaders(),
641637
'X-Client-Name': 'api-sdk',
642638
},
643-
this.authHeaders(options),
644639
this._options.defaultHeaders,
645640
bodyHeaders,
646641
options.headers,

src/resources/workbooks.ts

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ export namespace WorkbookQueryResponse {
168168
* state and any changes made are cleared after each request.
169169
*/
170170
export interface Apply {
171+
/**
172+
* A1-style reference for the cell that was updated
173+
*/
171174
target: string;
172175

176+
/**
177+
* New value of the cell
178+
*/
173179
value: number | string | boolean | null;
174180

175181
/**
@@ -185,6 +191,9 @@ export namespace WorkbookQueryResponse {
185191
export interface DataTable {
186192
data: Array<Array<DataTable.ValueCell | DataTable.ErrorCell | DataTable.EmptyCell>>;
187193

194+
/**
195+
* A1-style reference for the cell or cells that were updated
196+
*/
188197
source: string;
189198

190199
type: 'dataTable';
@@ -197,20 +206,28 @@ export namespace WorkbookQueryResponse {
197206
*/
198207
export interface ValueCell {
199208
/**
200-
* Specifies the type of a workbook cell. Possible values include `b` (boolean),
201-
* `n` (number), `d` (date), and `s` (string).
209+
* Data type of the cell value (e.g. boolean, number, text)
202210
*/
203211
t: 'b' | 'n' | 'd' | 's';
204212

213+
/**
214+
* Underlying cell value
215+
*/
205216
v: number | string | boolean | null;
206217

207218
/**
208219
* Relative A1-based cell reference
209220
*/
210221
r?: string | null;
211222

223+
/**
224+
* Formatted cell value
225+
*/
212226
w?: string | null;
213227

228+
/**
229+
* Number format associated with the cell
230+
*/
214231
z?: string | null;
215232
}
216233

@@ -220,8 +237,14 @@ export namespace WorkbookQueryResponse {
220237
* provides details for identifying and understanding errors in workbook data.
221238
*/
222239
export interface ErrorCell {
240+
/**
241+
* Data type of the cell value (always 'e' for 'error')
242+
*/
223243
t: 'e';
224244

245+
/**
246+
* Underlying cell value
247+
*/
225248
v: string;
226249

227250
/**
@@ -239,6 +262,9 @@ export namespace WorkbookQueryResponse {
239262
* Cells that have no content but hold metadata like comments.
240263
*/
241264
export interface EmptyCell {
265+
/**
266+
* Data type of the cell value (always 'z' for 'empty cell')
267+
*/
242268
t: 'z';
243269
}
244270
}
@@ -250,6 +276,9 @@ export namespace WorkbookQueryResponse {
250276
export interface DataList {
251277
data: Array<DataList.ValueCell | DataList.ErrorCell | DataList.EmptyCell>;
252278

279+
/**
280+
* A1-style reference for the cell or cells that were updated
281+
*/
253282
source: string;
254283

255284
type: 'dataList';
@@ -262,20 +291,28 @@ export namespace WorkbookQueryResponse {
262291
*/
263292
export interface ValueCell {
264293
/**
265-
* Specifies the type of a workbook cell. Possible values include `b` (boolean),
266-
* `n` (number), `d` (date), and `s` (string).
294+
* Data type of the cell value (e.g. boolean, number, text)
267295
*/
268296
t: 'b' | 'n' | 'd' | 's';
269297

298+
/**
299+
* Underlying cell value
300+
*/
270301
v: number | string | boolean | null;
271302

272303
/**
273304
* Relative A1-based cell reference
274305
*/
275306
r?: string | null;
276307

308+
/**
309+
* Formatted cell value
310+
*/
277311
w?: string | null;
278312

313+
/**
314+
* Number format associated with the cell
315+
*/
279316
z?: string | null;
280317
}
281318

@@ -285,8 +322,14 @@ export namespace WorkbookQueryResponse {
285322
* provides details for identifying and understanding errors in workbook data.
286323
*/
287324
export interface ErrorCell {
325+
/**
326+
* Data type of the cell value (always 'e' for 'error')
327+
*/
288328
t: 'e';
289329

330+
/**
331+
* Underlying cell value
332+
*/
290333
v: string;
291334

292335
/**
@@ -304,6 +347,9 @@ export namespace WorkbookQueryResponse {
304347
* Cells that have no content but hold metadata like comments.
305348
*/
306349
export interface EmptyCell {
350+
/**
351+
* Data type of the cell value (always 'z' for 'empty cell')
352+
*/
307353
t: 'z';
308354
}
309355
}
@@ -319,6 +365,9 @@ export namespace WorkbookQueryResponse {
319365
*/
320366
data: DataCell.ValueCell | DataCell.ErrorCell | DataCell.EmptyCell;
321367

368+
/**
369+
* A1-style reference for the cell or cells that were updated
370+
*/
322371
source: string;
323372

324373
type: 'cell';
@@ -331,20 +380,28 @@ export namespace WorkbookQueryResponse {
331380
*/
332381
export interface ValueCell {
333382
/**
334-
* Specifies the type of a workbook cell. Possible values include `b` (boolean),
335-
* `n` (number), `d` (date), and `s` (string).
383+
* Data type of the cell value (e.g. boolean, number, text)
336384
*/
337385
t: 'b' | 'n' | 'd' | 's';
338386

387+
/**
388+
* Underlying cell value
389+
*/
339390
v: number | string | boolean | null;
340391

341392
/**
342393
* Relative A1-based cell reference
343394
*/
344395
r?: string | null;
345396

397+
/**
398+
* Formatted cell value
399+
*/
346400
w?: string | null;
347401

402+
/**
403+
* Number format associated with the cell
404+
*/
348405
z?: string | null;
349406
}
350407

@@ -354,8 +411,14 @@ export namespace WorkbookQueryResponse {
354411
* provides details for identifying and understanding errors in workbook data.
355412
*/
356413
export interface ErrorCell {
414+
/**
415+
* Data type of the cell value (always 'e' for 'error')
416+
*/
357417
t: 'e';
358418

419+
/**
420+
* Underlying cell value
421+
*/
359422
v: string;
360423

361424
/**
@@ -373,6 +436,9 @@ export namespace WorkbookQueryResponse {
373436
* Cells that have no content but hold metadata like comments.
374437
*/
375438
export interface EmptyCell {
439+
/**
440+
* Data type of the cell value (always 'z' for 'empty cell')
441+
*/
376442
t: 'z';
377443
}
378444
}
@@ -384,6 +450,9 @@ export namespace WorkbookQueryResponse {
384450
export interface ValueTable {
385451
data: Array<Array<number | string | boolean | null>>;
386452

453+
/**
454+
* A1-style reference for the cell or cells that were updated
455+
*/
387456
source: string;
388457

389458
type: 'valueTable';
@@ -396,6 +465,9 @@ export namespace WorkbookQueryResponse {
396465
export interface ValueList {
397466
data: Array<number | string | boolean | null>;
398467

468+
/**
469+
* A1-style reference for the cell or cells that were updated
470+
*/
399471
source: string;
400472

401473
type: 'valueList';
@@ -408,6 +480,9 @@ export namespace WorkbookQueryResponse {
408480
export interface Value {
409481
data: number | string | boolean | null;
410482

483+
/**
484+
* A1-style reference for the cell or cells that were updated
485+
*/
411486
source: string;
412487

413488
type: 'value';
@@ -420,6 +495,9 @@ export namespace WorkbookQueryResponse {
420495
export interface FormattedValueTable {
421496
data: Array<Array<string>>;
422497

498+
/**
499+
* A1-style reference for the cell or cells that were updated
500+
*/
423501
source: string;
424502

425503
type: 'formattedValueTable';
@@ -432,6 +510,9 @@ export namespace WorkbookQueryResponse {
432510
export interface FormattedValueList {
433511
data: Array<string>;
434512

513+
/**
514+
* A1-style reference for the cell or cells that were updated
515+
*/
435516
source: string;
436517

437518
type: 'formattedValueList';
@@ -444,6 +525,9 @@ export namespace WorkbookQueryResponse {
444525
export interface FormattedValue {
445526
data: string;
446527

528+
/**
529+
* A1-style reference for the cell or cells that were updated
530+
*/
447531
source: string;
448532

449533
type: 'formattedValue';
@@ -471,7 +555,7 @@ export namespace WorkbookQueryResponse {
471555
/**
472556
* The result of the formula
473557
*/
474-
solution?: number | string | boolean | null;
558+
solution?: number;
475559
}
476560
}
477561

@@ -682,6 +766,11 @@ export namespace WorkbookRenderChartParams {
682766
* Type of chart to render
683767
*/
684768
type?: 'line' | 'column';
769+
770+
/**
771+
* How to label individual data values on the chart
772+
*/
773+
values?: 'none' | 'selective' | 'all';
685774
}
686775

687776
/**
@@ -703,6 +792,9 @@ export namespace WorkbookRenderChartParams {
703792
}
704793

705794
export interface WorkbookUploadParams {
795+
/**
796+
* Excel (.xlsx) file
797+
*/
706798
file: Uploadable;
707799
}
708800

tests/api-resources/workbooks.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ describe('resource workbooks', () => {
5353
// skipped: tests are disabled for the time being
5454
test.skip('renderChart: required and optional params', async () => {
5555
const response = await client.workbooks.renderChart('id', {
56-
chart: { data: '=C2:C142', format: 'png', labels: '=B2:B142', title: '=A1', type: 'line' },
56+
chart: {
57+
data: '=C2:C142',
58+
format: 'png',
59+
labels: '=B2:B142',
60+
title: '=A1',
61+
type: 'line',
62+
values: 'none',
63+
},
5764
apply: [{ target: 'A2', value: 1234 }],
5865
});
5966
});

0 commit comments

Comments
 (0)