// 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 { toURLSearchParams } from '../lib/encodings.js' import { toWire, fromWire, assertValid } from '../lib/wire.js' import * as schemas from '../models/schemas.js' import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse, } from '../models/operations/governance.js' /** * Query governance access * * Query feature access for a list of customers. * * The endpoint resolves each provided identifier to a customer and returns the * access status for the requested features, plus optional credit balance * availability. * * _Designed to be called on a fixed refresh interval and the query response is * intended to be cached._ * * POST /openmeter/governance/query */ export function queryGovernanceAccess( client: Client, req: QueryGovernanceAccessRequest, options?: RequestOptions, ): Promise> { return request(() => { const body = toWire(req.body, schemas.queryGovernanceAccessBody) if (client._options.validate) { assertValid(schemas.queryGovernanceAccessBodyWire, body) } const query = toWire( { page: req.page, }, schemas.queryGovernanceAccessQueryParams, ) if (client._options.validate) { assertValid(schemas.queryGovernanceAccessQueryParamsWire, query) } const searchParams = toURLSearchParams(query) return http(client) .post('openmeter/governance/query', { ...options, searchParams, json: body, }) .json() .then((data) => { if (client._options.validate) { assertValid(schemas.queryGovernanceAccessResponseWire, data) } return fromWire(data, schemas.queryGovernanceAccessResponse) }) }) }