Skip to content

Commit f1b2441

Browse files
chore: break long lines in snippets into multiline
1 parent cc041d4 commit f1b2441

4 files changed

Lines changed: 91 additions & 18 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ const client = new Grid({
4646
});
4747

4848
const params: Grid.WorkbookQueryParams = { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] };
49-
const response: Grid.WorkbookQueryResponse = await client.workbooks.query('YOUR_WORKBOOK_ID', params);
49+
const response: Grid.WorkbookQueryResponse = await client.workbooks.query(
50+
'YOUR_WORKBOOK_ID',
51+
params,
52+
);
5053
```
5154

5255
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

tests/api-resources/beta.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ describe('resource beta', () => {
4646

4747
// Prism tests are disabled
4848
test.skip('searchLabels: required and optional params', async () => {
49-
const response = await client.beta.searchLabels({ query: 'profit', max_labels: 20, max_results: 10 });
49+
const response = await client.beta.searchLabels({
50+
query: 'profit',
51+
max_labels: 20,
52+
max_results: 10,
53+
});
5054
});
5155
});

tests/api-resources/workbooks.test.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ describe('resource workbooks', () => {
4444
test.skip('calc: required and optional params', async () => {
4545
const response = await client.workbooks.calc('id', {
4646
read: ['A1'],
47-
apply: { A1: 100, A2: 2.718, A3: 'Total', A4: true },
47+
apply: {
48+
A1: 100,
49+
A2: 2.718,
50+
A3: 'Total',
51+
A4: true,
52+
},
4853
});
4954
});
5055

@@ -65,15 +70,23 @@ describe('resource workbooks', () => {
6570
const response = await client.workbooks.query('id', {
6671
read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'],
6772
apply: [{ target: 'A2', value: 1234 }],
68-
goalSeek: { controlCell: 'Sheet1!A1:B2', targetCell: 'Sheet1!A1:B2', targetValue: 0 },
73+
goalSeek: {
74+
controlCell: 'Sheet1!A1:B2',
75+
targetCell: 'Sheet1!A1:B2',
76+
targetValue: 0,
77+
},
6978
options: { axis: 'rows' },
7079
});
7180
});
7281

7382
test('renderChart: required and optional params', async () => {
7483
const response = await client.workbooks.renderChart('id', {
7584
chart: {
76-
axisDim: { numberFormat: '#,##0.0', reverse: 'false', title: '=C4' },
85+
axisDim: {
86+
numberFormat: '#,##0.0',
87+
reverse: 'false',
88+
title: '=C4',
89+
},
7790
axisValue: {
7891
clip: 'false',
7992
max: 0,
@@ -148,7 +161,12 @@ describe('resource workbooks', () => {
148161
test.skip('values: required and optional params', async () => {
149162
const response = await client.workbooks.values('id', {
150163
read: ['A1'],
151-
apply: { A1: 100, A2: 2.718, A3: 'Total', A4: true },
164+
apply: {
165+
A1: 100,
166+
A2: 2.718,
167+
A3: 'Total',
168+
A4: true,
169+
},
152170
});
153171
});
154172
});

tests/index.test.ts

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ describe('instantiate client', () => {
8787
error: jest.fn(),
8888
};
8989

90-
const client = new Grid({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' });
90+
const client = new Grid({
91+
logger: logger,
92+
logLevel: 'debug',
93+
apiKey: 'My API Key',
94+
});
9195

9296
await forceAPIResponseForClient(client);
9397
expect(debugMock).toHaveBeenCalled();
@@ -107,7 +111,11 @@ describe('instantiate client', () => {
107111
error: jest.fn(),
108112
};
109113

110-
const client = new Grid({ logger: logger, logLevel: 'info', apiKey: 'My API Key' });
114+
const client = new Grid({
115+
logger: logger,
116+
logLevel: 'info',
117+
apiKey: 'My API Key',
118+
});
111119

112120
await forceAPIResponseForClient(client);
113121
expect(debugMock).not.toHaveBeenCalled();
@@ -157,7 +165,11 @@ describe('instantiate client', () => {
157165
};
158166

159167
process.env['GRID_LOG'] = 'debug';
160-
const client = new Grid({ logger: logger, logLevel: 'off', apiKey: 'My API Key' });
168+
const client = new Grid({
169+
logger: logger,
170+
logLevel: 'off',
171+
apiKey: 'My API Key',
172+
});
161173

162174
await forceAPIResponseForClient(client);
163175
expect(debugMock).not.toHaveBeenCalled();
@@ -173,7 +185,11 @@ describe('instantiate client', () => {
173185
};
174186

175187
process.env['GRID_LOG'] = 'not a log level';
176-
const client = new Grid({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' });
188+
const client = new Grid({
189+
logger: logger,
190+
logLevel: 'debug',
191+
apiKey: 'My API Key',
192+
});
177193
expect(client.logLevel).toBe('debug');
178194
expect(warnMock).not.toHaveBeenCalled();
179195
});
@@ -227,7 +243,11 @@ describe('instantiate client', () => {
227243

228244
test('explicit global fetch', async () => {
229245
// make sure the global fetch type is assignable to our Fetch type
230-
const client = new Grid({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: defaultFetch });
246+
const client = new Grid({
247+
baseURL: 'http://localhost:5000/',
248+
apiKey: 'My API Key',
249+
fetch: defaultFetch,
250+
});
231251
});
232252

233253
test('custom signal', async () => {
@@ -263,7 +283,11 @@ describe('instantiate client', () => {
263283
return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } });
264284
};
265285

266-
const client = new Grid({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch });
286+
const client = new Grid({
287+
baseURL: 'http://localhost:5000/',
288+
apiKey: 'My API Key',
289+
fetch: testFetch,
290+
});
267291

268292
await client.patch('/foo');
269293
expect(capturedRequest?.method).toEqual('PATCH');
@@ -341,7 +365,11 @@ describe('instantiate client', () => {
341365

342366
describe('withOptions', () => {
343367
test('creates a new client with overridden options', async () => {
344-
const client = new Grid({ baseURL: 'http://localhost:5000/', maxRetries: 3, apiKey: 'My API Key' });
368+
const client = new Grid({
369+
baseURL: 'http://localhost:5000/',
370+
maxRetries: 3,
371+
apiKey: 'My API Key',
372+
});
345373

346374
const newClient = client.withOptions({
347375
maxRetries: 5,
@@ -381,7 +409,11 @@ describe('instantiate client', () => {
381409
});
382410

383411
test('respects runtime property changes when creating new client', () => {
384-
const client = new Grid({ baseURL: 'http://localhost:5000/', timeout: 1000, apiKey: 'My API Key' });
412+
const client = new Grid({
413+
baseURL: 'http://localhost:5000/',
414+
timeout: 1000,
415+
apiKey: 'My API Key',
416+
});
385417

386418
// Modify the client properties directly after creation
387419
client.baseURL = 'http://localhost:6000/';
@@ -527,7 +559,11 @@ describe('retries', () => {
527559
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
528560
};
529561

530-
const client = new Grid({ apiKey: 'My API Key', timeout: 10, fetch: testFetch });
562+
const client = new Grid({
563+
apiKey: 'My API Key',
564+
timeout: 10,
565+
fetch: testFetch,
566+
});
531567

532568
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
533569
expect(count).toEqual(2);
@@ -557,7 +593,11 @@ describe('retries', () => {
557593
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
558594
};
559595

560-
const client = new Grid({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
596+
const client = new Grid({
597+
apiKey: 'My API Key',
598+
fetch: testFetch,
599+
maxRetries: 4,
600+
});
561601

562602
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
563603

@@ -581,7 +621,11 @@ describe('retries', () => {
581621
capturedRequest = init;
582622
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
583623
};
584-
const client = new Grid({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
624+
const client = new Grid({
625+
apiKey: 'My API Key',
626+
fetch: testFetch,
627+
maxRetries: 4,
628+
});
585629

586630
expect(
587631
await client.request({
@@ -643,7 +687,11 @@ describe('retries', () => {
643687
capturedRequest = init;
644688
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
645689
};
646-
const client = new Grid({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
690+
const client = new Grid({
691+
apiKey: 'My API Key',
692+
fetch: testFetch,
693+
maxRetries: 4,
694+
});
647695

648696
expect(
649697
await client.request({

0 commit comments

Comments
 (0)