| 211 | } |
| 212 | |
| 213 | async sendEvent(event: SendEvent, options: SendEventOptions = {}) { |
| 214 | const apiKey = await this.#apiKey(); |
| 215 | |
| 216 | this.#logger.debug("Sending event", { |
| 217 | event, |
| 218 | }); |
| 219 | |
| 220 | return await zodfetch(ApiEventLogSchema, `${this.#apiUrl}/api/v1/events`, { |
| 221 | method: "POST", |
| 222 | headers: { |
| 223 | "Content-Type": "application/json", |
| 224 | Authorization: `Bearer ${apiKey}`, |
| 225 | }, |
| 226 | body: JSON.stringify({ event, options }), |
| 227 | }); |
| 228 | } |
| 229 | |
| 230 | async sendEvents(events: SendEvent[], options: SendEventOptions = {}) { |
| 231 | const apiKey = await this.#apiKey(); |