Files
Primora/packages/api-client/src/generated/services/CollectionsService.ts
T
Tomas DvorakandDevin 8892c6dc43 feat: PostgREST-style document filtering and ordering
GET /collections/:id/documents accepts filter (field.op.value terms; eq neq
gt gte lt lte like in is; dotted paths index into document data) and order
(field.asc|desc). Whitelisted field/operator parsing with parameterized
values; plain lists keep the sqlc path. CLI gains `documents list
--collection --filter --order`; OpenAPI + generated client updated.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-24 18:55:56 +02:00

244 lines
7.2 KiB
TypeScript

/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Collection } from '../models/Collection';
import type { CollectionListResponse } from '../models/CollectionListResponse';
import type { CreateCollectionRequest } from '../models/CreateCollectionRequest';
import type { CreateDocumentRequest } from '../models/CreateDocumentRequest';
import type { Document } from '../models/Document';
import type { DocumentListResponse } from '../models/DocumentListResponse';
import type { UpdateCollectionRequest } from '../models/UpdateCollectionRequest';
import type { UpdateDocumentRequest } from '../models/UpdateDocumentRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class CollectionsService {
/**
* @returns CollectionListResponse List of collections in the project
* @throws ApiError
*/
public static listCollections({
projectId,
}: {
projectId: string,
}): CancelablePromise<CollectionListResponse> {
return __request(OpenAPI, {
method: 'GET',
url: '/projects/{projectID}/collections',
path: {
'projectID': projectId,
},
});
}
/**
* @returns Collection Collection created
* @throws ApiError
*/
public static createCollection({
projectId,
requestBody,
}: {
projectId: string,
requestBody: CreateCollectionRequest,
}): CancelablePromise<Collection> {
return __request(OpenAPI, {
method: 'POST',
url: '/projects/{projectID}/collections',
path: {
'projectID': projectId,
},
body: requestBody,
mediaType: 'application/json',
});
}
/**
* @returns Collection Collection details
* @throws ApiError
*/
public static getCollection({
projectId,
collectionId,
}: {
projectId: string,
collectionId: string,
}): CancelablePromise<Collection> {
return __request(OpenAPI, {
method: 'GET',
url: '/projects/{projectID}/collections/{collectionID}',
path: {
'projectID': projectId,
'collectionID': collectionId,
},
});
}
/**
* @returns Collection Collection updated
* @throws ApiError
*/
public static updateCollection({
projectId,
collectionId,
requestBody,
}: {
projectId: string,
collectionId: string,
requestBody: UpdateCollectionRequest,
}): CancelablePromise<Collection> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/projects/{projectID}/collections/{collectionID}',
path: {
'projectID': projectId,
'collectionID': collectionId,
},
body: requestBody,
mediaType: 'application/json',
});
}
/**
* @returns void
* @throws ApiError
*/
public static deleteCollection({
projectId,
collectionId,
}: {
projectId: string,
collectionId: string,
}): CancelablePromise<void> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/projects/{projectID}/collections/{collectionID}',
path: {
'projectID': projectId,
'collectionID': collectionId,
},
});
}
/**
* @returns DocumentListResponse List of documents in the collection
* @throws ApiError
*/
public static listDocuments({
collectionId,
limit = 50,
offset,
filter,
order,
}: {
collectionId: string,
limit?: number,
offset?: number,
/**
* PostgREST-style filters as comma-separated `field.op.value` terms. Ops: `eq`, `neq`, `gt`, `gte`, `lt`, `lte` (numeric values), `like` (ILIKE), `in` (pipe-separated values, e.g. `role.in.admin|editor`), `is` (`null`|`true`|`false`). Dotted paths index into the document data, e.g. `meta.city.eq.Prague`. Column fields `id`, `created_at`, `updated_at` are also allowed.
*
*/
filter?: string,
/**
* Comma-separated `field.asc|field.desc` list (default `created_at.desc`). Dotted paths index into document data.
*
*/
order?: string,
}): CancelablePromise<DocumentListResponse> {
return __request(OpenAPI, {
method: 'GET',
url: '/collections/{collectionID}/documents',
path: {
'collectionID': collectionId,
},
query: {
'limit': limit,
'offset': offset,
'filter': filter,
'order': order,
},
});
}
/**
* @returns Document Document created
* @throws ApiError
*/
public static createDocument({
collectionId,
requestBody,
}: {
collectionId: string,
requestBody: CreateDocumentRequest,
}): CancelablePromise<Document> {
return __request(OpenAPI, {
method: 'POST',
url: '/collections/{collectionID}/documents',
path: {
'collectionID': collectionId,
},
body: requestBody,
mediaType: 'application/json',
});
}
/**
* @returns Document Document details
* @throws ApiError
*/
public static getDocument({
collectionId,
documentId,
}: {
collectionId: string,
documentId: string,
}): CancelablePromise<Document> {
return __request(OpenAPI, {
method: 'GET',
url: '/collections/{collectionID}/documents/{documentID}',
path: {
'collectionID': collectionId,
'documentID': documentId,
},
});
}
/**
* @returns Document Document updated
* @throws ApiError
*/
public static updateDocument({
collectionId,
documentId,
requestBody,
}: {
collectionId: string,
documentId: string,
requestBody: UpdateDocumentRequest,
}): CancelablePromise<Document> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/collections/{collectionID}/documents/{documentID}',
path: {
'collectionID': collectionId,
'documentID': documentId,
},
body: requestBody,
mediaType: 'application/json',
});
}
/**
* @returns void
* @throws ApiError
*/
public static deleteDocument({
collectionId,
documentId,
}: {
collectionId: string,
documentId: string,
}): CancelablePromise<void> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/collections/{collectionID}/documents/{documentID}',
path: {
'collectionID': collectionId,
'documentID': documentId,
},
});
}
}