File size: 6,970 Bytes
1477a90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
import "@typespec/http";
import "@typespec/openapi";
import "@typespec/openapi3";

using TypeSpec.OpenAPI;

namespace Common;

/**
 * Sort query.
 *
 * The `asc` suffix is optional as the default sort order is ascending. The `desc`
 * suffix is used to specify a descending order.
 */
@useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/SortQuery")
@friendlyName("SortQuery")
model SortQuery {
  /**
   * The attribute to sort by.
   */
  by: string;

  /**
   * The sort order. `asc` for ascending, `desc` for descending.
   */
  order?: "asc" | "desc" = "asc";
}

/**
 * Filter by a boolean value (true/false).
 */
@friendlyName("BooleanFieldFilter")
@extension("x-go-type", "filters.FilterBoolean")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("Boolean Field Filter")
union BooleanFieldFilter {
  equals: boolean,
  object: {
    /**
     * Value strictly equals the given boolean value.
     */
    eq: boolean,
  },
}

/**
 * Filter by a numeric value. All properties are optional; provide exactly one to
 * specify the comparison.
 */
@friendlyName("NumericFieldFilter")
@extension("x-go-type", "filters.FilterNumeric")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("Numeric Field Filter")
union NumericFieldFilter {
  equals: float64,
  object: {
    /**
     * Value strictly equals the given numeric value.
     */
    eq?: float64,

    /**
     * Value does not equal the given numeric value.
     */
    neq?: float64,

    /**
     * Returns entities that match any of the comma-delimited numeric values.
     */
    @encode(ArrayEncoding.commaDelimited)
    oeq?: float64[],

    /**
     * Value is less than the given numeric value.
     */
    lt?: float64,

    /**
     * Value is less than or equal to the given numeric value.
     */
    lte?: float64,

    /**
     * Value is greater than the given numeric value.
     */
    gt?: float64,

    /**
     * Value is greater than or equal to the given numeric value.
     */
    gte?: float64,
  },
}

/**
 * Filters on the given string field value by either exact or fuzzy match. All
 * properties are optional; provide exactly one to specify the comparison.
 */
@friendlyName("StringFieldFilter")
@extension("x-go-type", "filters.FilterString")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
union StringFieldFilter {
  equals: string,
  object: {
    /**
     * Value strictly equals the given string value.
     */
    eq?: string,

    /**
     * Value does not equal the given string value.
     */
    neq?: string,

    /**
     * Value contains the given string value (fuzzy match).
     */
    contains?: string,

    /**
     * Returns entities that fuzzy-match any of the comma-delimited phrases in the
     * filter string.
     */
    @encode(ArrayEncoding.commaDelimited)
    ocontains?: string[],

    /**
     * Returns entities that exact match any of the comma-delimited phrases in the
     * filter string.
     */
    @encode(ArrayEncoding.commaDelimited)
    oeq?: string[],

    /**
     * Value is greater than the given string value (lexicographic compare).
     */
    gt?: string,

    /**
     * Value is greater than or equal to the given string value (lexicographic
     * compare).
     */
    gte?: string,

    /**
     * Value is less than the given string value (lexicographic compare).
     */
    lt?: string,

    /**
     * Value is less than or equal to the given string value (lexicographic compare).
     */
    lte?: string,

    /**
     * When true, the field must be present (non-null); when false, the field must be
     * absent (null).
     */
    exists?: boolean,
  },
}

/**
 * Filters on the given string field value by exact match. All properties are
 * optional; provide exactly one to specify the comparison.
 */
@friendlyName("StringFieldFilterExact")
@extension("x-go-type", "filters.FilterStringExact")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("String Field Filter Exact")
union StringFieldFilterExact {
  equals: string,
  object: {
    /**
     * Value strictly equals the given string value.
     */
    eq?: string,

    /**
     * Returns entities that exact match any of the comma-delimited phrases in the
     * filter string.
     */
    @encode(ArrayEncoding.commaDelimited)
    oeq?: string[],

    /**
     * Value does not equal the given string value.
     */
    neq?: string,
  },
}

/**
 * Filters on the given ULID field value by exact match. All properties are
 * optional; provide exactly one to specify the comparison.
 */
@friendlyName("ULIDFieldFilter")
@extension("x-go-type", "filters.FilterULID")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("ULID Field Filter")
union ULIDFieldFilter {
  equals: Shared.ULID,
  object: {
    /**
     * Value strictly equals the given ULID value.
     */
    eq?: Shared.ULID,

    /**
     * Returns entities that exact match any of the comma-delimited ULIDs in the filter
     * string.
     */
    @encode(ArrayEncoding.commaDelimited)
    oeq?: Shared.ULID[],

    /**
     * Value does not equal the given ULID value.
     */
    neq?: Shared.ULID,
  },
}

/**
 * Filters on the given datetime (RFC-3339) field value. All properties are
 * optional; provide exactly one to specify the comparison.
 */
@friendlyName("DateTimeFieldFilter")
@extension("x-go-type", "filters.FilterDateTime")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("DateTime Field Filter")
union DateTimeFieldFilter {
  equals: Shared.DateTime,
  object: {
    /**
     * Value strictly equals given RFC-3339 formatted timestamp in UTC.
     */
    eq?: Shared.DateTime,

    /**
     * Value is less than the given RFC-3339 formatted timestamp in UTC.
     */
    lt?: Shared.DateTime,

    /**
     * Value is less than or equal to the given RFC-3339 formatted timestamp in UTC.
     */
    lte?: Shared.DateTime,

    /**
     * Value is greater than the given RFC-3339 formatted timestamp in UTC.
     */
    gt?: Shared.DateTime,

    /**
     * Value is greater than or equal to the given RFC-3339 formatted timestamp in UTC.
     */
    gte?: Shared.DateTime,
  },
}

/**
 * Filters on the resource's `labels` field.
 *
 * The schema is a map keyed by the label name; each value is a
 * `StringFieldFilter`. Both deepObject forms are accepted:
 * `filter[labels][key]=value` (nested) and `filter[labels.key]=value`
 * (dot-notation).
 */
@friendlyName("LabelsFieldFilter")
@extension("x-go-type", "filters.FilterLabels")
@extension(
  "x-go-type-import",
  #{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
)
@summary("Labels Field Filter")
model LabelsFieldFilter is Record<StringFieldFilter>;