Skip to content

Commit c44e88a

Browse files
release: 1.0.1 (#52)
* fix(stainless): configure calc and values endpoints The two new endpoints were missing from the Stainless config, and so hadn't made their way into the public realm. * release: 1.0.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 0feee0c commit c44e88a

10 files changed

Lines changed: 179 additions & 5 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.0.0"
2+
".": "1.0.1"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 5
1+
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-8f089189d87fe061afe62a54cdce6752e1b9597de7fdaa4154412ce2115c7ed4.yml
33
openapi_spec_hash: 2bff1feefeadafaa3c714059c1ebf682
4-
config_hash: 3e61a9566953ce5dbd4bcea7ceb568a3
4+
config_hash: 8d14e76153d6c3003008e70a59928aa8

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.0.1 (2025-05-15)
4+
5+
Full Changelog: [v1.0.0...v1.0.1](https://github.com/GRID-is/api-sdk-ts/compare/v1.0.0...v1.0.1)
6+
7+
### Bug Fixes
8+
9+
* **stainless:** configure calc and values endpoints ([b1e8f44](https://github.com/GRID-is/api-sdk-ts/commit/b1e8f44ccf9d4eb6dcd97fd7726085737adc77eb))
10+
311
## 1.0.0 (2025-05-13)
412

513
Full Changelog: [v1.0.0-rc.9...v1.0.0](https://github.com/GRID-is/api-sdk-ts/compare/v1.0.0-rc.9...v1.0.0)

api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
Types:
44

55
- <code><a href="./src/resources/workbooks.ts">WorkbookListResponse</a></code>
6+
- <code><a href="./src/resources/workbooks.ts">WorkbookCalcResponse</a></code>
67
- <code><a href="./src/resources/workbooks.ts">WorkbookQueryResponse</a></code>
78
- <code><a href="./src/resources/workbooks.ts">WorkbookUploadResponse</a></code>
9+
- <code><a href="./src/resources/workbooks.ts">WorkbookValuesResponse</a></code>
810

911
Methods:
1012

1113
- <code title="get /v1/workbooks">client.workbooks.<a href="./src/resources/workbooks.ts">list</a>({ ...params }) -> WorkbookListResponsesCursorPagination</code>
14+
- <code title="post /v1/workbooks/{id}/calc">client.workbooks.<a href="./src/resources/workbooks.ts">calc</a>(id, { ...params }) -> WorkbookCalcResponse</code>
1215
- <code title="post /v1/workbooks/{id}/export">client.workbooks.<a href="./src/resources/workbooks.ts">export</a>(id, { ...params }) -> Response</code>
1316
- <code title="post /v1/workbooks/{id}/query">client.workbooks.<a href="./src/resources/workbooks.ts">query</a>(id, { ...params }) -> WorkbookQueryResponse</code>
1417
- <code title="post /v1/workbooks/{id}/chart">client.workbooks.<a href="./src/resources/workbooks.ts">renderChart</a>(id, { ...params }) -> Response</code>
1518
- <code title="post /v1/workbooks">client.workbooks.<a href="./src/resources/workbooks.ts">upload</a>({ ...params }) -> WorkbookUploadResponse</code>
19+
- <code title="post /v1/workbooks/{id}/values">client.workbooks.<a href="./src/resources/workbooks.ts">values</a>(id, { ...params }) -> WorkbookValuesResponse</code>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grid-is/api",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "The official TypeScript library for the Grid API",
55
"author": "Grid <info@grid.is>",
66
"types": "dist/index.d.ts",

src/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { type Fetch } from './internal/builtin-types';
2323
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
2424
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
2525
import {
26+
WorkbookCalcParams,
27+
WorkbookCalcResponse,
2628
WorkbookExportParams,
2729
WorkbookListParams,
2830
WorkbookListResponse,
@@ -32,6 +34,8 @@ import {
3234
WorkbookRenderChartParams,
3335
WorkbookUploadParams,
3436
WorkbookUploadResponse,
37+
WorkbookValuesParams,
38+
WorkbookValuesResponse,
3539
Workbooks,
3640
} from './resources/workbooks';
3741
import { readEnv } from './internal/utils/env';
@@ -739,13 +743,17 @@ export declare namespace Grid {
739743
export {
740744
Workbooks as Workbooks,
741745
type WorkbookListResponse as WorkbookListResponse,
746+
type WorkbookCalcResponse as WorkbookCalcResponse,
742747
type WorkbookQueryResponse as WorkbookQueryResponse,
743748
type WorkbookUploadResponse as WorkbookUploadResponse,
749+
type WorkbookValuesResponse as WorkbookValuesResponse,
744750
type WorkbookListResponsesCursorPagination as WorkbookListResponsesCursorPagination,
745751
type WorkbookListParams as WorkbookListParams,
752+
type WorkbookCalcParams as WorkbookCalcParams,
746753
type WorkbookExportParams as WorkbookExportParams,
747754
type WorkbookQueryParams as WorkbookQueryParams,
748755
type WorkbookRenderChartParams as WorkbookRenderChartParams,
749756
type WorkbookUploadParams as WorkbookUploadParams,
757+
type WorkbookValuesParams as WorkbookValuesParams,
750758
};
751759
}

src/resources/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
export {
44
Workbooks,
55
type WorkbookListResponse,
6+
type WorkbookCalcResponse,
67
type WorkbookQueryResponse,
78
type WorkbookUploadResponse,
9+
type WorkbookValuesResponse,
810
type WorkbookListParams,
11+
type WorkbookCalcParams,
912
type WorkbookExportParams,
1013
type WorkbookQueryParams,
1114
type WorkbookRenderChartParams,
1215
type WorkbookUploadParams,
16+
type WorkbookValuesParams,
1317
type WorkbookListResponsesCursorPagination,
1418
} from './workbooks';

src/resources/workbooks.ts

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ export class Workbooks extends APIResource {
3333
});
3434
}
3535

36+
/**
37+
* Run calculations in a workbook and retrieve cell objects.
38+
*
39+
* @example
40+
* ```ts
41+
* const response = await client.workbooks.calc('id', {
42+
* read: ['A1'],
43+
* });
44+
* ```
45+
*/
46+
calc(id: string, body: WorkbookCalcParams, options?: RequestOptions): APIPromise<WorkbookCalcResponse> {
47+
return this._client.post(path`/v1/workbooks/${id}/calc`, { body, ...options });
48+
}
49+
3650
/**
3751
* Export a workbook as an .xlsx file. Cells can be updated before the workbook is
3852
* exported.
@@ -115,6 +129,24 @@ export class Workbooks extends APIResource {
115129
multipartFormRequestOptions({ body, ...options }, this._client),
116130
);
117131
}
132+
133+
/**
134+
* Run calculations in a workbook and retrieve cell values.
135+
*
136+
* @example
137+
* ```ts
138+
* const response = await client.workbooks.values('id', {
139+
* read: ['A1'],
140+
* });
141+
* ```
142+
*/
143+
values(
144+
id: string,
145+
body: WorkbookValuesParams,
146+
options?: RequestOptions,
147+
): APIPromise<WorkbookValuesResponse> {
148+
return this._client.post(path`/v1/workbooks/${id}/values`, { body, ...options });
149+
}
118150
}
119151

120152
export type WorkbookListResponsesCursorPagination = CursorPagination<WorkbookListResponse>;
@@ -168,6 +200,66 @@ export interface WorkbookListResponse {
168200
latest_ready_version?: number | null;
169201
}
170202

203+
/**
204+
* Response type returned by the for /calc query endpoint.
205+
*/
206+
export type WorkbookCalcResponse = Record<
207+
string,
208+
WorkbookCalcResponse.ReadValue | Array<WorkbookCalcResponse.UnionMember1>
209+
>;
210+
211+
export namespace WorkbookCalcResponse {
212+
export interface ReadValue {
213+
/**
214+
* Formatted cell value
215+
*/
216+
formatted: string;
217+
218+
/**
219+
* Cell position in the spreadsheet, using 0-indexed x/y coordinates. Origin [0, 0]
220+
* is at the top-left
221+
*/
222+
offset: Array<unknown>;
223+
224+
/**
225+
* Type of the cell value
226+
*/
227+
type: 'blank' | 'boolean' | 'number' | 'string' | 'date' | 'error';
228+
229+
/**
230+
* Cell value
231+
*/
232+
value: number | string | boolean | null;
233+
234+
error?: string | null;
235+
}
236+
237+
export interface UnionMember1 {
238+
/**
239+
* Formatted cell value
240+
*/
241+
formatted: string;
242+
243+
/**
244+
* Cell position in the spreadsheet, using 0-indexed x/y coordinates. Origin [0, 0]
245+
* is at the top-left
246+
*/
247+
offset: Array<unknown>;
248+
249+
/**
250+
* Type of the cell value
251+
*/
252+
type: 'blank' | 'boolean' | 'number' | 'string' | 'date' | 'error';
253+
254+
/**
255+
* Cell value
256+
*/
257+
value: number | string | boolean | null;
258+
259+
error?: string | null;
260+
}
261+
}
262+
171263
/**
172264
* Contains the results of a workbook query, including `read` (queried cell data)
173265
* and `apply` (details of temporary changes applied). Note that the API has no
@@ -339,8 +431,22 @@ export interface WorkbookUploadResponse {
339431
id: string;
340432
}
341433

434+
/**
435+
* Response type returned by the for /values query endpoint.
436+
*/
437+
export type WorkbookValuesResponse = Record<
438+
string,
439+
number | string | boolean | Array<number | string | boolean | null> | null
440+
>;
441+
342442
export interface WorkbookListParams extends CursorPaginationParams {}
343443

444+
export interface WorkbookCalcParams {
445+
read: Array<string>;
446+
447+
apply?: Record<string, number | string | boolean | null> | null;
448+
}
449+
344450
export interface WorkbookExportParams {
345451
/**
346452
* Cells to update before exporting
@@ -833,16 +939,26 @@ export interface WorkbookUploadParams {
833939
file: Uploadable;
834940
}
835941

942+
export interface WorkbookValuesParams {
943+
read: Array<string>;
944+
945+
apply?: Record<string, number | string | boolean | null> | null;
946+
}
947+
836948
export declare namespace Workbooks {
837949
export {
838950
type WorkbookListResponse as WorkbookListResponse,
951+
type WorkbookCalcResponse as WorkbookCalcResponse,
839952
type WorkbookQueryResponse as WorkbookQueryResponse,
840953
type WorkbookUploadResponse as WorkbookUploadResponse,
954+
type WorkbookValuesResponse as WorkbookValuesResponse,
841955
type WorkbookListResponsesCursorPagination as WorkbookListResponsesCursorPagination,
842956
type WorkbookListParams as WorkbookListParams,
957+
type WorkbookCalcParams as WorkbookCalcParams,
843958
type WorkbookExportParams as WorkbookExportParams,
844959
type WorkbookQueryParams as WorkbookQueryParams,
845960
type WorkbookRenderChartParams as WorkbookRenderChartParams,
846961
type WorkbookUploadParams as WorkbookUploadParams,
962+
type WorkbookValuesParams as WorkbookValuesParams,
847963
};
848964
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '1.0.0'; // x-release-please-version
1+
export const VERSION = '1.0.1'; // x-release-please-version

tests/api-resources/workbooks.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ describe('resource workbooks', () => {
2828
).rejects.toThrow(Grid.NotFoundError);
2929
});
3030

31+
// skipped: tests are disabled for the time being
32+
test.skip('calc: only required params', async () => {
33+
const responsePromise = client.workbooks.calc('id', { read: ['A1'] });
34+
const rawResponse = await responsePromise.asResponse();
35+
expect(rawResponse).toBeInstanceOf(Response);
36+
const response = await responsePromise;
37+
expect(response).not.toBeInstanceOf(Response);
38+
const dataAndResponse = await responsePromise.withResponse();
39+
expect(dataAndResponse.data).toBe(response);
40+
expect(dataAndResponse.response).toBe(rawResponse);
41+
});
42+
43+
// skipped: tests are disabled for the time being
44+
test.skip('calc: required and optional params', async () => {
45+
const response = await client.workbooks.calc('id', { read: ['A1'], apply: { foo: 0 } });
46+
});
47+
3148
// skipped: tests are disabled for the time being
3249
test.skip('query: only required params', async () => {
3350
const responsePromise = client.workbooks.query('id', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] });
@@ -110,4 +127,21 @@ describe('resource workbooks', () => {
110127
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
111128
});
112129
});
130+
131+
// skipped: tests are disabled for the time being
132+
test.skip('values: only required params', async () => {
133+
const responsePromise = client.workbooks.values('id', { read: ['A1'] });
134+
const rawResponse = await responsePromise.asResponse();
135+
expect(rawResponse).toBeInstanceOf(Response);
136+
const response = await responsePromise;
137+
expect(response).not.toBeInstanceOf(Response);
138+
const dataAndResponse = await responsePromise.withResponse();
139+
expect(dataAndResponse.data).toBe(response);
140+
expect(dataAndResponse.response).toBe(rawResponse);
141+
});
142+
143+
// skipped: tests are disabled for the time being
144+
test.skip('values: required and optional params', async () => {
145+
const response = await client.workbooks.values('id', { read: ['A1'], apply: { foo: 0 } });
146+
});
113147
});

0 commit comments

Comments
 (0)