import 'reflect-metadata'; import { Widget } from './widgets'; import { ApiService, OptionField } from './api.service'; import { Observable } from 'rxjs'; import { Dictionary } from './utility-types'; /** * Options for a serializer field. All are optional. */ export interface FieldOptions { type?: any; widget?: string | Widget; many?: boolean; required?: boolean; defaultValue?: any; readOnly?: boolean; writeOnly?: boolean; helpText?: string; isSerializer?: boolean; } /** * Set a model field in a serializer. For example: * * export class Specie extends SerializerService { * @Field() field_name: string; * @Field() other_model: OtherModel; * @Field({many: true}) instances: SubModel[]; * } * * @param options: options for a field. See FieldOptions. */ export declare function Field(options?: FieldOptions): (target: object, key: string) => void; export declare class SerializerService { _api: ApiService; pk: string | number; constructor(api: any, data: any); /** * Get field names in this serializer */ static get fieldNames(): string[]; static get _className(): string; static getApiClass(): any; /** * Update this object using data. All parameters are overwrite using * PUT method. * * @param data: parameters for overwrite. */ update(data: Dictionary): Observable; /** * Update this object using data. All parameters are overwrite using * PATCH method. * * @param data: parameters for overwrite. */ partial_update(data: Dictionary): Observable; /** * Update the object server using overwrited data in this instance. * */ save(): Observable; /** * Delete this object in the server */ delete(): Observable; /** * Get instance parameters. */ getData(): {}; /** * Get options for a field. It has the information about the field like the label. * The information is loaded from the server using OPTIONS * * @param fieldName: name of the field. Double low bar can be used to access a nested model. */ getOptionField(fieldName: string): Observable; /** * Get the display name for a field with choices. Names are loaded from the server. * * @param fieldName: name of the field. Double low bar can be used to access a nested model. */ getDisplay(fieldName: string): Observable; /** * Get value for a field name in this instance or a nested model in this insntace. * * @param fieldName: name of the field. Double low bar can be used to access a nested model. */ getValue(fieldName: any): any; getName(): string; toString(): string; private transformData; }