Class Link<EntityT, DeSerializersT, LinkedEntityApiT>

Represents a navigation property of an OData entity.

OData is a relational data model, i.e. entities can be related to one another. For example, BusinessPartner is in a 1:n relation with BusinessPartnerAddress and in a 1:1 relation with Customer. Like normal properties, navigation properties can be used for selecting (expanding) and filtering. For example, when constructing a query on the BusinessPartner entity, an instance of Link<BusinessPartner, Customer> can be passed as argument to the select function, e.g. BusinessPartner.TO_CUSTOMER.

NOTE: Due to historical development the Link and its extensions are used in the following way: OData v2 entity: 1:N is a Link, 1:0..1 is a OneToOneLink OData v4 entity: 1:N is a OneToManyLink, 1:0..1 is a OneToOneLink.

See also: Selectable.

Type Param

Type of the entity to be linked to.

Type Parameters

Hierarchy

Implements

Constructors

  • Creates an instance of Link.

    Type Parameters

    • EntityT extends EntityBase<EntityT>

    • DeSerializersT extends DeSerializers<any, any, any, any, any, any, any, any, any, any, any, any, any, any, DeSerializersT>

    • LinkedEntityApiT extends EntityApi<EntityBase, DeSerializersT, LinkedEntityApiT>

    Parameters

    • _fieldName: string

      Name of the linking field to be used in the OData request.

    • _entityApi: EntityApi<EntityT, DeSerializersT>

      Entity API for building and executing the request.

    • _linkedEntityApi: LinkedEntityApiT

      Constructor of the linked entity.

    Returns Link<EntityT, DeSerializersT, LinkedEntityApiT>

Properties

_deSerializers: DeSerializersT

Dummy property to include also the deserializer type in the strucutre of the entity type.

_entity: EntityT

Dummy property whose type makes structurally identical entities distiguishable in TypeScript.

_entityApi: EntityApi<EntityT, DeSerializersT>
_expand: Expandable<EntityType<LinkedEntityApiT>, DeSerializersT, EntityApi<EntityBase, DeSerializersT>>[]
_fieldName: string
_linkedEntityApi: LinkedEntityApiT
_selects: Selectable<EntityType<LinkedEntityApiT>, DeSerializersT>[]

List of selectables on the linked entity.

Methods

  • Create a new link based on a given link.

    Returns

    Newly created link.

    Returns Link<EntityT, DeSerializersT, LinkedEntityApiT>

  • Creates a selection on a linked entity. Has the same behavior as GetAllRequestBuilderV2.select and GetByKeyRequestBuilderV4.select but for linked entities.

    See also, Selectable.

    Returns

    The link itself, to facilitate method chaining.

    Parameters

    • Rest ...selects: Selectable<EntityType<LinkedEntityApiT>, DeSerializersT>[]

      Selection of fields or links on a linked entity.

    Returns Link<EntityT, DeSerializersT, LinkedEntityApiT>

Copyright Ⓒ 2023 SAP SE or an SAP affiliate company. All rights reserved.