diff --git a/src/typed-method-types/apps.ts b/src/typed-method-types/apps.ts index 3a023fc..0e4f836 100644 --- a/src/typed-method-types/apps.ts +++ b/src/typed-method-types/apps.ts @@ -6,6 +6,22 @@ import { } from "../types.ts"; // apps.datastore Types +type DynamoQueryArgs = { + /** + * @description A query filter expression + * @see {@link https://api.slack.com/automation/datastores-retrieve#filter-expressions}. + */ + expression?: string; + /** + * @description A map of attributes referenced in `expression` + */ + "expression_attributes"?: Record; + /** + * @description A map of values referenced in `expression` + */ + "expression_values"?: Record; +}; + export type DatastoreSchema = { name: string; // deno-lint-ignore no-explicit-any @@ -182,14 +198,12 @@ export type DatastoreQueryArgs< > = & BaseMethodArgs & CursorPaginationArgs + & DynamoQueryArgs & { /** * @description The name of the datastore */ datastore: Schema["name"]; - expression?: string; - "expression_attributes"?: Record; - "expression_values"?: Record; }; export type DatastoreQueryResponse< @@ -208,6 +222,33 @@ export type DatastoreQueryResponse< items: DatastoreItem[]; }; +export type DatastoreCountArgs< + Schema extends DatastoreSchema, +> = + & BaseMethodArgs + & DynamoQueryArgs + & { + /** + * @description The name of the datastore + */ + datastore: Schema["name"]; + }; + +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 +334,11 @@ export type AppsDatastoreQuery = { args: DatastoreQueryArgs, ): Promise>; }; +export type AppsDatastoreCount = { + ( + args: DatastoreCountArgs, + ): Promise>; +}; export type AppsDatastoreDelete = { ( args: DatastoreDeleteArgs, @@ -368,6 +414,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");