diff --git a/plugin/calendar/calendar-bridge.ts b/plugin/calendar/calendar-bridge.ts index 213e897..dca5cf5 100644 --- a/plugin/calendar/calendar-bridge.ts +++ b/plugin/calendar/calendar-bridge.ts @@ -107,7 +107,7 @@ export class CalendarBridgeClient { */ async updateSlot(slotId: number, update: SlotAgentUpdate): Promise { const url = `${this.baseUrl}/calendar/slots/${slotId}/agent-update`; - return this.postBoolean(url, update); + return this.sendBoolean('PATCH', url, update); } /** @@ -166,7 +166,7 @@ export class CalendarBridgeClient { claw_identifier: this.config.clawIdentifier, ...params, }; - return this.postBoolean(url, body); + return this.sendBoolean('POST', url, body); } // ------------------------------------------------------------------------- @@ -195,13 +195,13 @@ export class CalendarBridgeClient { } } - private async postBoolean(url: string, body: unknown): Promise { + private async sendBoolean(method: 'POST' | 'PATCH', url: string, body: unknown): Promise { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), this.timeoutMs); try { const response = await fetch(url, { - method: 'POST', + method, headers: { 'Content-Type': 'application/json', 'X-Agent-ID': this.config.agentId,