Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): type the batch cancel response as its own shape
Yudhi Armyndharis107e0c9bb6ce
diff --git a/dashboard/src/services/api.ts b/dashboard/src/services/api.tsindex b9176cc08..37362f55e 100644--- a/dashboard/src/services/api.ts+++ b/dashboard/src/services/api.ts@@ -538,7 +538,7 @@ export interface BatchMessageResult {sentAt?: string;}-/** GET batch/:batchId shape; the cancel endpoint returns the same minus results/timestamps. */+/** GET batch/:batchId shape. */export interface BatchStatusResponse {batchId: string;status: BatchStatus;@@ -549,6 +549,13 @@ export interface BatchStatusResponse {completedAt?: string | null;}+/** POST batch/:batchId/cancel shape: the batch state without per-recipient results or timestamps. */+export interface BatchCancelResponse {+ batchId: string;+ status: BatchStatus;+ progress: BatchProgress;+}+export interface HealthStatus {status: 'ok' | 'error';timestamp?: string;@@ -1127,7 +1134,7 @@ export const messageApi = {getBatchStatus: (sessionId: string, batchId: string) =>request<BatchStatusResponse>(`/sessions/${sessionId}/messages/batch/${encodeURIComponent(batchId)}`),cancelBatch: (sessionId: string, batchId: string) =>- request<BatchStatusResponse>(`/sessions/${sessionId}/messages/batch/${encodeURIComponent(batchId)}/cancel`, {+ request<BatchCancelResponse>(`/sessions/${sessionId}/messages/batch/${encodeURIComponent(batchId)}/cancel`, {method: 'POST',}),reply: (sessionId: string, data: { chatId: string; quotedMessageId: string; text: string }) =>diff --git a/scripts/check-contract-shapes.mjs b/scripts/check-contract-shapes.mjsindex daa546571..7e1f2834d 100644--- a/scripts/check-contract-shapes.mjs+++ b/scripts/check-contract-shapes.mjs@@ -145,6 +145,7 @@ const MAPPINGS = {'dashboard/src/services/api.ts': {AccountRestriction: 'AccountRestrictionDto',AuditLog: 'AuditLogDto',+ BatchCancelResponse: 'BatchCancelResponseDto',BatchMessageResult: 'BatchMessageResultDto',BatchProgress: 'BatchProgressDto',BatchStatusResponse: 'BatchStatusResponseDto',@@ -175,10 +176,10 @@ const MAPPINGS = {*/const MINIMUM_MAPPED = {'sdk/javascript/src/types.ts': 85,- 'dashboard/src/services/api.ts': 21,- 'sdk/python/openwa/types.py': 80,- 'sdk/go': 80,- 'sdk/java': 84,+ 'dashboard/src/services/api.ts': 22,+ 'sdk/python/openwa/types.py': 81,+ 'sdk/go': 81,+ 'sdk/java': 85,};/** Known drift, deliberately not gated yet — each line is a to-adjudicate follow-up. */@@ -216,6 +217,7 @@ const EXCLUDED = {const PYTHON_MAPPING = {AccountRestriction: 'AccountRestrictionDto',ArchiveChatRequest: 'ArchiveChatDto',+ BatchCancelResponse: 'BatchCancelResponseDto',BatchMessageResult: 'BatchMessageResultDto',BatchProgress: 'BatchProgressDto',BatchStatusResponse: 'BatchStatusResponseDto',@@ -300,6 +302,7 @@ const PYTHON_MAPPING = {const GO_MAPPING = {AccountRestriction: 'AccountRestrictionDto',ArchiveChatRequest: 'ArchiveChatDto',+ BatchCancelResponse: 'BatchCancelResponseDto',BatchMessageResult: 'BatchMessageResultDto',BatchProgress: 'BatchProgressDto',BatchStatusResponse: 'BatchStatusResponseDto',@@ -384,6 +387,7 @@ const GO_MAPPING = {const JAVA_MAPPING = {AccountRestriction: 'AccountRestrictionDto',ArchiveChatRequest: 'ArchiveChatDto',+ BatchCancelResponse: 'BatchCancelResponseDto',BatchMessageResult: 'BatchMessageResultDto',BatchProgress: 'BatchProgressDto',BatchStatusResponse: 'BatchStatusResponseDto',