Skip to content

Commit e115347

Browse files
feat(api): update via SDK Studio
1 parent 8bc41b5 commit e115347

30 files changed

Lines changed: 175 additions & 162 deletions

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
{
1111
patterns: [
1212
{
13-
group: ['spreadsheet-api', 'spreadsheet-api/*'],
13+
group: ['@grid-is/api', '@grid-is/api/*'],
1414
message: 'Use a relative import, not a package import.',
1515
},
1616
],

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ $ cd spreadsheet-api-typescript
5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link spreadsheet-api
58+
$ yarn link @grid-is/api
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global spreadsheet-api
63+
$ pnpm link -—global @grid-is/api
6464
```
6565

6666
## Running tests

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Spreadsheet API
189+
Copyright 2025 GRID
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Spreadsheet API TypeScript API Library
1+
# GRID Spreadsheet API API Library
22

3-
[![NPM version](https://img.shields.io/npm/v/spreadsheet-api.svg)](https://npmjs.org/package/spreadsheet-api) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/spreadsheet-api)
3+
[![NPM version](https://img.shields.io/npm/v/@grid-is/api.svg)](https://npmjs.org/package/@grid-is/api) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@grid-is/api)
44

5-
This library provides convenient access to the Spreadsheet API REST API from server-side TypeScript or JavaScript.
5+
This library provides convenient access to the GRID REST API from server-side TypeScript or JavaScript.
66

7-
The REST API documentation can be found on [docs.spreadsheet-api.com](https://docs.spreadsheet-api.com). The full API of this library can be found in [api.md](api.md).
7+
The REST API documentation can be found on [alpha.grid.is](https://alpha.grid.is/). The full API of this library can be found in [api.md](api.md).
88

99
It is generated with [Stainless](https://www.stainlessapi.com/).
1010

@@ -15,17 +15,17 @@ npm install git+ssh://git@github.com:stainless-sdks/spreadsheet-api-typescript.g
1515
```
1616

1717
> [!NOTE]
18-
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install spreadsheet-api`
18+
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install @grid-is/api`
1919
2020
## Usage
2121

2222
The full API of this library can be found in [api.md](api.md).
2323

2424
<!-- prettier-ignore -->
2525
```js
26-
import SpreadsheetAPI from 'spreadsheet-api';
26+
import GRID from '@grid-is/api';
2727

28-
const client = new SpreadsheetAPI();
28+
const client = new GRID();
2929

3030
async function main() {
3131
const response = await client.workbooks.query('REPLACE_ME', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] });
@@ -42,13 +42,13 @@ This library includes TypeScript definitions for all request params and response
4242

4343
<!-- prettier-ignore -->
4444
```ts
45-
import SpreadsheetAPI from 'spreadsheet-api';
45+
import GRID from '@grid-is/api';
4646

47-
const client = new SpreadsheetAPI();
47+
const client = new GRID();
4848

4949
async function main() {
50-
const params: SpreadsheetAPI.WorkbookQueryParams = { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] };
51-
const response: SpreadsheetAPI.WorkbookQueryResponse = await client.workbooks.query('REPLACE_ME', params);
50+
const params: GRID.WorkbookQueryParams = { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] };
51+
const response: GRID.WorkbookQueryResponse = await client.workbooks.query('REPLACE_ME', params);
5252
}
5353

5454
main();
@@ -68,7 +68,7 @@ async function main() {
6868
const response = await client.workbooks
6969
.query('REPLACE_ME', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] })
7070
.catch(async (err) => {
71-
if (err instanceof SpreadsheetAPI.APIError) {
71+
if (err instanceof GRID.APIError) {
7272
console.log(err.status); // 400
7373
console.log(err.name); // BadRequestError
7474
console.log(err.headers); // {server: 'nginx', ...}
@@ -105,7 +105,7 @@ You can use the `maxRetries` option to configure or disable this:
105105
<!-- prettier-ignore -->
106106
```js
107107
// Configure the default for all requests:
108-
const client = new SpreadsheetAPI({
108+
const client = new GRID({
109109
maxRetries: 0, // default is 2
110110
});
111111

@@ -122,7 +122,7 @@ Requests time out after 1 minute by default. You can configure this with a `time
122122
<!-- prettier-ignore -->
123123
```ts
124124
// Configure the default for all requests:
125-
const client = new SpreadsheetAPI({
125+
const client = new GRID({
126126
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
127127
});
128128

@@ -136,6 +136,24 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
136136

137137
Note that requests which time out will be [retried twice by default](#retries).
138138

139+
## Default Headers
140+
141+
We automatically send the `X-Client-Name` header set to `spreadsheet-api-node`.
142+
143+
If you need to, you can override it by setting default headers on a per-request basis.
144+
145+
```ts
146+
import GRID from '@grid-is/api';
147+
148+
const client = new GRID();
149+
150+
const response = await client.workbooks.query(
151+
'REPLACE_ME',
152+
{ read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] },
153+
{ headers: { 'X-Client-Name': 'My-Custom-Value' } },
154+
);
155+
```
156+
139157
## Advanced Usage
140158

141159
### Accessing raw Response data (e.g., headers)
@@ -146,7 +164,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
146164

147165
<!-- prettier-ignore -->
148166
```ts
149-
const client = new SpreadsheetAPI();
167+
const client = new GRID();
150168

151169
const response = await client.workbooks
152170
.query('REPLACE_ME', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] })
@@ -222,7 +240,7 @@ Or pass it to the client:
222240
```ts
223241
import fetch from 'my-fetch';
224242

225-
const client = new SpreadsheetAPI({ fetch });
243+
const client = new GRID({ fetch });
226244
```
227245

228246
### Logging and middleware
@@ -232,9 +250,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
232250

233251
```ts
234252
import { fetch } from 'undici'; // as one example
235-
import SpreadsheetAPI from 'spreadsheet-api';
253+
import GRID from '@grid-is/api';
236254

237-
const client = new SpreadsheetAPI({
255+
const client = new GRID({
238256
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
239257
console.log('About to make a request', url, init);
240258
const response = await fetch(url, init);
@@ -244,17 +262,17 @@ const client = new SpreadsheetAPI({
244262
});
245263
```
246264

247-
Note that if given a `SPREADSHEET_API_LOG=debug` environment variable, this library will log all requests and responses automatically.
265+
Note that if given a `GRID_LOG=debug` environment variable, this library will log all requests and responses automatically.
248266
This is intended for debugging purposes only and may change in the future without notice.
249267

250268
### Fetch options
251269

252270
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
253271

254272
```ts
255-
import SpreadsheetAPI from 'spreadsheet-api';
273+
import GRID from '@grid-is/api';
256274

257-
const client = new SpreadsheetAPI({
275+
const client = new GRID({
258276
fetchOptions: {
259277
// `RequestInit` options
260278
},
@@ -269,11 +287,11 @@ options to requests:
269287
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
270288

271289
```ts
272-
import SpreadsheetAPI from 'spreadsheet-api';
290+
import GRID from '@grid-is/api';
273291
import * as undici from 'undici';
274292

275293
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
276-
const client = new SpreadsheetAPI({
294+
const client = new GRID({
277295
fetchOptions: {
278296
dispatcher: proxyAgent,
279297
},
@@ -283,9 +301,9 @@ const client = new SpreadsheetAPI({
283301
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
284302

285303
```ts
286-
import SpreadsheetAPI from 'spreadsheet-api';
304+
import GRID from '@grid-is/api';
287305

288-
const client = new SpreadsheetAPI({
306+
const client = new GRID({
289307
fetchOptions: {
290308
proxy: 'http://localhost:8888',
291309
},
@@ -295,10 +313,10 @@ const client = new SpreadsheetAPI({
295313
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
296314

297315
```ts
298-
import SpreadsheetAPI from 'npm:spreadsheet-api';
316+
import GRID from 'npm:@grid-is/api';
299317

300318
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
301-
const client = new SpreadsheetAPI({
319+
const client = new GRID({
302320
fetchOptions: {
303321
client: httpClient,
304322
},

SECURITY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Spreadsheet API please follow the respective company's security reporting guidelines.
19+
or products provided by GRID please follow the respective company's security reporting guidelines.
2020

21-
### Spreadsheet API Terms and Policies
21+
### GRID Terms and Policies
2222

23-
Please contact dev-feedback@spreadsheet-api.com for any questions or concerns regarding security of our services.
23+
Please contact info@grid.is for any questions or concerns regarding security of our services.
2424

2525
---
2626

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^spreadsheet-api$': '<rootDir>/src/index.ts',
11-
'^spreadsheet-api/(.*)$': '<rootDir>/src/$1',
10+
'^@grid-is/api$': '<rootDir>/src/index.ts',
11+
'^@grid-is/api/(.*)$': '<rootDir>/src/$1',
1212
},
1313
modulePathIgnorePatterns: [
1414
'<rootDir>/ecosystem-tests/',

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "spreadsheet-api",
2+
"name": "@grid-is/api",
33
"version": "0.0.1-alpha.0",
4-
"description": "The official TypeScript library for the Spreadsheet API API",
5-
"author": "Spreadsheet API <dev-feedback@spreadsheet-api.com>",
4+
"description": "The official TypeScript library for the GRID API",
5+
"author": "GRID <info@grid.is>",
66
"types": "dist/index.d.ts",
77
"main": "dist/index.js",
88
"type": "commonjs",
@@ -46,8 +46,8 @@
4646
"typescript": "^4.8.2"
4747
},
4848
"imports": {
49-
"spreadsheet-api": ".",
50-
"spreadsheet-api/*": "./src/*"
49+
"@grid-is/api": ".",
50+
"@grid-is/api/*": "./src/*"
5151
},
5252
"exports": {
5353
".": {

scripts/build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
88

99
# Build into dist and will publish the package from there,
1010
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
11-
# This way importing from `"spreadsheet-api/resources/foo"` works
11+
# This way importing from `"@grid-is/api/resources/foo"` works
1212
# even with `"moduleResolution": "node"`
1313

1414
rm -rf dist; mkdir dist
@@ -28,7 +28,7 @@ node scripts/utils/make-dist-package-json.cjs > dist/package.json
2828

2929
# build to .js/.mjs/.d.ts files
3030
npm exec tsc-multi
31-
# we need to add exports = module.exports = SpreadsheetAPI to index.js;
31+
# we need to add exports = module.exports = GRID to index.js;
3232
# No way to get that from index.ts because it would cause compile errors
3333
# when building .mjs
3434
node scripts/utils/fix-index-exports.cjs
@@ -47,8 +47,8 @@ node scripts/utils/postprocess-files.cjs
4747

4848
# make sure that nothing crashes when we require the output CJS or
4949
# import the output ESM
50-
(cd dist && node -e 'require("spreadsheet-api")')
51-
(cd dist && node -e 'import("spreadsheet-api")' --input-type=module)
50+
(cd dist && node -e 'require("@grid-is/api")')
51+
(cd dist && node -e 'import("@grid-is/api")' --input-type=module)
5252

5353
if [ -e ./scripts/build-deno ]
5454
then

src/api-promise.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import { type SpreadsheetAPI } from './client';
3+
import { type GRID } from './client';
44

55
import { type PromiseOrValue } from './internal/types';
66
import { APIResponseProps, defaultParseResponse } from './internal/parse';
@@ -11,13 +11,13 @@ import { APIResponseProps, defaultParseResponse } from './internal/parse';
1111
*/
1212
export class APIPromise<T> extends Promise<T> {
1313
private parsedPromise: Promise<T> | undefined;
14-
#client: SpreadsheetAPI;
14+
#client: GRID;
1515

1616
constructor(
17-
client: SpreadsheetAPI,
17+
client: GRID,
1818
private responsePromise: Promise<APIResponseProps>,
1919
private parseResponse: (
20-
client: SpreadsheetAPI,
20+
client: GRID,
2121
props: APIResponseProps,
2222
) => PromiseOrValue<T> = defaultParseResponse,
2323
) {

0 commit comments

Comments
 (0)