const resp = yield* HttpClientRequest.get(
"https://www.googleapis.com/calendar/v3/users/me/calendarList",
).pipe(
HttpClientRequest.bearerToken(accessToken),
httpClient.execute,
Effect.andThen(HttpClientResponse.schemaBodyJson(S.Union(GoogleApiError, S.Any))),
Effect.scoped,
);
const isError = S.is(GoogleApiError);
if (isError(resp)) {
return yield* Effect.fail(new GoogleAccessTokenExpired({ expiredAccessToken: accessToken }));
}
const resp = yield* HttpClientRequest.get(
"https://www.googleapis.com/calendar/v3/users/me/calendarList",
).pipe(
HttpClientRequest.bearerToken(accessToken),
httpClient.execute,
Effect.andThen(HttpClientResponse.schemaBodyJson(S.Union(GoogleApiError, S.Any))),
Effect.scoped,
);
const isError = S.is(GoogleApiError);
if (isError(resp)) {
return yield* Effect.fail(new GoogleAccessTokenExpired({ expiredAccessToken: accessToken }));
}