angular-odata
Version:
Client side OData typescript library for Angular
57 lines (56 loc) • 2.03 kB
TypeScript
import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, FieldParser, JsonType } from '../../types';
import { ODataAnnotatable } from '../annotation';
export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
name: string;
value: number;
constructor(name: string, field: EnumTypeFieldConfig);
titleize(term?: string | RegExp): string;
}
export declare class ODataEnumTypeParser<E> extends ODataAnnotatable implements FieldParser<E> {
name: string;
namespace: string;
alias?: string;
flags?: boolean;
members: {
[name: string]: number;
} | {
[value: number]: string;
};
private _fields;
parserOptions?: ParserOptions;
constructor(config: EnumTypeConfig, namespace: string, alias?: string);
configure({ options }: {
options: ParserOptions;
}): void;
isTypeOf(type: string): boolean;
fields(namesValue?: string | number | number[]): ODataEnumTypeFieldParser[];
field(nameValue: string | number): ODataEnumTypeFieldParser | undefined;
/**
* Map the fields of the enum type.
* @param mapper Function that maps the value to the new value
* @returns The fields mapped by the mapper
*/
mapFields<R>(mapper: (field: ODataEnumTypeFieldParser) => R): R[];
deserialize(value: string, options?: ParserOptions): E;
serialize(value: number, options?: ParserOptions): string | undefined;
encode(value: number, options?: ParserOptions): any;
toJsonSchema(): {
title: string;
type: JsonType;
items: {
type: JsonType;
};
enum?: undefined;
} | {
type: JsonType;
enum: number[];
title?: undefined;
items?: undefined;
};
validate(value: string | number, { method, navigation, }?: {
method?: 'create' | 'update' | 'modify';
navigation?: boolean;
}): string[] | undefined;
unpack(value: string | number): number[];
pack(value: string | number | number[]): number;
}