File size: 1,791 Bytes
1477a90 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
import { type Client, http } from '../core.js'
import { type Result, type RequestOptions } from '../lib/types.js'
import { request } from '../lib/request.js'
import { toPathWire, fromWire, assertValid } from '../lib/wire.js'
import * as schemas from '../models/schemas.js'
import type {
ListCustomerEntitlementAccessRequest,
ListCustomerEntitlementAccessResponse,
} from '../models/operations/entitlements.js'
/**
* List customer entitlement access
*
* GET /openmeter/customers/{customerId}/entitlement-access
*/
export function listCustomerEntitlementAccess(
client: Client,
req: ListCustomerEntitlementAccessRequest,
options?: RequestOptions,
): Promise<Result<ListCustomerEntitlementAccessResponse>> {
return request(() => {
const pathParamsInput = {
customerId: req.customerId,
}
const pathParams = client._options.validate
? toPathWire(
pathParamsInput,
schemas.listCustomerEntitlementAccessPathParams,
)
: pathParamsInput
if (client._options.validate) {
assertValid(
schemas.listCustomerEntitlementAccessPathParamsWire,
pathParams,
)
}
const path = `openmeter/customers/${(() => {
if (pathParams.customerId === undefined) {
throw new Error('missing path parameter: customerId')
}
return encodeURIComponent(String(pathParams.customerId))
})()}/entitlement-access`
return http(client)
.get(path, options)
.json()
.then((data) => {
if (client._options.validate) {
assertValid(schemas.listCustomerEntitlementAccessResponseWire, data)
}
return fromWire(data, schemas.listCustomerEntitlementAccessResponse)
})
})
}
|