Add OpenAPI types
This commit is contained in:
parent
a2a4611497
commit
f26457c2cf
5 changed files with 780 additions and 300 deletions
|
|
@ -2,4 +2,3 @@
|
||||||
cargo install sqlx-cli
|
cargo install sqlx-cli
|
||||||
rm sync_server/test.db && sqlx database create --database-url sqlite://sync_server/test.db
|
rm sync_server/test.db && sqlx database create --database-url sqlite://sync_server/test.db
|
||||||
sqlx migrate run --source sync_server/src/database/migrations --database-url sqlite://sync_server/test.db
|
sqlx migrate run --source sync_server/src/database/migrations --database-url sqlite://sync_server/test.db
|
||||||
DATABASE_URL=sqlite://sync_server/test.db cargo sqlx prepare --workspace
|
|
||||||
|
|
@ -94,3 +94,10 @@ If you have multiple URLs, you can also do:
|
||||||
## API Documentation
|
## API Documentation
|
||||||
|
|
||||||
See https://github.com/obsidianmd/obsidian-api
|
See https://github.com/obsidianmd/obsidian-api
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
npm install -g openapi-typescript
|
||||||
|
openapi-typescript http://localhost:3000/api.json --output ./types.ts
|
||||||
789
plugin/package-lock.json
generated
789
plugin/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,9 +17,12 @@
|
||||||
"@typescript-eslint/parser": "5.29.0",
|
"@typescript-eslint/parser": "5.29.0",
|
||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.17.3",
|
||||||
"obsidian": "latest",
|
"obsidian": "1.7.2",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "4.7.4",
|
"typescript": "5.7.2",
|
||||||
"esbuild-plugin-wasm-pack": "^1.1.0"
|
"esbuild-plugin-wasm-pack": "^1.1.0",
|
||||||
|
"eslint": "8.1.0",
|
||||||
|
"openapi-fetch": "0.13.3",
|
||||||
|
"openapi-typescript": "7.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
282
plugin/src/syncer/types.ts
Normal file
282
plugin/src/syncer/types.ts
Normal file
|
|
@ -0,0 +1,282 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated by openapi-typescript.
|
||||||
|
* Do not make direct changes to the file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface paths {
|
||||||
|
"/vaults/{vault_id}/documents": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header: {
|
||||||
|
authorization: string;
|
||||||
|
};
|
||||||
|
path: {
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["DocumentVersionWithoutContent"][];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
put?: never;
|
||||||
|
post: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header: {
|
||||||
|
authorization: string;
|
||||||
|
};
|
||||||
|
path: {
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["CreateDocumentVersion"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["DocumentVersionWithoutContent"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/vaults/{vault_id}/documents/{document_id}": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header: {
|
||||||
|
authorization: string;
|
||||||
|
};
|
||||||
|
path: {
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["DocumentVersion"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
put: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header: {
|
||||||
|
authorization: string;
|
||||||
|
};
|
||||||
|
path: {
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["UpdateDocumentVersion"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["DocumentVersionWithoutContent"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
post?: never;
|
||||||
|
delete: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header: {
|
||||||
|
authorization: string;
|
||||||
|
};
|
||||||
|
path: {
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["DeleteDocumentVersion"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description no content */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content?: never;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/ws": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description websocket upgrade */
|
||||||
|
101: {
|
||||||
|
headers: {
|
||||||
|
connection?: "upgrade";
|
||||||
|
upgrade?: "websocket";
|
||||||
|
"sec-websocket-key"?: string;
|
||||||
|
"sec-websocket-protocol"?: string;
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content?: never;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export type webhooks = Record<string, never>;
|
||||||
|
export interface components {
|
||||||
|
schemas: {
|
||||||
|
CreateDocumentVersion: {
|
||||||
|
contentBase64: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
createdDate: string;
|
||||||
|
isBinary: boolean;
|
||||||
|
relativePath: string;
|
||||||
|
};
|
||||||
|
DeleteDocumentVersion: {
|
||||||
|
/** Format: date-time */
|
||||||
|
createdDate: string;
|
||||||
|
};
|
||||||
|
DocumentVersion: {
|
||||||
|
contentBase64: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
createdDate: string;
|
||||||
|
/** Format: uuid */
|
||||||
|
documentId: string;
|
||||||
|
isBinary: boolean;
|
||||||
|
isDeleted: boolean;
|
||||||
|
relativePath: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
updatedDate: string;
|
||||||
|
vaultId: string;
|
||||||
|
/** Format: int64 */
|
||||||
|
versionId: number;
|
||||||
|
};
|
||||||
|
DocumentVersionWithoutContent: {
|
||||||
|
/** Format: date-time */
|
||||||
|
createdDate: string;
|
||||||
|
/** Format: uuid */
|
||||||
|
documentId: string;
|
||||||
|
isBinary: boolean;
|
||||||
|
isDeleted: boolean;
|
||||||
|
relativePath: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
updatedDate: string;
|
||||||
|
vaultId: string;
|
||||||
|
/** Format: int64 */
|
||||||
|
versionId: number;
|
||||||
|
};
|
||||||
|
PathParams: {
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
PathParams2: {
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
PathParams3: {
|
||||||
|
/** Format: uuid */
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
PathParams4: {
|
||||||
|
/** Format: uuid */
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
PathParams5: {
|
||||||
|
/** Format: uuid */
|
||||||
|
document_id: string;
|
||||||
|
vault_id: string;
|
||||||
|
};
|
||||||
|
UpdateDocumentVersion: {
|
||||||
|
contentBase64: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
createdDate: string;
|
||||||
|
isBinary: boolean;
|
||||||
|
/** Format: int64 */
|
||||||
|
parentVersionId: number;
|
||||||
|
relativePath: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: never;
|
||||||
|
parameters: never;
|
||||||
|
requestBodies: never;
|
||||||
|
headers: never;
|
||||||
|
pathItems: never;
|
||||||
|
}
|
||||||
|
export type $defs = Record<string, never>;
|
||||||
|
export type operations = Record<string, never>;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue