Leon4gr45's picture
Upload folder using huggingface_hub (part 2)
1477a90 verified
Raw
History Blame Contribute Delete
1.79 kB
// 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)
})
})
}