| 228 | } |
| 229 | |
| 230 | async sendEvents(events: SendEvent[], options: SendEventOptions = {}) { |
| 231 | const apiKey = await this.#apiKey(); |
| 232 | |
| 233 | this.#logger.debug("Sending multiple events", { |
| 234 | events, |
| 235 | }); |
| 236 | |
| 237 | return await zodfetch(ApiEventLogSchema.array(), `${this.#apiUrl}/api/v1/events/bulk`, { |
| 238 | method: "POST", |
| 239 | headers: { |
| 240 | "Content-Type": "application/json", |
| 241 | Authorization: `Bearer ${apiKey}`, |
| 242 | }, |
| 243 | body: JSON.stringify({ events, options }), |
| 244 | }); |
| 245 | } |
| 246 | |
| 247 | async cancelEvent(eventId: string) { |
| 248 | const apiKey = await this.#apiKey(); |