-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathget-by-key-request-builder.ts
43 lines (41 loc) · 1.51 KB
/
get-by-key-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
import {
Constructable,
EntityIdentifiable,
FieldType,
GetByKeyRequestBuilderBase
} from '../../odata-common';
import { EntityV2 } from '../entity';
import { entityDeserializerV2 } from '../entity-deserializer';
import { oDataUriV2 } from '../uri-conversion';
import { responseDataAccessorV2 } from './response-data-accessor';
/**
* Create an OData request to get a single entity based on its key properties.
* The properties available in the response can be restricted by creating a [[GetAllRequestBuilderV2.select selection]], where no selection is equal to selecting all fields.
* Note that navigational properties are automatically expanded if they included in a select.
*
* @typeparam EntityT - Type of the entity to be requested
*/
export class GetByKeyRequestBuilderV2<EntityT extends EntityV2>
extends GetByKeyRequestBuilderBase<EntityT>
implements EntityIdentifiable<EntityT> {
readonly _entity: EntityT;
/**
* Creates an instance of GetByKeyRequestBuilder.
*
* @param _entityConstructor - Constructor of the entity to create the request for
* @param keys - Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value
*/
constructor(
readonly _entityConstructor: Constructable<EntityT>,
keys: Record<string, FieldType>
) {
super(
_entityConstructor,
keys,
oDataUriV2,
entityDeserializerV2,
responseDataAccessorV2
);
}
}
export { GetByKeyRequestBuilderV2 as GetByKeyRequestBuilder };