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
2 changes: 2 additions & 0 deletions api/spec/packages/aip-client-javascript/src/funcs/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export function listApps(
): Promise<Result<ListAppsResponse>> {
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 @@ -194,6 +194,7 @@ export type {
LlmCostOverrideCreate,
ListCustomersParamsFilter,
ListSubscriptionsParamsFilter,
ListAppsParamsFilter,
ListFeatureParamsFilter,
ListAddonsParamsFilter,
CreateCreditGrantTaxConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { z } from 'zod'
import * as schemas from '../schemas.js'
import type { AppPagePaginatedResponse } from '../types.js'
import type {
AppPagePaginatedResponse,
ListAppsParamsFilter,
SortQueryInput,
} from '../types.js'

export interface ListAppsQuery {
/** Determines which page of the collection to retrieve. */
page?: { size?: number; number?: number }
/** Sort apps returned in the response. Supported sort attributes are: - `id` - `created_at` (default) 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 apps returned in the response. To filter apps by name add the following query param: filter[name]=my-app */
filter?: ListAppsParamsFilter
}

export type ListAppsRequest = ListAppsQuery
Expand Down
11 changes: 11 additions & 0 deletions api/spec/packages/aip-client-javascript/src/models/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2904,6 +2904,15 @@ export const listSubscriptionsParamsFilter = z
})
.describe('Filter options for listing subscriptions.')

export const listAppsParamsFilter = z
.object({
id: ulidFieldFilter.optional(),
name: stringFieldFilter.optional(),
type: stringFieldFilterExact.optional(),
status: stringFieldFilterExact.optional(),
})
.describe('Filter options for listing apps.')

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

export const listAppsResponse = z.object({
Expand Down
21 changes: 21 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 @@ -1745,6 +1745,27 @@ export interface ListSubscriptionsParamsFilter {
plan_key?: string | { eq?: string; oeq?: string[]; neq?: string }
}

/** Filter options for listing apps. */
export interface ListAppsParamsFilter {
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
}
type?: string | { eq?: string; oeq?: string[]; neq?: string }
status?: string | { eq?: string; oeq?: string[]; neq?: string }
}

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

namespace Apps;

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

interface AppsOperations {
/**
* List installed apps.
*/
@get
@operationId("list-apps")
@summary("List apps")
list(...Common.PagePaginationQuery):
| Shared.PagePaginatedResponse<App>
| Common.ErrorResponses;
list(
...Common.PagePaginationQuery,

/**
* Sort apps returned in the response. Supported sort attributes are:
*
* - `id`
* - `created_at` (default)
*
* 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 apps returned in the response.
*
* To filter apps by name add the following query param: filter[name]=my-app
*/
Comment thread
borosr marked this conversation as resolved.
@query(#{ style: "deepObject", explode: true })
filter?: ListAppsParamsFilter,
): Shared.PagePaginatedResponse<App> | Common.ErrorResponses;

/**
* Get an installed app.
Expand Down
Loading
Loading