diff --git a/src/typed-method-types/apps.ts b/src/typed-method-types/apps.ts index 3a023fc..f69431d 100644 --- a/src/typed-method-types/apps.ts +++ b/src/typed-method-types/apps.ts @@ -208,6 +208,35 @@ export type DatastoreQueryResponse< items: DatastoreItem[]; }; +export type DatastoreCountArgs< + Schema extends DatastoreSchema, +> = + & BaseMethodArgs + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + expression?: string; + "expression_attributes"?: Record; + "expression_values"?: Record; + }; + +export type DatastoreCountResponse< + Schema extends DatastoreSchema, +> = + & BaseResponse + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + /** + * @description The number of items matching your query + */ + count: number; + }; + export type DatastoreDeleteArgs< Schema extends DatastoreSchema, > = @@ -293,6 +322,11 @@ export type AppsDatastoreQuery = { args: DatastoreQueryArgs, ): Promise>; }; +export type AppsDatastoreCount = { + ( + args: DatastoreCountArgs, + ): Promise>; +}; export type AppsDatastoreDelete = { ( args: DatastoreDeleteArgs, @@ -368,6 +402,7 @@ export type TypedAppsMethodTypes = { bulkPut: AppsDatastoreBulkPut; update: AppsDatastoreUpdate; query: AppsDatastoreQuery; + count: AppsDatastoreCount; delete: AppsDatastoreDelete; bulkDelete: AppsDatastoreBulkDelete; }; diff --git a/src/typed-method-types/mod.ts b/src/typed-method-types/mod.ts index 3c89b94..c01f3b3 100644 --- a/src/typed-method-types/mod.ts +++ b/src/typed-method-types/mod.ts @@ -20,6 +20,7 @@ export const methodsWithCustomTypes = [ "apps.datastore.bulkPut", "apps.datastore.update", "apps.datastore.query", + "apps.datastore.count", "apps.auth.external.get", "apps.auth.external.delete", "chat.postMessage", diff --git a/src/typed-method-types/typed-method-tests.ts b/src/typed-method-types/typed-method-tests.ts index 8fe867a..ee6ac9f 100644 --- a/src/typed-method-types/typed-method-tests.ts +++ b/src/typed-method-types/typed-method-tests.ts @@ -12,6 +12,7 @@ Deno.test("Custom Type Methods are valid functions", () => { 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.datastore.count, "function"); assertEquals(typeof client.apps.auth.external.get, "function"); assertEquals(typeof client.apps.auth.external.delete, "function"); assertEquals(typeof client.workflows.triggers.create, "function");