Effect.gen(function*() {
const xero = yield* Xero
const tentantId = yield* Config.string("XERO_TENANT_ID")
const result = yield* xero.use((client) =>
client.accountingApi.getInvoices(tentantId)
)
yield* Effect.log(result.body.invoices)
}).pipe(
Effect.provide(
Layer.mergeAll(
Xero.Default.pipe(
Layer.provide(
TokenSetStorage.Default.pipe(
Layer.provide(KeyValueStore.layerFileSystem(".kv").pipe(
Layer.provide(NodeContext.layer)
))
)
)
),
PlatformConfigProvider.fromDotEnv(".env").pipe(
Effect.map(Layer.setConfigProvider),
Layer.unwrapEffect
).pipe(
Layer.provide(NodeContext.layer)
)
)
),
NodeRuntime.runMain
)
Effect.gen(function*() {
const xero = yield* Xero
const tentantId = yield* Config.string("XERO_TENANT_ID")
const result = yield* xero.use((client) =>
client.accountingApi.getInvoices(tentantId)
)
yield* Effect.log(result.body.invoices)
}).pipe(
Effect.provide(
Layer.mergeAll(
Xero.Default.pipe(
Layer.provide(
TokenSetStorage.Default.pipe(
Layer.provide(KeyValueStore.layerFileSystem(".kv").pipe(
Layer.provide(NodeContext.layer)
))
)
)
),
PlatformConfigProvider.fromDotEnv(".env").pipe(
Effect.map(Layer.setConfigProvider),
Layer.unwrapEffect
).pipe(
Layer.provide(NodeContext.layer)
)
)
),
NodeRuntime.runMain
)