Elisa client API

Elisa

class src.elisa.Elisa(connection, username=None, password=None, ssocookie=None)

Interface to the ELisA logbook database.

getAttachment(msgId, attachmentId)

Retrieves the attachment with the given ID for the given message ID.

This method interacts with the ELisA logbook to retrieve the attachment with the given ID for the given message ID.

The validity of this criteria is realized at the server side.

Users are encourage to use getAttachments() since it does not imply knowing IDs.

msgId: message ID of the attachment to retrieve. attachmentId: the attachment ID Returns: the attachment. Throws: ElisaError if accessing the logbook fails.

getAttachments(message)

Retrieves all the attachments for a logbook message.

This method interacts with the ELisA logbook to retrieve all the attachments for the message in the arguments. The validity of this criteria is realized at the server side.

message: object of type MessageRead with the attachment to retrieve. Returns: a list of tuples with the id, name and content of the attachments. Throws: ElisaError if accessing the logbook fails.

getMessage(msgId)

Retrieves the logbook message with the given ID.

This method interacts with the ELisA logbook to retrieve the message with the associated ID given in the argument. The validity of this criteria is realized at the server side.

msgId: the message ID. Returns: an object of type MessageRead encapsulating the message

with the given ID.

Throws: ElisaError if accessing the logbook fails.

getMessageType(msgType=None)

Retrieves the possible message types or the options for a message type is specified in the argument.

msgType: a message type. Returns: a list of message types or a dictionary with the options

associated to a specific type.

Throws: ElisaError if accessing the logbook fails.

getSystemsAffected(msgType=None)

Retrieves the possible systems affected or the predefined systems affected for a given message type if that type is specified in the argument.

msgType: a message type. Returns: a list of possible systems affected or a list of

predefined systems affected for a given message type.

Throws: ElisaError if accessing the logbook fails.

insertMessage(message)

Inserts a logbook message into the ELisA back-end database.

Inserts in the ELisA logbook back-end database the message encapsulated in the ‘message’ argument. The type of this argument must be MessageWrite. The message consistency check is realized at the server side. The expected message type

message: object of type MessageWrite to be inserted into the database. Returns: an object of type MessageRead encapsulating the message

inserted into the database.

Throws: ElisaError if accessing the logbook fails.

replyToMessage(message)

Replies to a logbook message.

Inserts the reply message encapsulated in the ‘message’ argument. The type of this argument must be MessageReply. The message consistency check is realized at the server side.

message: object of type MessageReply to be inserted into the

database.

Returns: an object of type MessageRead encapsulating the message

inserted into the database.

Throws: ElisaError if the reply message could not be inserted.

searchMessages(criteria, showAttributes=False)

Retrieves the logbook messages that match the given search criteria.

This method interacts with the ELisA logbook to retrieve those messages that match the search criteria defined in the ‘criteria’ argument. The validity of this criteria is realized at the server side.

criteria: object of type SearchCriteria specifying the search 

filter.

showAttributes: if true, it also returns the option and attachment

message fields.

Returns: a list of objects of type MessageRead encapsulating 

the messages that meet the search criteria.

Throws: ElisaError if accessing the logbook fails.

updateMessage(message)

Updates a logbook message.

Inserts the updated message encapsulated in the ‘message’ argument. The type of this argument must be MessageUpdate. The message consistency check is realized at the server side.

message: object of type MessageUpdate to be inserted into the database. Returns: an object of type MessageRead encapsulating the message

updated into the database.

Throws: ElisaError if updating the message fails.

MessageRead

class src.messageRead.MessageRead(msgId=None)

Bases: src.core.message.Message

Class providing accessors for the read operation.

id

Message ID field.

logbook

Message logbook field.

userName

Message user name field.

author

Message author field.

date

Message date field.

subject

Message subject field.

type

Message type field.

options

Message options field.

systemsAffected

Message systems affected field.

body

Message body field.

host

Message host field.

hasReplies

Message has replies field.

replyTo

Message reply to field.

hasAttachments

Message has attachments field.

attachments

Message attachments field.

status

Message status field.

threadHead

Message thread head field.

valid

Message valid field.

encoding

Message encoding field.

MessageInsert

class src.messageInsert.MessageInsert

Bases: src.messageReply.MessageReply

Class providing accessors for the insert operation.

author

Message author field.

subject

Message subject field.

type

Message type field.

options

Message options field.

systemsAffected

Message systems affected field.

body

Message body field.

attachments

Message attachments field.

status

Message status field.

MessageReply

class src.messageReply.MessageReply(msgId=None)

Bases: src.messageUpdate.MessageUpdate

Class providing accessors for the reply operation.

author

Message author field.

subject

Message subject field.

options

Message options field.

systemsAffected

Message systems affected field.

body

Message body field.

attachments

Message attachments field.

status

Message status field.

MessageUpdate

class src.messageUpdate.MessageUpdate(msgId)

Bases: src.messageRead.MessageRead

Class providing accessors for the update operation.

body

Message body field.

attachments

Message attachments field.

OptionsBuilder

class src.optionsBuilder.OptionsBuilder(name='Root', value=None)

Bases: object

Class providing functionality to build the options fields.

addOption(name, value)

Creates an option, adds it to this option’s level and returns it.

name: name of this option. value: value of this option. Returns: an object of type Option.

toList()

Returns a list of options that can be used to insert a message.

Returns: a list with the options encapsulated as dictionaries.

SearchCriteria

class src.searchCriteria.SearchCriteria

Bases: object

Class representing a search criteria.

This class provides all the fields required to form a search criteria to retrieve logbook messages from the ELisA database.

author

Filter results per author.

body

Filter results per body.

getDict()

Returns a dictionary of fieldName:fieldValue

interval

Month interval.

limit

Number of entries returned (100 by default).

options

Filter results per options.

page

Page number for results pagination.

since

Initial search date.

status

Filter results per status.

subject

Filter results per subject.

systemsAffected

Filter results per systems affected.

type

Filter results per type.

until

End search date.

userName

Filter results per user name.

exception

exception src.exception.ArgumentError(argument)

Bases: src.exception.ElisaError

Exception thrown when an argument is wrongly passed to the API

exception src.exception.ElisaError(reason)

Bases: exceptions.Exception

Base exception.

exception src.exception.FileError(reason)

Bases: src.exception.ElisaError

Elisa exception thrown when an argument is wrongly passed to the API

exception src.exception.RestServerError(reason)

Bases: src.exception.ElisaError

Exception thrown when an error occurs whilst accessing the rest server.

exception src.exception.SsoCredentialsError

Bases: src.exception.RestServerError

Exception thrown when the SSO authentications fails.

© Copyright 2013, Raul Murillo Garcia. Created using Sphinx 1.1.3.