UNPKG

pailingual-odata

Version:

TypeScript client for OData v4 services

96 lines (95 loc) 3.97 kB
import { Options } from "./options"; export declare enum EdmTypes { Int32 = "Edm.Int32", Int16 = "Edm.Int16", Boolean = "Edm.Boolean", String = "Edm.String", Single = "Edm.Single", Guid = "Edm.Guid", DateTimeOffset = "Edm.DateTimeOffset", Date = "Edm.Date", Double = "Edm.Double", TimeOfDay = "Edm.TimeOfDay", Decimal = "Edm.Decimal", Unknown = "Unknown" } export declare class EdmEntityType { name: string; properties: Record<string, EdmTypeReference>; navProperties: Record<string, EdmEntityTypeReference>; keys?: string[] | undefined; baseType?: EdmEntityType | undefined; openType?: boolean | undefined; namespace?: Namespace; constructor(name: string, properties: Record<string, EdmTypeReference>, navProperties?: Record<string, EdmEntityTypeReference>, keys?: string[] | undefined, baseType?: EdmEntityType | undefined, openType?: boolean | undefined); getFullName: () => string; } export declare class EdmComplexType extends EdmEntityType { } export declare class EdmEnumType { name: string; members: Record<string, string | number>; namespace?: Namespace; constructor(name: string, members: Record<string, string | number>); getFullName: () => string; } export declare class EdmEntityTypeReference { type: EdmEntityType; nullable: boolean; collection: boolean; constructor(type: EdmEntityType, nullable?: boolean, collection?: boolean); static fromTypeReference(typeReference: EdmTypeReference): EdmEntityTypeReference; } export declare class EdmTypeReference { type: EdmTypes | EdmEntityType | EdmEnumType; nullable: boolean; collection: boolean; constructor(type: EdmTypes | EdmEntityType | EdmEnumType, nullable?: boolean, collection?: boolean); } export declare class OperationMetadata { name: string; isAction: boolean; parameters?: { name: string; type: EdmTypeReference; }[] | undefined; returnType?: EdmTypeReference | undefined; bindingTo?: EdmEntityTypeReference | undefined; namespace?: Namespace; constructor(name: string, isAction: boolean, parameters?: { name: string; type: EdmTypeReference; }[] | undefined, returnType?: EdmTypeReference | undefined, bindingTo?: EdmEntityTypeReference | undefined); getFullName: () => string; } export declare class Namespace { readonly name: string; operations: OperationMetadata[]; types: Readonly<Record<string, EdmEntityType | EdmEnumType>>; constructor(name: string); addTypes(...types: (EdmEntityType | EdmEnumType)[]): void; addOperations(...operations: OperationMetadata[]): void; } declare type Namespaces = Record<string, Namespace>; export declare function loadMetadata(apiRoot: string, options?: Options, cache?: boolean): Promise<ApiMetadata>; export declare class ApiMetadata { readonly apiRoot: string; readonly containerName: string; readonly namespaces: Namespaces; readonly entitySets: Record<string, EdmEntityType>; readonly singletons: Record<string, EdmEntityType>; constructor(apiRoot: string, containerName: string, namespaces?: Namespaces, entitySets?: Record<string, EdmEntityType>, singletons?: Record<string, EdmEntityType>); static loadFromXml(apiRoot: string, metadataXml: string): ApiMetadata; static loadAsync(apiRoot: string, options?: Options): Promise<ApiMetadata>; private static parseEntityTypes; private static parseEntityKeys; private static parseEnumMembers; private static getEntityTypeProperties; getEntitySetMetadata(typeName: string): EdmEntityType; private static getEntitySetMetadata; getEdmTypeMetadata(typeName: string): EdmEntityType | EdmEnumType; private static getEdmTypeMetadata; private static parseOperationMetadata; private static parseType; } export {};