-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathget-selection.ts
25 lines (23 loc) · 1.02 KB
/
get-selection.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
/* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */
import { EntityV2 } from '../entity';
import { Selectable } from '../../common';
import { getSelectV2 } from './get-select';
import { getExpandV2 } from './get-expand';
/**
* @deprecated Since v1.21.0. Use [[oDataUriV2.getSelect]] and [[oDataUriV2.getExpand]] instead.
*
* Get an object containing the given Selectables as query parameter, or an empty object if none were given.
* This retrieves where in addition to the selection (`select`) there is also an expansion (`expand`) needed.
*
* @typeparam EntityT - Type of the entity to get the selection for
* @param selects - The list of selectables to be transformed to query parameters
* @returns An object containing the query parameters or an empty object
*/
export function getQueryParametersForSelection<EntityT extends EntityV2>(
selects: Selectable<EntityT>[] = []
): Partial<{ select: string; expand: string }> {
return {
...getSelectV2(selects),
...getExpandV2(selects)
};
}