fix: use patch for calendar slot agent updates

This commit is contained in:
2026-04-04 18:29:50 +00:00
parent 7f86073fe7
commit b81125db0d

View File

@@ -107,7 +107,7 @@ export class CalendarBridgeClient {
*/ */
async updateSlot(slotId: number, update: SlotAgentUpdate): Promise<boolean> { async updateSlot(slotId: number, update: SlotAgentUpdate): Promise<boolean> {
const url = `${this.baseUrl}/calendar/slots/${slotId}/agent-update`; 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, claw_identifier: this.config.clawIdentifier,
...params, ...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<boolean> { private async sendBoolean(method: 'POST' | 'PATCH', url: string, body: unknown): Promise<boolean> {
const controller = new AbortController(); const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), this.timeoutMs); const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
try { try {
const response = await fetch(url, { const response = await fetch(url, {
method: 'POST', method,
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-Agent-ID': this.config.agentId, 'X-Agent-ID': this.config.agentId,