diff --git a/src/typed-method-types/apps.ts b/src/typed-method-types/apps.ts index 107b680..3a023fc 100644 --- a/src/typed-method-types/apps.ts +++ b/src/typed-method-types/apps.ts @@ -51,6 +51,36 @@ export type DatastorePutResponse< item: DatastoreItem; }; +export type DatastoreBulkPutArgs< + Schema extends DatastoreSchema, +> = + & BaseMethodArgs + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + /** + * @description Array of items to store + */ + items: DatastoreItem[]; + }; + +export type DatastoreBulkPutResponse< + Schema extends DatastoreSchema, +> = + & BaseResponse + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + /** + * @description Array of items that failed to be inserted + */ + failed_items: DatastoreItem[]; + }; + export type DatastoreUpdateArgs< Schema extends DatastoreSchema, > = @@ -112,6 +142,41 @@ export type DatastoreGetResponse< item: DatastoreItem; }; +export type DatastoreBulkGetArgs< + Schema extends DatastoreSchema, +> = + & { + /** + * @description Primary keys of the items to retrieve + */ + // deno-lint-ignore no-explicit-any + ids: any[]; + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + } + & BaseMethodArgs; + +export type DatastoreBulkGetResponse< + Schema extends DatastoreSchema, +> = + & BaseResponse + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + /** + * @description The retreived items + */ + items: DatastoreItem[]; + /** + * @description Array of items that failed to be retreived + */ + failed_items: DatastoreItem[]; + }; + export type DatastoreQueryArgs< Schema extends DatastoreSchema, > = @@ -168,16 +233,56 @@ export type DatastoreDeleteResponse< datastore: Schema["name"]; }; +export type DatastoreBulkDeleteArgs< + Schema extends DatastoreSchema, +> = + & { + /** + * @description Primary keys of the items to delete + */ + // deno-lint-ignore no-explicit-any + ids: any[]; + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + } + & BaseMethodArgs; + +export type DatastoreBulkDeleteResponse< + Schema extends DatastoreSchema, +> = BaseResponse & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + /** + * @description Primary keys of the items that failed to be deleted + */ + // deno-lint-ignore no-explicit-any + ids: any[]; +}; + export type AppsDatastoreGet = { ( args: DatastoreGetArgs, ): Promise>; }; +export type AppsDatastoreBulkGet = { + ( + args: DatastoreBulkGetArgs, + ): Promise>; +}; export type AppsDatastorePut = { ( args: DatastorePutArgs, ): Promise>; }; +export type AppsDatastoreBulkPut = { + ( + args: DatastoreBulkPutArgs, + ): Promise>; +}; export type AppsDatastoreUpdate = { ( args: DatastoreUpdateArgs, @@ -193,6 +298,11 @@ export type AppsDatastoreDelete = { args: DatastoreDeleteArgs, ): Promise>; }; +export type AppsDatastoreBulkDelete = { + ( + args: DatastoreBulkDeleteArgs, + ): Promise>; +}; // apps.auth Types @@ -253,10 +363,13 @@ export type TypedAppsMethodTypes = { apps: { datastore: { get: AppsDatastoreGet; + bulkGet: AppsDatastoreBulkGet; put: AppsDatastorePut; + bulkPut: AppsDatastoreBulkPut; update: AppsDatastoreUpdate; query: AppsDatastoreQuery; delete: AppsDatastoreDelete; + bulkDelete: AppsDatastoreBulkDelete; }; auth: { external: { diff --git a/src/typed-method-types/mod.ts b/src/typed-method-types/mod.ts index e04e615..3c89b94 100644 --- a/src/typed-method-types/mod.ts +++ b/src/typed-method-types/mod.ts @@ -13,8 +13,11 @@ import { TypedWorkflowsMethodTypes } from "./workflows/mod.ts"; */ export const methodsWithCustomTypes = [ "apps.datastore.delete", + "apps.datastore.bulkDelete", "apps.datastore.get", + "apps.datastore.bulkGet", "apps.datastore.put", + "apps.datastore.bulkPut", "apps.datastore.update", "apps.datastore.query", "apps.auth.external.get", diff --git a/src/typed-method-types/typed-method-tests.ts b/src/typed-method-types/typed-method-tests.ts index a5d96ab..8fe867a 100644 --- a/src/typed-method-types/typed-method-tests.ts +++ b/src/typed-method-types/typed-method-tests.ts @@ -5,8 +5,11 @@ Deno.test("Custom Type Methods are valid functions", () => { const client = SlackAPI("test-token"); assertEquals(typeof client.apps.datastore.delete, "function"); + assertEquals(typeof client.apps.datastore.bulkDelete, "function"); assertEquals(typeof client.apps.datastore.get, "function"); + assertEquals(typeof client.apps.datastore.bulkGet, "function"); assertEquals(typeof client.apps.datastore.put, "function"); + assertEquals(typeof client.apps.datastore.bulkPut, "function"); assertEquals(typeof client.apps.datastore.update, "function"); assertEquals(typeof client.apps.datastore.query, "function"); assertEquals(typeof client.apps.auth.external.get, "function");