Home Manual Reference Source Repository
public class | source

CrudBase

Extends:

ResourceBase → CrudBase

Indirect Subclass:

Dimension, Font, Svg

Base of all resource items that support Crud operations

Constructor Summary

Public Constructor
public

constructor(api: Mapcreator, data: Object<String, *>, altUrl: String)

Method Summary

Public Methods
public

Delete item

public

Restore item

public

Save item.

Protected Methods
protected

Build data for create operation

protected

Update existing item

Inherited Summary

From class ResourceBase
public static get

Returns if the resource is readonly

public static get abstract

Resource name

public static get

Resource path template

public static get

Returns the url key of the resource

protected static get

Protected read-only fields

public get

api: Mapcreator: *

Get api instance

public set

api(value: Mapcreator)

Set the api instance

public get

Auto generated Resource base url

public get

List fields that contain object data

public get

If the resource can be owned by an organisation

public get

url: string: *

Auto generated resource url

public

Clone the object

public

Refresh the resource by requesting it from the server again

public

reset(fields: Array<string> | string | null)

Resets model instance to it's original state

public

Clean up instance and commit all changes locally.

public

static(Target: string | Class, Constructor: Class?, seedData: Object<string, *>): SimpleResourceProxy

Static proxy generation

public

toObject(camelCaseKeys: boolean): {}

Transform instance to object

public

String representation of the resource, similar to Python's repr

protected

_guessType(name: string, value: *): *

Guess type based on property name

protected

Macro for resource listing

protected

Moves new fields to this._properties and turns them into a getter/setter

Public Constructors

public constructor(api: Mapcreator, data: Object<String, *>, altUrl: String) source

Override:

ResourceBase#constructor

Params:

NameTypeAttributeDescription
api Mapcreator

Api instance

data Object<String, *>

Item data

altUrl String
  • optional

Internal use, Optional alternative url for more complex routing

Public Methods

public delete(updateSelf: Boolean): CancelablePromise<CrudBase> source

Delete item

Params:

NameTypeAttributeDescription
updateSelf Boolean
  • optional
  • default: true

Update current instance (set the deletedAt property)

Return:

CancelablePromise<CrudBase>

Current instance

Throw:

ApiError

If the api returns errors

ValidationError

If the submitted data isn't valid

public restore(updateSelf: Boolean): CancelablePromise<CrudBase> source

Restore item

Params:

NameTypeAttributeDescription
updateSelf Boolean
  • optional
  • default: true

Update current instance (unset the deletedAt property)

Return:

CancelablePromise<CrudBase>

New restored instance

Throw:

ApiError

If the api returns errors

ValidationError

If the submitted data isn't valid

public save(): CancelablePromise<CrudBase> source

Save item. This will create a new item if id is unset

Return:

CancelablePromise<CrudBase>

Current instance

Throw:

ApiError

If the api returns errors

ValidationError

If the submitted data isn't valid

Protected Methods

protected _buildCreateData(): Object<String, *> source

Build data for create operation

Return:

Object<String, *>

Create data

protected _update(): CancelablePromise<CrudBase> source

Update existing item

Return:

CancelablePromise<CrudBase>

Current instance

Throw:

ApiError

If the api returns errors

ValidationError

If the submitted data isn't valid