ari.model module
Model for mapping ARI Swagger resources and operations into objects.
The API is modeled into the Repository pattern, as you would find in Domain Driven Design.
Each Swagger Resource (a.k.a. API declaration) is mapped into a Repository object, which has the non-instance specific operations (just like what you would find in a repository object).
Responses from operations are mapped into first-class objects, which themselves have methods which map to instance specific operations (just like what you would find in a domain object).
The first-class objects also have ‘on_event’ methods, which can subscribe to Stasis events relating to that object.
- class ari.model.BaseObject(client, resource, as_json, event_reg)[source]
Bases:
object
Base class for ARI domain objects.
- Parameters
client (client.Client) – ARI client.
resource (swaggerpy.client.Resource) – Associated Swagger resource.
as_json (dict) – JSON representation of this object instance.
event_reg –
- id_generator = <ari.model.ObjectIdGenerator object>
- class ari.model.Bridge(client, bridge_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
bridge_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.Channel(client, channel_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
channel_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.DefaultObjectIdGenerator(param_name, id_field='id')[source]
Bases:
ObjectIdGenerator
Id generator that works for most of our objects.
- Parameters
param_name – Name of the parameter to specify in queries.
id_field – Name of the field to specify in JSON.
- class ari.model.DeviceState(client, device_state_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
endpoint_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.Endpoint(client, endpoint_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
endpoint_json – Instance data
- id_generator = <ari.model.EndpointIdGenerator object>
- class ari.model.EndpointIdGenerator[source]
Bases:
ObjectIdGenerator
Id generator for endpoints, because they are weird.
- class ari.model.LiveRecording(client, recording_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client
recording_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.Mailbox(client, mailbox_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
mailbox_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.ObjectIdGenerator[source]
Bases:
object
Interface for extracting identifying information from an object’s JSON representation.
- class ari.model.Playback(client, playback_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
playback_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.Repository(client, name, resource)[source]
Bases:
object
ARI repository.
This repository maps to an ARI Swagger resource. The operations on the Swagger resource are mapped to methods on this object, using the operation’s nickname.
- Parameters
client (client.Client) – ARI client.
name – Repository name. Maps to the basename of the resource’s .json file
resource (swaggerpy.client.Resource) – Associated Swagger resource.
- class ari.model.Sound(client, sound_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client.
sound_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- class ari.model.StoredRecording(client, recording_json)[source]
Bases:
BaseObject
First class object API.
- Parameters
client (client.Client) – ARI client
recording_json – Instance data
- id_generator = <ari.model.DefaultObjectIdGenerator object>
- ari.model.promote(client, resp, operation_json)[source]
- Promote a response from the request’s HTTP response to a first class
object.
- Parameters
client (client.Client) – ARI client.
resp (requests.Response) – HTTP resonse.
operation_json (dict) – JSON model from Swagger API.
- Returns