Skip to content

Commit

Permalink
feat: add filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tothandras committed Mar 9, 2025
1 parent c73a71a commit 83bdbd5
Show file tree
Hide file tree
Showing 6 changed files with 2,348 additions and 824 deletions.
1,753 changes: 929 additions & 824 deletions api/api.gen.go

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10856,6 +10856,168 @@ components:
$ref: '#/components/schemas/Feature'
description: The items in the current page.
description: Paginated response
FilterBoolean:
type: object
properties:
$eq:
type: boolean
nullable: true
description: The field must be equal to the provided value.
description: A filter for a boolean field.
FilterFloat:
type: object
properties:
$eq:
type: number
format: double
nullable: true
description: The field must be equal to the provided value.
$ne:
type: number
format: double
nullable: true
description: The field must not be equal to the provided value.
$gt:
type: number
format: double
nullable: true
description: The field must be greater than the provided value.
$gte:
type: number
format: double
nullable: true
description: The field must be greater than or equal to the provided value.
$lt:
type: number
format: double
nullable: true
description: The field must be less than the provided value.
$lte:
type: number
format: double
nullable: true
description: The field must be less than or equal to the provided value.
$and:
type: array
items:
$ref: '#/components/schemas/FilterFloat'
nullable: true
description: Provide a list of filters to be combined with a logical AND.
$or:
type: array
items:
$ref: '#/components/schemas/FilterFloat'
nullable: true
description: Provide a list of filters to be combined with a logical OR.
description: A filter for a float field.
FilterInteger:
type: object
properties:
$eq:
type: integer
nullable: true
description: The field must be equal to the provided value.
$ne:
type: integer
nullable: true
description: The field must not be equal to the provided value.
$gt:
type: integer
nullable: true
description: The field must be greater than the provided value.
$gte:
type: integer
nullable: true
description: The field must be greater than or equal to the provided value.
$lt:
type: integer
nullable: true
description: The field must be less than the provided value.
$lte:
type: integer
nullable: true
description: The field must be less than or equal to the provided value.
$and:
type: array
items:
$ref: '#/components/schemas/FilterInteger'
nullable: true
description: Provide a list of filters to be combined with a logical AND.
$or:
type: array
items:
$ref: '#/components/schemas/FilterInteger'
nullable: true
description: Provide a list of filters to be combined with a logical OR.
description: A filter for an integer field.
FilterString:
type: object
properties:
$eq:
type: string
nullable: true
description: The field must be equal to the provided value.
$ne:
type: string
nullable: true
description: The field must not be equal to the provided value.
$in:
type: array
items:
type: string
nullable: true
description: The field must be in the provided list of values.
$nin:
type: array
items:
type: string
nullable: true
description: The field must not be in the provided list of values.
$like:
type: string
nullable: true
description: The field must match the provided value.
$nlike:
type: string
nullable: true
description: The field must not match the provided value.
$ilike:
type: string
nullable: true
description: The field must match the provided value, ignoring case.
$nilike:
type: string
nullable: true
description: The field must not match the provided value, ignoring case.
$gt:
type: string
nullable: true
description: The field must be greater than the provided value.
$gte:
type: string
nullable: true
description: The field must be greater than or equal to the provided value.
$lt:
type: string
nullable: true
description: The field must be less than the provided value.
$lte:
type: string
nullable: true
description: The field must be less than or equal to the provided value.
$and:
type: array
items:
$ref: '#/components/schemas/FilterString'
nullable: true
description: Provide a list of filters to be combined with a logical AND.
$or:
type: array
items:
$ref: '#/components/schemas/FilterString'
nullable: true
description: Provide a list of filters to be combined with a logical OR.
description: A filter for a string field.
FlatPrice:
type: object
required:
Expand Down
184 changes: 184 additions & 0 deletions api/spec/src/filter.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
import "@typespec/openapi3";

using TypeSpec.OpenAPI;

namespace OpenMeter;

/**
* A filter for a string field.
*/
@friendlyName("FilterString")
model FilterString {
/**
* The field must be equal to the provided value.
*/
$eq?: string | null;

/**
* The field must not be equal to the provided value.
*/
$ne?: string | null;

/**
* The field must be in the provided list of values.
*/
$in?: string[] | null;

/**
* The field must not be in the provided list of values.
*/
$nin?: string[] | null;

/**
* The field must match the provided value.
*/
$like?: string | null;

/**
* The field must not match the provided value.
*/
$nlike?: string | null;

/**
* The field must match the provided value, ignoring case.
*/
$ilike?: string | null;

/**
* The field must not match the provided value, ignoring case.
*/
$nilike?: string | null;

/**
* The field must be greater than the provided value.
*/
$gt?: string | null;

/**
* The field must be greater than or equal to the provided value.
*/
$gte?: string | null;

/**
* The field must be less than the provided value.
*/
$lt?: string | null;

/**
* The field must be less than or equal to the provided value.
*/
$lte?: string | null;

/**
* Provide a list of filters to be combined with a logical AND.
*/
$and?: FilterString[] | null;

/**
* Provide a list of filters to be combined with a logical OR.
*/
$or?: FilterString[] | null;
}

/**
* A filter for an integer field.
*/
@friendlyName("FilterInteger")
model FilterInteger {
/**
* The field must be equal to the provided value.
*/
$eq?: integer | null;

/**
* The field must not be equal to the provided value.
*/
$ne?: integer | null;

/**
* The field must be greater than the provided value.
*/
$gt?: integer | null;

/**
* The field must be greater than or equal to the provided value.
*/
$gte?: integer | null;

/**
* The field must be less than the provided value.
*/
$lt?: integer | null;

/**
* The field must be less than or equal to the provided value.
*/
$lte?: integer | null;

/**
* Provide a list of filters to be combined with a logical AND.
*/
$and?: FilterInteger[] | null;

/**
* Provide a list of filters to be combined with a logical OR.
*/
$or?: FilterInteger[] | null;
}

/**
* A filter for a float field.
*/
@friendlyName("FilterFloat")
model FilterFloat {
/**
* The field must be equal to the provided value.
*/
$eq?: float64 | null;

/**
* The field must not be equal to the provided value.
*/
$ne?: float64 | null;

/**
* The field must be greater than the provided value.
*/
$gt?: float64 | null;

/**
* The field must be greater than or equal to the provided value.
*/
$gte?: float64 | null;

/**
* The field must be less than the provided value.
*/
$lt?: float64 | null;

/**
* The field must be less than or equal to the provided value.
*/
$lte?: float64 | null;

/**
* Provide a list of filters to be combined with a logical AND.
*/
$and?: FilterFloat[] | null;

/**
* Provide a list of filters to be combined with a logical OR.
*/
$or?: FilterFloat[] | null;
}

/**
* A filter for a boolean field.
*/
@friendlyName("FilterBoolean")
model FilterBoolean {
/**
* The field must be equal to the provided value.
*/
$eq?: boolean | null;
}
1 change: 1 addition & 0 deletions api/spec/src/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "@typespec/versioning";
import "./auth.tsp";
import "./errors.tsp";
import "./types.tsp";
import "./filter.tsp";

import "./app";
import "./query.tsp";
Expand Down
Loading

0 comments on commit 83bdbd5

Please sign in to comment.