Properties
Optional Readonly annotated
busy
busy: boolean = false
collection
collection: T["collection"]
data
data: T["properties"]
delete
delete: (params?: T["delete"]["parameters"]) => CancellablePromise<T["delete"]["response"]> = flow(function* (this: ClientModel<any>, params) {if (!this.annotated.delete) {throw new Error("There is no delete method allowed");}this.busy = true;try {const {delete: { path, method },namespace} = this.annotated;const response: T["delete"]["response"] = yield this.annotated.request<T["delete"]["parameters"],T["delete"]["parameters"],T["delete"]["response"]>({location: {path,method: method || ERouteHttpVerb.DELETE,namespace},params: {...{ [this.annotated.keyId]: this.key },...(params || {})}});this.collection.entries.delete(this.key);this.afterDelete();return response;} catch (e) {console.log(e);throw e;} finally {this.busy = false;}})
Type declaration
-
- (params?: T["delete"]["parameters"]): CancellablePromise<T["delete"]["response"]>
-
Parameters
-
Optional params: T["delete"]["parameters"]
Returns CancellablePromise<T["delete"]["response"]>
patch
patch: (params?: T["patch"]["parameters"]) => CancellablePromise<void> = flow(function* (this: ClientModel<any>,params) {if (!this.annotated.patch) {throw new Error("There is no patch method allowed");}this.busy = true;try {const {patch: { path, method },namespace} = this.annotated;const response: T["patch"]["response"] = yield this.annotated.request<T["patch"]["request"],T["patch"]["parameters"],T["patch"]["response"]>({location: {path,method: method || ERouteHttpVerb.PATCH,namespace},request: this.transformDataForPatch(),params: {...{ [this.annotated.keyId]: this.key },...(params || {})}});this.fromResponse(response);this.afterPatch();} catch (e) {console.log(e);throw e;} finally {this.busy = false;}})
Type declaration
-
- (params?: T["patch"]["parameters"]): CancellablePromise<void>
-
Parameters
-
Optional params: T["patch"]["parameters"]
Returns CancellablePromise<void>
persist
persist: (params?: T["create"]["parameters"]) => CancellablePromise<void> = flow(function* (this: ClientModel<any>,params) {if (!this.annotated.create) {throw new Error("There is no persist method allowed");}this.busy = true;try {const {create: { path, method },namespace} = this.annotated;const response: T["create"]["response"] = yield this.annotated.request<T["create"]["request"],T["create"]["parameters"],T["create"]["response"]>({location: {path,method: method || ERouteHttpVerb.POST,namespace},request: this.transformDataForPersist(),params: params || {}});this.fromResponse(response);this.collection.entries.set(this.key, this);this.afterPersist();} catch (e) {console.log(e);throw e;} finally {this.busy = false;}})
Type declaration
-
- (params?: T["create"]["parameters"]): CancellablePromise<void>
-
Parameters
-
Optional params: T["create"]["parameters"]
Returns CancellablePromise<void>
Create your conditionals here and return only changed values.