UNPKG

@sap-cloud-sdk/core

Version:
52 lines 2.68 kB
import { Entity } from '../entity'; import { EdmTypeShared } from '../edm-types'; import { Filter } from '../filter'; import { Field, FieldOptions } from './field'; import { ConstructorOrField } from './constructor-or-field'; /** * Represents a property with an enum value. * @typeparam EntityT - Type of the entity the field belongs to. * @typeparam EnumT - Enum type that contains all valid enum entries for this field. * @typeparam NullableT - Boolean type that represents whether the field is nullable. * @typeparam SelectableT - Boolean type that represents whether the field is selectable. */ export declare class EnumField<EntityT extends Entity, EnumT extends string = string, NullableT extends boolean = false, SelectableT extends boolean = false> extends Field<EntityT, NullableT, SelectableT> { readonly _fieldOf: ConstructorOrField<EntityT>; readonly enumType?: Record<string, EnumT> | undefined; /** * @deprecated Since v1.48.0. This property is not used anymore. */ readonly edmType: EdmTypeShared<any>; /** * Creates an instance of EnumField. * @param fieldName - Actual name of the field used in the OData request. * @param _fieldOf - The constructor of the entity or the complex type field this field belongs to. * @param enumType - Enum type of the field according to the metadata description. * @param fieldOptions - Optional settings for this field. */ constructor(fieldName: string, _fieldOf: ConstructorOrField<EntityT>, enumType?: Record<string, EnumT> | undefined, fieldOptions?: FieldOptions<NullableT, SelectableT>); /** * Gets the path to the complex type property represented by this. * @returns The path to the complex type property. */ fieldPath(): string; /** * Creates an instance of Filter for this field and the given value using the operator 'eq', i.e. `==`. * @param value - Value to be used in the filter * @returns The resulting filter */ equals(value: EnumType<EnumT>): Filter<EntityT, string>; /** * Creates an instance of Filter for this field and the given value using the operator 'ne', i.e. `!=`. * @param value - Value to be used in the filter * @returns The resulting filter */ notEquals(value: EnumType<EnumT>): Filter<EntityT, string>; } /** * Convenient type to reflect all the values of a string based enum as a union type. * @typeparam T - String based enum type * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types */ export declare type EnumType<T extends string> = `${T}`; //# sourceMappingURL=enum-field.d.ts.map