mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-20 17:14:11 +00:00
62792329c3
Summary: Adds new API endpoints to list tables in a document and create or modify tables and columns. The request and response formats are designed to mirror the style of the existing `GET /columns` and `GET/POST/PATCH /records` endpoints. Discussion: https://grist.slack.com/archives/C0234CPPXPA/p1665139807125649?thread_ts=1628957179.010500&cid=C0234CPPXPA Test Plan: DocApi test Reviewers: jarek Reviewed By: jarek Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D3667
101 lines
2.2 KiB
TypeScript
101 lines
2.2 KiB
TypeScript
/**
|
|
* This module was automatically generated by `ts-interface-builder`
|
|
*/
|
|
import * as t from "ts-interface-checker";
|
|
// tslint:disable:object-literal-key-quotes
|
|
|
|
export const NewRecord = t.iface([], {
|
|
"fields": t.opt(t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
})),
|
|
});
|
|
|
|
export const NewRecordWithStringId = t.iface([], {
|
|
"id": t.opt("string"),
|
|
"fields": t.opt(t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
})),
|
|
});
|
|
|
|
export const Record = t.iface([], {
|
|
"id": "number",
|
|
"fields": t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
}),
|
|
});
|
|
|
|
export const RecordWithStringId = t.iface([], {
|
|
"id": "string",
|
|
"fields": t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
}),
|
|
});
|
|
|
|
export const AddOrUpdateRecord = t.iface([], {
|
|
"require": t.intersection(t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
}), t.iface([], {
|
|
"id": t.opt("number"),
|
|
})),
|
|
"fields": t.opt(t.iface([], {
|
|
[t.indexKey]: "CellValue",
|
|
})),
|
|
});
|
|
|
|
export const RecordsPatch = t.iface([], {
|
|
"records": t.tuple("Record", t.rest(t.array("Record"))),
|
|
});
|
|
|
|
export const RecordsPost = t.iface([], {
|
|
"records": t.tuple("NewRecord", t.rest(t.array("NewRecord"))),
|
|
});
|
|
|
|
export const RecordsPut = t.iface([], {
|
|
"records": t.tuple("AddOrUpdateRecord", t.rest(t.array("AddOrUpdateRecord"))),
|
|
});
|
|
|
|
export const RecordId = t.name("number");
|
|
|
|
export const MinimalRecord = t.iface([], {
|
|
"id": "number",
|
|
});
|
|
|
|
export const ColumnsPost = t.iface([], {
|
|
"columns": t.tuple("NewRecordWithStringId", t.rest(t.array("NewRecordWithStringId"))),
|
|
});
|
|
|
|
export const ColumnsPatch = t.iface([], {
|
|
"columns": t.tuple("RecordWithStringId", t.rest(t.array("RecordWithStringId"))),
|
|
});
|
|
|
|
export const TablePost = t.iface(["ColumnsPost"], {
|
|
"id": t.opt("string"),
|
|
});
|
|
|
|
export const TablesPost = t.iface([], {
|
|
"tables": t.tuple("TablePost", t.rest(t.array("TablePost"))),
|
|
});
|
|
|
|
export const TablesPatch = t.iface([], {
|
|
"tables": t.tuple("RecordWithStringId", t.rest(t.array("RecordWithStringId"))),
|
|
});
|
|
|
|
const exportedTypeSuite: t.ITypeSuite = {
|
|
NewRecord,
|
|
NewRecordWithStringId,
|
|
Record,
|
|
RecordWithStringId,
|
|
AddOrUpdateRecord,
|
|
RecordsPatch,
|
|
RecordsPost,
|
|
RecordsPut,
|
|
RecordId,
|
|
MinimalRecord,
|
|
ColumnsPost,
|
|
ColumnsPatch,
|
|
TablePost,
|
|
TablesPost,
|
|
TablesPatch,
|
|
};
|
|
export default exportedTypeSuite;
|