Leon4gr45's picture
Upload folder using huggingface_hub (part 2)
1477a90 verified
Raw
History Blame Contribute Delete
2.98 kB
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
import { type Client } from '../core.js'
import { unwrap, type RequestOptions } from '../lib/types.js'
import { paginatePages } from '../lib/paginate.js'
import {
listPlanAddons,
createPlanAddon,
getPlanAddon,
updatePlanAddon,
deletePlanAddon,
} from '../funcs/planAddons.js'
import type {
ListPlanAddonsRequest,
ListPlanAddonsResponse,
CreatePlanAddonRequest,
CreatePlanAddonResponse,
GetPlanAddonRequest,
GetPlanAddonResponse,
UpdatePlanAddonRequest,
UpdatePlanAddonResponse,
DeletePlanAddonRequest,
DeletePlanAddonResponse,
} from '../models/operations/planAddons.js'
import type { PlanAddon } from '../models/types.js'
export class PlanAddons {
constructor(private readonly _client: Client) {}
/**
* List add-ons for plan
*
* List add-ons associated with a plan.
*
* GET /openmeter/plans/{planId}/addons
*/
async list(
request: ListPlanAddonsRequest,
options?: RequestOptions,
): Promise<ListPlanAddonsResponse> {
return unwrap(await listPlanAddons(this._client, request, options))
}
/**
* List add-ons for plan
*
* List add-ons associated with a plan.
*
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
*
* GET /openmeter/plans/{planId}/addons
*/
listAll(
request: ListPlanAddonsRequest,
options?: RequestOptions,
): AsyncIterable<PlanAddon> {
return paginatePages(
(req, opts) => listPlanAddons(this._client, req, opts),
request,
options,
)
}
/**
* Add add-on to plan
*
* Add an add-on to a plan.
*
* POST /openmeter/plans/{planId}/addons
*/
async create(
request: CreatePlanAddonRequest,
options?: RequestOptions,
): Promise<CreatePlanAddonResponse> {
return unwrap(await createPlanAddon(this._client, request, options))
}
/**
* Get add-on association for plan
*
* Get an add-on association for a plan.
*
* GET /openmeter/plans/{planId}/addons/{planAddonId}
*/
async get(
request: GetPlanAddonRequest,
options?: RequestOptions,
): Promise<GetPlanAddonResponse> {
return unwrap(await getPlanAddon(this._client, request, options))
}
/**
* Update add-on association for plan
*
* Update an add-on association for a plan.
*
* PUT /openmeter/plans/{planId}/addons/{planAddonId}
*/
async update(
request: UpdatePlanAddonRequest,
options?: RequestOptions,
): Promise<UpdatePlanAddonResponse> {
return unwrap(await updatePlanAddon(this._client, request, options))
}
/**
* Remove add-on from plan
*
* Remove an add-on from a plan.
*
* DELETE /openmeter/plans/{planId}/addons/{planAddonId}
*/
async delete(
request: DeletePlanAddonRequest,
options?: RequestOptions,
): Promise<DeletePlanAddonResponse> {
return unwrap(await deletePlanAddon(this._client, request, options))
}
}