()
| 104 | } |
| 105 | |
| 106 | async whoami(): Promise<WhoamiResponse | undefined> { |
| 107 | const response = await fetch(`${this.baseUrl}/api/v1/whoami`, { |
| 108 | method: "GET", |
| 109 | headers: { |
| 110 | Accept: "application/json", |
| 111 | Authorization: `Bearer ${this.apiKey}`, |
| 112 | }, |
| 113 | }); |
| 114 | |
| 115 | if (response.ok) { |
| 116 | const body = await response.json(); |
| 117 | |
| 118 | const parsed = WhoamiResponseSchema.safeParse(body); |
| 119 | |
| 120 | if (parsed.success) { |
| 121 | return parsed.data; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | async sendEvent(id: string, name: string, payload: any) { |
| 129 | const response = await fetch(`${this.baseUrl}/api/v1/events`, { |
no test coverage detected