Wrapping Promise-based API Clients into Effect Services in TypeScript

Does anyone have a good pattern for wrapping promise-based API clients into Effect services?

import { LinearClient } from "@linear/sdk";
import { Config, Effect } from "effect";

export class Linear extends Effect.Service<Linear>()("Linear", {
  effect: Effect.gen(function* () {
    const apiKey = yield* Config.string("LINEAR_API_KEY");
    const client = new LinearClient({
      apiKey: apiKey,
    });

    return client;
  }),
}) {}

This will generate a Linear client, but I'd like to convert all the client's methods to Effect.Effect<A, LinearError, never>. I tried mapping over Object.entries(client) but struggled with types and such. Just curious if anyone has an existing pattern they like? Or if there is an Effect.effectify for this use case?
Was this page helpful?