Skip to content

Commit 8b73fb6

Browse files
feat(api): api update
1 parent 258efc0 commit 8b73fb6

3 files changed

Lines changed: 191 additions & 11 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-81154a75608f9e6eee6e73e9565f7c062e2277a812021713cf1fe70b0516189c.yml
3-
openapi_spec_hash: a84243958fdcbc1d229f8c8b73815908
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-abb33a630edc4ccab958d6ecf6d97989abb5d7324f240daf79105dc6dd5bc64a.yml
3+
openapi_spec_hash: cfb42c5a725db1d29520b453d48f2115
44
config_hash: 3e61a9566953ce5dbd4bcea7ceb568a3

src/resources/workbooks.ts

Lines changed: 163 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Workbooks extends APIResource {
8080
* @example
8181
* ```ts
8282
* const response = await client.workbooks.renderChart('id', {
83-
* chart: { data: '=C2:C142' },
83+
* chart: {},
8484
* });
8585
*
8686
* const content = await response.blob();
@@ -895,35 +895,190 @@ export namespace WorkbookRenderChartParams {
895895
* type, image output format, and title and axis labels.
896896
*/
897897
export interface Chart {
898+
/**
899+
* How an axis representing dimensional categories is presented.
900+
*/
901+
axisDim?: Chart.AxisDim | null;
902+
903+
/**
904+
* How an axis representing value magnitudes is presented.
905+
*/
906+
axisValue?: Chart.AxisValue | null;
907+
908+
/**
909+
* Enum representing the supported strategies for handling blank or missing data
910+
* points.
911+
*/
912+
blanks?: 'gap' | 'zero' | 'span' | null;
913+
914+
/**
915+
* An Excel array expression that returns a 1-dimensional list of HTML color
916+
* strings
917+
*/
918+
chartColors?: string | null;
919+
920+
/**
921+
* Vary colors by point rather than series.
922+
*/
923+
colorByPoint?: string | null;
924+
898925
/**
899926
* Chart data range, prefixed with an equals sign
900927
*/
901-
data: string | null;
928+
data?: string | null;
929+
930+
/**
931+
* Chart data range, prefixed with an equals sign, used for lines in a combo chart
932+
*/
933+
dataLines?: string | null;
934+
935+
/**
936+
* Enum representing the supported read orientations for data directions.
937+
*/
938+
dir?: '' | 'col' | 'row' | null;
939+
940+
/**
941+
* Cell reference to use as the chart's footnote text. Can also be plain text.
942+
*/
943+
footnote?: string | null;
944+
945+
/**
946+
* Supported image types for rendering charts from workbook data.
947+
*/
948+
format?: 'png' | 'svg' | null;
902949

903950
/**
904-
* File format to use for the chart image
951+
* Enum representing the supported interpolation types for data visualization or
952+
* curve fitting.
905953
*/
906-
format?: 'png' | 'svg';
954+
interpolate?: 'linear' | 'step' | 'step-after' | 'step-before' | 'monotone' | 'basis' | null;
907955

908956
/**
909957
* Range of cells to use as the chart's x-axis labels, prefixed with an equals sign
910958
*/
911959
labels?: string | null;
912960

961+
/**
962+
* Range of cells to use as the chart's legend labels, prefixed with an equals sign
963+
*/
964+
legend?: string | null;
965+
966+
/**
967+
* Range of cells to use as the chart's line labels in the legend, prefixed with an
968+
* equals sign
969+
*/
970+
legendLines?: string | null;
971+
972+
/**
973+
* Whether to display a chart legend
974+
*/
975+
legendVisible?: 'false' | 'true' | null;
976+
977+
/**
978+
* Number format pattern used for formatting labels on the chart.
979+
*/
980+
numberFormat?: string | null;
981+
982+
/**
983+
* The number of which series the data should be sorted by (e.g. 1 for the first
984+
* series).
985+
*/
986+
sortBy?: number | null;
987+
988+
/**
989+
* The sorting direction when the sortBy property is set.
990+
*/
991+
sortOrder?: '' | 'ascending' | 'descending' | null;
992+
993+
/**
994+
* Whether to display series stacked or grouped
995+
*/
996+
stacked?: 'false' | 'true' | null;
997+
998+
/**
999+
* Cell reference to use as the chart's subtitle. Can also be plain text.
1000+
*/
1001+
subtitle?: string | null;
1002+
9131003
/**
9141004
* Cell reference to use as the chart's title. Can also be plain text.
9151005
*/
9161006
title?: string | null;
9171007

9181008
/**
919-
* Type of chart to render
1009+
* Types of charts that can be rendered using workbook data.
1010+
*/
1011+
type?: 'area' | 'bar' | 'column' | 'combo' | 'line' | 'pie' | 'scatterplot' | 'waterfall' | null;
1012+
1013+
/**
1014+
* Options for labelling individual data values on a chart. If "none" (the default)
1015+
* then no data labels are shown. If "selective", data labels are shown when they
1016+
* fit without overlap. If "all", all values are labelled.
1017+
*/
1018+
values?: 'none' | 'selective' | 'all' | null;
1019+
}
1020+
1021+
export namespace Chart {
1022+
/**
1023+
* How an axis representing dimensional categories is presented.
9201024
*/
921-
type?: 'line' | 'column';
1025+
export interface AxisDim {
1026+
/**
1027+
* Number format pattern used for formatting the axis labels.
1028+
*/
1029+
numberFormat?: string | null;
1030+
1031+
/**
1032+
* If true, invert the scale of the axis. If false, keep the order untouched.
1033+
*/
1034+
reverse?: 'false' | 'true' | null;
1035+
1036+
/**
1037+
* Cell reference to use as the axis title. Can also be plain text.
1038+
*/
1039+
title?: string | null;
1040+
}
9221041

9231042
/**
924-
* How to label individual data values on the chart
1043+
* How an axis representing value magnitudes is presented.
9251044
*/
926-
values?: 'none' | 'selective' | 'all';
1045+
export interface AxisValue {
1046+
/**
1047+
* If true, any graphics outside the min or max boundaries of the axes are
1048+
* truncated.
1049+
*/
1050+
clip?: 'false' | 'true' | null;
1051+
1052+
/**
1053+
* A maximum value for the axis.
1054+
*/
1055+
max?: number | null;
1056+
1057+
/**
1058+
* A minimum value for the axis.
1059+
*/
1060+
min?: number | null;
1061+
1062+
/**
1063+
* Number format pattern used for formatting the axis labels.
1064+
*/
1065+
numberFormat?: string | null;
1066+
1067+
/**
1068+
* Draw the axis in ascending or descending order.
1069+
*/
1070+
reverse?: 'false' | 'true' | null;
1071+
1072+
/**
1073+
* Cell reference to use as the axis title. Can also be plain text.
1074+
*/
1075+
title?: string | null;
1076+
1077+
/**
1078+
* Types of scales that can be used by an axis.
1079+
*/
1080+
type?: 'linear' | 'log' | null;
1081+
}
9271082
}
9281083

9291084
/**

tests/api-resources/workbooks.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,36 @@ describe('resource workbooks', () => {
5454
test.skip('renderChart: required and optional params', async () => {
5555
const response = await client.workbooks.renderChart('id', {
5656
chart: {
57+
axisDim: { numberFormat: '#,##0.0', reverse: 'false', title: '=C4' },
58+
axisValue: {
59+
clip: 'false',
60+
max: 0,
61+
min: 0,
62+
numberFormat: '#,##0.0',
63+
reverse: 'false',
64+
title: '=C4',
65+
type: 'linear',
66+
},
67+
blanks: 'gap',
68+
chartColors: '={"#C40";"#03F"}',
69+
colorByPoint: 'colorByPoint',
5770
data: '=C2:C142',
71+
dataLines: '=C2:C142',
72+
dir: 'row',
73+
footnote: '=H13',
5874
format: 'png',
75+
interpolate: 'linear',
5976
labels: '=B2:B142',
77+
legend: '=D2:D142',
78+
legendLines: '=E2:E142',
79+
legendVisible: 'false',
80+
numberFormat: '#,##0.0',
81+
sortBy: 0,
82+
sortOrder: '',
83+
stacked: 'false',
84+
subtitle: '=B4',
6085
title: '=A1',
61-
type: 'line',
86+
type: 'area',
6287
values: 'none',
6388
},
6489
apply: [{ target: 'A2', value: 1234 }],

0 commit comments

Comments
 (0)