congress.api.datasource_model module

class congress.api.datasource_model.DatasourceModel(name, bus=None)

Bases: congress.api.base.APIModel

Model for handling API requests about Datasources.

add_item(item, params, id_=None, context=None)

Add item to model.

Param

item: The item to add to the model

Param

id_: The ID of the item, or None if an ID should be generated

Param

context: Key-values providing frame of reference of request

Returns

Tuple of (ID, newly_created_item)

Raises

KeyError – ID already exists.

delete_item(id_, params, context=None)
execute_action(params, context=None, request=None)

Execute the action.

get_item(id_, params, context=None)

Get datasource corresponding to id_ in model.

get_items(params, context=None)

Get items in model.

Param

params: A dict-like object containing parameters from the request query string and body.

Param

context: Key-values providing frame of reference of request

Returns

A dict containing at least a ‘results’ key whose value is a list of items in the model. Additional keys set in the dict will also be rendered for the user.

request_refresh_action(params, context=None, request=None)