Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export function listBillingProfiles(
): Promise<Result<ListBillingProfilesResponse>> {
const searchParams = toURLSearchParams({
page: req.page,
sort: encodeSort(req.sort),
filter: req.filter,
})
return request(() =>
http(client)
Expand Down
1 change: 1 addition & 0 deletions api/spec/packages/aip-client-javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export type {
LlmCostOverrideCreate,
ListCustomersParamsFilter,
ListSubscriptionsParamsFilter,
ListBillingProfilesParamsFilter,
ListFeatureParamsFilter,
ListAddonsParamsFilter,
CreateCreditGrantTaxConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import { z } from 'zod'
import * as schemas from '../schemas.js'
import type {
CreateBillingProfileRequestInput,
ListBillingProfilesParamsFilter,
Profile,
ProfilePagePaginatedResponse,
SortQueryInput,
UpsertBillingProfileRequestInput,
} from '../types.js'

export interface ListBillingProfilesQuery {
/** Determines which page of the collection to retrieve. */
page?: { size?: number; number?: number }
/** Sort billing profiles returned in the response. Supported sort attributes are: - `id` - `name` - `createdAt` (default) - `updatedAt` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order. */
sort?: SortQueryInput
/** Filter billing profiles returned in the response. To filter billing profiles by name add the following query param: filter[name][eq]=my-profile */
filter?: ListBillingProfilesParamsFilter
}

export type ListBillingProfilesRequest = ListBillingProfilesQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,13 @@ export const listSubscriptionsParamsFilter = z
})
.describe('Filter options for listing subscriptions.')

export const listBillingProfilesParamsFilter = z
.object({
id: ulidFieldFilter.optional(),
name: stringFieldFilter.optional(),
})
.describe('Filter options for listing billing profiles.')

export const listFeatureParamsFilter = z
.object({
meter_id: ulidFieldFilter.optional(),
Expand Down Expand Up @@ -4941,6 +4948,8 @@ export const listBillingProfilesQueryParams = z.object({
})
.optional()
.describe('Determines which page of the collection to retrieve.'),
sort: sortQuery.optional(),
filter: listBillingProfilesParamsFilter.optional(),
})

export const listBillingProfilesResponse = z.object({
Expand Down
19 changes: 19 additions & 0 deletions api/spec/packages/aip-client-javascript/src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,25 @@ export interface ListSubscriptionsParamsFilter {
plan_key?: string | { eq?: string; oeq?: string[]; neq?: string }
}

/** Filter options for listing billing profiles. */
export interface ListBillingProfilesParamsFilter {
id?: string | { eq?: string; oeq?: string[]; neq?: string }
name?:
| string
| {
eq?: string
neq?: string
contains?: string
ocontains?: string[]
oeq?: string[]
gt?: string
gte?: string
lt?: string
lte?: string
exists?: boolean
}
}

/** Filter options for listing features. */
export interface ListFeatureParamsFilter {
meter_id?: string | { eq?: string; oeq?: string[]; neq?: string }
Expand Down
40 changes: 37 additions & 3 deletions api/spec/packages/aip/src/billing/operations.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,50 @@ using TypeSpec.OpenAPI;

namespace Billing;

/**
* Filter options for listing billing profiles.
*/
@friendlyName("ListBillingProfilesParamsFilter")
model ListBillingProfilesParamsFilter {
#suppress "@openmeter/api-spec-aip/doc-decorator" "filter field"
id?: Common.ULIDFieldFilter;
#suppress "@openmeter/api-spec-aip/doc-decorator" "filter field"
name?: Common.StringFieldFilter;
}

interface BillingProfilesOperations {
/**
* List billing profiles.
*/
@get
@operationId("list-billing-profiles")
@summary("List billing profiles")
list(...Common.PagePaginationQuery):
| Shared.PagePaginatedResponse<BillingProfile>
| Common.ErrorResponses;
list(
...Common.PagePaginationQuery,

/**
* Sort billing profiles returned in the response. Supported sort attributes are:
*
* - `id`
* - `name`
* - `createdAt` (default)
* - `updatedAt`
*
* The `asc` suffix is optional as the default sort order is ascending. The `desc`
* suffix is used to specify a descending order.
*/
@query(#{ name: "sort" })
sort?: Common.SortQuery,

/**
* Filter billing profiles returned in the response.
*
* To filter billing profiles by name add the following query param:
* filter[name][eq]=my-profile
*/
@query(#{ style: "deepObject", explode: true })
filter?: ListBillingProfilesParamsFilter,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
): Shared.PagePaginatedResponse<BillingProfile> | Common.ErrorResponses;

/**
* Create a new billing profile.
Expand Down
Loading
Loading