export type RepositoryKindParam = 'helm' | 'opa' | 'falco' | 'olm' | 'tbaction' | 'krew' | 'helm-plugin' | 'tekton-task' | 'keda-scaler' | 'coredns' | 'keptn' | 'tekton-pipeline' | 'container' | 'kubewarden' | 'gatekeeper' | 'kyverno' | 'knative-client-plugin' | 'backstage' | 'argo-template' | 'kubearmor' | 'kcl' | 'headlamp' | 'inspektor-gadget' | 'tekton-stepaction' | 'meshery' | 'opencost' | 'radius' | 'bootc' | 'kagent'; export type GetApiPackagesRepoKindParamRepoNamePackageNameProductionUsageArgs = {repoKindParam: RepositoryKindParam, repoName: string, packageName: string}; export type GetApiPackagesRepoKindParamRepoNamePackageNameProductionUsageOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get a summary of which of the organizations the user belongs to are using the package in production * * GET /packages/{repoKindParam}/{repoName}/{packageName}/production-usage */ export const getApiPackagesRepoKindParamRepoNamePackageNameProductionUsage = async (args: GetApiPackagesRepoKindParamRepoNamePackageNameProductionUsageArgs, options: GetApiPackagesRepoKindParamRepoNamePackageNameProductionUsageOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/markdown") const url = `${baseUrl.replace(/\/+$/, '')}/packages/${encodeURIComponent(String(args.repoKindParam))}/${encodeURIComponent(String(args.repoName))}/${encodeURIComponent(String(args.packageName))}/production-usage${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };