Skip to content

Commit 434e199

Browse files
feat(api): api update
1 parent 8f76d14 commit 434e199

3 files changed

Lines changed: 144 additions & 14 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-f9fd5fb43d56001ea7d7f49e92bd55134347b198b2664fd76321cc02a75817c9.yml
3-
openapi_spec_hash: 5130b5ebb7cbfe7a906716c5cf21764b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-81154a75608f9e6eee6e73e9565f7c062e2277a812021713cf1fe70b0516189c.yml
3+
openapi_spec_hash: a84243958fdcbc1d229f8c8b73815908
44
config_hash: 3e61a9566953ce5dbd4bcea7ceb568a3

src/resources/workbooks.ts

Lines changed: 141 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -590,16 +590,33 @@ export namespace WorkbookExportParams {
590590
*/
591591
export interface Apply {
592592
/**
593-
* A1-style reference for the cell to write to
593+
* Reference for the cell to write to
594594
*/
595-
target: string;
595+
target: string | Apply.ReferenceObject;
596596

597597
/**
598598
* Value to write to the target cell
599599
*/
600600
value: number | string | boolean | null;
601601
}
602602

603+
export namespace Apply {
604+
/**
605+
* A reference to a range of spreadsheet cells.
606+
*/
607+
export interface ReferenceObject {
608+
/**
609+
* Unprefixed A1-style range, id, or name
610+
*/
611+
cells: string;
612+
613+
/**
614+
* Name of the sheet to reference
615+
*/
616+
sheet: string | null;
617+
}
618+
}
619+
603620
/**
604621
* Goal seek. Use this to calculate the required input value for a formula to
605622
* achieve a specified target result. This is particularly useful when the desired
@@ -609,25 +626,57 @@ export namespace WorkbookExportParams {
609626
/**
610627
* Reference for the cell that will contain the solution
611628
*/
612-
controlCell: string;
629+
controlCell: string | GoalSeek.ReferenceObject;
613630

614631
/**
615632
* Reference for the cell that contains the formula you want to resolve
616633
*/
617-
targetCell: string;
634+
targetCell: string | GoalSeek.ReferenceObject;
618635

619636
/**
620637
* The value you want the formula to return
621638
*/
622639
targetValue: number;
623640
}
641+
642+
export namespace GoalSeek {
643+
/**
644+
* A reference to a range of spreadsheet cells.
645+
*/
646+
export interface ReferenceObject {
647+
/**
648+
* Unprefixed A1-style range, id, or name
649+
*/
650+
cells: string;
651+
652+
/**
653+
* Name of the sheet to reference
654+
*/
655+
sheet: string | null;
656+
}
657+
658+
/**
659+
* A reference to a range of spreadsheet cells.
660+
*/
661+
export interface ReferenceObject {
662+
/**
663+
* Unprefixed A1-style range, id, or name
664+
*/
665+
cells: string;
666+
667+
/**
668+
* Name of the sheet to reference
669+
*/
670+
sheet: string | null;
671+
}
672+
}
624673
}
625674

626675
export interface WorkbookQueryParams {
627676
/**
628677
* Cell references to read from the workbook and return to the client
629678
*/
630-
read: Array<string>;
679+
read: Array<string | WorkbookQueryParams.ReferenceObject>;
631680

632681
/**
633682
* Cells to update before reading. Note that the API has no state and any changes
@@ -649,23 +698,55 @@ export interface WorkbookQueryParams {
649698
}
650699

651700
export namespace WorkbookQueryParams {
701+
/**
702+
* A reference to a range of spreadsheet cells.
703+
*/
704+
export interface ReferenceObject {
705+
/**
706+
* Unprefixed A1-style range, id, or name
707+
*/
708+
cells: string;
709+
710+
/**
711+
* Name of the sheet to reference
712+
*/
713+
sheet: string | null;
714+
}
715+
652716
/**
653717
* Specifies a temporary change to a workbook cell, including the `target` cell
654718
* reference and the `value` to apply. The API has no state, and so any changes
655719
* made are cleared after each request.
656720
*/
657721
export interface Apply {
658722
/**
659-
* A1-style reference for the cell to write to
723+
* Reference for the cell to write to
660724
*/
661-
target: string;
725+
target: string | Apply.ReferenceObject;
662726

663727
/**
664728
* Value to write to the target cell
665729
*/
666730
value: number | string | boolean | null;
667731
}
668732

733+
export namespace Apply {
734+
/**
735+
* A reference to a range of spreadsheet cells.
736+
*/
737+
export interface ReferenceObject {
738+
/**
739+
* Unprefixed A1-style range, id, or name
740+
*/
741+
cells: string;
742+
743+
/**
744+
* Name of the sheet to reference
745+
*/
746+
sheet: string | null;
747+
}
748+
}
749+
669750
/**
670751
* Goal seek. Use this to calculate the required input value for a formula to
671752
* achieve a specified target result. This is particularly useful when the desired
@@ -675,19 +756,51 @@ export namespace WorkbookQueryParams {
675756
/**
676757
* Reference for the cell that will contain the solution
677758
*/
678-
controlCell: string;
759+
controlCell: string | GoalSeek.ReferenceObject;
679760

680761
/**
681762
* Reference for the cell that contains the formula you want to resolve
682763
*/
683-
targetCell: string;
764+
targetCell: string | GoalSeek.ReferenceObject;
684765

685766
/**
686767
* The value you want the formula to return
687768
*/
688769
targetValue: number;
689770
}
690771

772+
export namespace GoalSeek {
773+
/**
774+
* A reference to a range of spreadsheet cells.
775+
*/
776+
export interface ReferenceObject {
777+
/**
778+
* Unprefixed A1-style range, id, or name
779+
*/
780+
cells: string;
781+
782+
/**
783+
* Name of the sheet to reference
784+
*/
785+
sheet: string | null;
786+
}
787+
788+
/**
789+
* A reference to a range of spreadsheet cells.
790+
*/
791+
export interface ReferenceObject {
792+
/**
793+
* Unprefixed A1-style range, id, or name
794+
*/
795+
cells: string;
796+
797+
/**
798+
* Name of the sheet to reference
799+
*/
800+
sheet: string | null;
801+
}
802+
}
803+
691804
/**
692805
* Defines settings for formatting and structuring query results.
693806
*/
@@ -780,15 +893,32 @@ export namespace WorkbookRenderChartParams {
780893
*/
781894
export interface Apply {
782895
/**
783-
* A1-style reference for the cell to write to
896+
* Reference for the cell to write to
784897
*/
785-
target: string;
898+
target: string | Apply.ReferenceObject;
786899

787900
/**
788901
* Value to write to the target cell
789902
*/
790903
value: number | string | boolean | null;
791904
}
905+
906+
export namespace Apply {
907+
/**
908+
* A reference to a range of spreadsheet cells.
909+
*/
910+
export interface ReferenceObject {
911+
/**
912+
* Unprefixed A1-style range, id, or name
913+
*/
914+
cells: string;
915+
916+
/**
917+
* Name of the sheet to reference
918+
*/
919+
sheet: string | null;
920+
}
921+
}
792922
}
793923

794924
export interface WorkbookUploadParams {

tests/api-resources/workbooks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('resource workbooks', () => {
4545
const response = await client.workbooks.query('id', {
4646
read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'],
4747
apply: [{ target: 'A2', value: 1234 }],
48-
goalSeek: { controlCell: 'controlCell', targetCell: 'targetCell', targetValue: 0 },
48+
goalSeek: { controlCell: 'Sheet1!A1:B2', targetCell: 'Sheet1!A1:B2', targetValue: 0 },
4949
options: { axis: 'rows', originals: 'off', refs: 'off', structure: 'single', values: 'full' },
5050
});
5151
});

0 commit comments

Comments
 (0)