-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathget-all-request-builder.ts
48 lines (46 loc) · 1.52 KB
/
get-all-request-builder.ts
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
import { variadicArgumentToArray } from '@sap-cloud-sdk/util';
import {
Constructable,
EntityIdentifiable,
Filterable,
GetAllRequestBuilderBase,
and,
ODataGetAllRequestConfig
} from '../../odata-common';
import { EntityV2 } from '../entity';
import { entityDeserializerV2 } from '../entity-deserializer';
import { oDataUriV2 } from '../uri-conversion';
import { responseDataAccessorV2 } from './response-data-accessor';
export class GetAllRequestBuilderV2<EntityT extends EntityV2>
extends GetAllRequestBuilderBase<EntityT>
implements EntityIdentifiable<EntityT> {
/**
* Creates an instance of GetAllRequestBuilder.
*
* @param entityConstructor - Constructor of the entity to create the request for
*/
constructor(entityConstructor: Constructable<EntityT>) {
super(
entityConstructor,
new ODataGetAllRequestConfig(entityConstructor, oDataUriV2),
entityDeserializerV2,
responseDataAccessorV2
);
}
/**
* Add filter statements to the request.
*
* @param expressions - Filter expressions to restrict the response
* @returns The request builder itself, to facilitate method chaining
*/
filter(expressions: Filterable<EntityT>[]): this;
filter(...expressions: Filterable<EntityT>[]): this;
filter(
first: undefined | Filterable<EntityT> | Filterable<EntityT>[],
...rest: Filterable<EntityT>[]
): this {
this.requestConfig.filter = and(variadicArgumentToArray(first, rest));
return this;
}
}
export { GetAllRequestBuilderV2 as GetAllRequestBuilder };