Oddity
|
Represents a query builder used to retrieve data with filters specified by the user. More...
Public Member Functions | |
QueryBuilder (OddityCore context, CacheService< TReturn > cache, string endpoint) | |
Initializes a new instance of the QueryBuilder<TReturn> class. More... | |
QueryBuilder< TReturn > | WithFieldEqual< TField > (Expression< Func< TReturn, TField >> selector, TField value) |
Adds an "equal" filter for the specified field. API will return all models with a field value equal to the specified in the parameter. More... | |
QueryBuilder< TReturn > | WithFieldGreaterThan< TField > (Expression< Func< TReturn, TField >> selector, TField value) |
Adds a "greater than" filter for the specified field. API will return all models with a field value greater than the specified in the parameter. More... | |
QueryBuilder< TReturn > | WithFieldLessThan< TField > (Expression< Func< TReturn, TField >> selector, TField value) |
Adds a "less than" filter for the specified field. API will return all models with a field value less than the specified in the parameter. More... | |
QueryBuilder< TReturn > | WithFieldBetween< TField > (Expression< Func< TReturn, TField >> selector, TField from, TField to) |
Adds a "between" filter for the specified field. API will return all models with a field value greater than the bounds specified in the parameters. More... | |
QueryBuilder< TReturn > | WithFieldIn< TField > (Expression< Func< TReturn, TField >> selector, params TField[] values) |
Adds an "in" filter for the specified field. API will return all models with a field value containing one of the specified in the parameter. More... | |
QueryBuilder< TReturn > | SortBy< TField > (Expression< Func< TReturn, TField >> selector, bool ascending=true) |
Sorts result using the specified field and order (ascending/descending). More... | |
QueryBuilder< TReturn > | WithPage (uint page) |
Sets page number which will be returned from API. Don't use this method together with WithOffset (offset will be set to null in this case). More... | |
QueryBuilder< TReturn > | WithLimit (uint limit) |
Sets how many elements should be returned from API in the single page. More... | |
QueryBuilder< TReturn > | WithOffset (uint offset) |
Sets page number which will be returned from API. Don't use this method together with WithPage (page will be set to null in this case). More... | |
override PaginatedModel< TReturn > | Execute () |
override bool | Execute (PaginatedModel< TReturn > model) |
override async Task< PaginatedModel< TReturn > > | ExecuteAsync () |
override async Task< bool > | ExecuteAsync (PaginatedModel< TReturn > paginatedModel) |
Represents a query builder used to retrieve data with filters specified by the user.
TReturn | Type which will be returned after successful API request. |
TReturn | : | ModelBase | |
TReturn | : | IIdentifiable | |
TReturn | : | new() |
Oddity.Builders.QueryBuilder< TReturn >.QueryBuilder | ( | OddityCore | context, |
CacheService< TReturn > | cache, | ||
string | endpoint | ||
) |
Initializes a new instance of the QueryBuilder<TReturn> class.
override PaginatedModel<TReturn> Oddity.Builders.QueryBuilder< TReturn >.Execute | ( | ) |
override bool Oddity.Builders.QueryBuilder< TReturn >.Execute | ( | PaginatedModel< TReturn > | model | ) |
override async Task<PaginatedModel<TReturn> > Oddity.Builders.QueryBuilder< TReturn >.ExecuteAsync | ( | ) |
override async Task<bool> Oddity.Builders.QueryBuilder< TReturn >.ExecuteAsync | ( | PaginatedModel< TReturn > | paginatedModel | ) |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.SortBy< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
bool | ascending = true |
||
) |
Sorts result using the specified field and order (ascending/descending).
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
ascending | Sort order (ascending/descending). |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithFieldBetween< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
TField | from, | ||
TField | to | ||
) |
Adds a "between" filter for the specified field. API will return all models with a field value greater than the bounds specified in the parameters.
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
from | Left bound of the value to match. |
to | Right bound of the value to match. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithFieldEqual< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
TField | value | ||
) |
Adds an "equal" filter for the specified field. API will return all models with a field value equal to the specified in the parameter.
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
value | Value of the field to match. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithFieldGreaterThan< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
TField | value | ||
) |
Adds a "greater than" filter for the specified field. API will return all models with a field value greater than the specified in the parameter.
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
value | Value of the field to match. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithFieldIn< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
params TField[] | values | ||
) |
Adds an "in" filter for the specified field. API will return all models with a field value containing one of the specified in the parameter.
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
values | List of values to match. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithFieldLessThan< TField > | ( | Expression< Func< TReturn, TField >> | selector, |
TField | value | ||
) |
Adds a "less than" filter for the specified field. API will return all models with a field value less than the specified in the parameter.
TField | Type of the property (JSON field). |
selector | Property (JSON field) selector. |
value | Value of the field to match. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithLimit | ( | uint | limit | ) |
Sets how many elements should be returned from API in the single page.
limit | Number of elements to return. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithOffset | ( | uint | offset | ) |
Sets page number which will be returned from API. Don't use this method together with WithPage (page will be set to null in this case).
offset | Number of elements to skip. |
QueryBuilder<TReturn> Oddity.Builders.QueryBuilder< TReturn >.WithPage | ( | uint | page | ) |
Sets page number which will be returned from API. Don't use this method together with WithOffset (offset will be set to null in this case).
page | Selected page number (starting from 1). |