Reference Guide

This library provides classes that allow to communicate with Envase Connect Data. The library can be used by Envase applications and services to register webhooks or send events to Envase Connect Data.

Data Classes

encdc.data

This module contains data classes that can be used with the different clients to interact with Envase Connect Data to register web-hooks and send events. The data classes implement the ISerializable interface, and the clients rely on this interface to communicate with Envase Connect Data. Applications can use the classes on this module or implement their own to customize how the serialization happens.

class Event(event_target: EventTarget, event_type: EventType, serializable_event_data: Serializable)

Serializable event class that represents a full event sent to Envase Connect Data.

Parameters
  • event_target (EventTarget) – Serializable event target information.

  • event_type (EventType) – Serializable event type information.

  • serializable_event_data (Serializable) – Serializable object that will be used as the event data (payload).

class EventTarget(organization_id: str, tms_id: str)

Serializable data structure that represents an application or service that listens to events.

Parameters
  • organization_id (str) – Identifier of the organization that uses the the application or service that listens to events.

  • tms_id (str) – Identifier of the TMS application that will receive the event.

class EventType(action: str, event_type: str)

Serializable data structure that represents the type of event an application is listening.

Parameters
  • action (str) – Event action that the application wants to handle.

  • event_type (str) – Entity type that the application want to handle the event.

class FilterProperty(name: str, value: str)
class WebHookInfo(url: str, triggers: list, event_type: str, signing_key: Optional[str] = None, filters: Optional[list] = None, headers: Optional[list] = None)

Serializable data structure that represents the information of a Web-Hook supported by Envase Connect Data.

Parameters
  • url (str) – URL (or AWS Lambda function ARN) that will receive the notifications.

  • triggers (list) – A list of strings containing the trigger identifiers that the web-hook wants to listen.

  • event_type (str) – Entity type for which to listen to events.

class WebhookFilter

HTTP Client

encdc.http

This module provides classes that allow an application and service to talk to Envase Connect Data through HTTP.

Important

Applications and services that want to use this module will have to add the requests library to their dependencies.

class EventClient(environment, authorizer, _test_session=None)

This class provides the client interface to communicate with Envase Connect Data Events through HTTP.

Parameters
  • environment (str) – Environment identifier for the Envase Connect Data instance to connect.

  • authorizer (Authorizer) – Authorizer class that allows to send authorized calls to Envase Connect Data.

send_event(serializable_event)

Sends an event to Envase Connect Data. This method allows applications and services to send information to other applications and services.

Parameters

serializable_event (Serializable) – Serializable object that serializes to the structure of a valid Envase Connect Data event.

Returns

The created event.

class WebHookClient(environment, authorizer, headers=None, _test_session=None)

This class provides the client interface to communicate with Envase Connect Data Webhooks through HTTP.

Parameters
  • environment (str) – Environment identifier for the Envase Connect Data instance to connect.

  • authorizer (Authorizer) – Authorizer class that allows to send authorized calls to Envase Connect Data.

  • org_id – The organization id

delete_webhook(webhook_id)

Deletes a Web-Hook so no more events are sent to it.

Parameters

webhook_id (str) – Id of the Web-Hook to delete.

Returns

True if the Web-Hook existed and was deleted or False otherwise. Regardless, the Web-Hook will no longer be available.

get_webhook(webhook_id)

Returns the information about the specified Web-Hook.

Parameters

webhook_id (str) – Id of the Web-Hook that was generated during registration.

Returns

An object with the properties of the Web-Hook or None, if the Web-Hook does not exist.

is_registered(webhook_id)

Returns whether the specified Web-Hook is registered or not.

Parameters

webhook_id (str) – Id of the Web-Hook to check if is registered.

Returns

True of the Web-Hook is registered or False otherwise.

register_webhook(serializable_webhook_info)

Registers a new Web-Hook.

Parameters

serializable_webhook_info (Serializable) – Serializable object that serializes to a valid payload to create a new Web-Hook.

Returns

An object with the properties of the created Web-Hook.

update_webhook(webhook_id, serializable_webhook_info)

Updates the information of a Web-Hook.

Parameters
  • webhook_id (str) – Id of the Web-Hook to be updated.

  • serializable_webhook_info (Serializable) – Updated information about the Web-Hook.

Returns

The updated Web-Hook information.

Serverless Client

encdc.serverless

This module provides classes that allow an application and service to talk to Envase Connect Data through invoking AWS Lambda functions.

Important

Applications and services that want to use this module will have to add the en-serverless library to their dependencies.

class Client(environment, dispatcher)

This class provides the client interface to communicate with Envase Connect Data through invoking AWS Lambda functions.

Parameters
  • environment (str) – Environment identifier for the Envase Connect Data instance to connect.

  • dispatcher (Dispatcher) – Dispatcher class that invokes the lambda functions for Envase Connect Data.

delete_webhook(webhook_id)

Warning

This client doesn’t support this operation.

Raises

UnsuportedOperationError when called.

get_webhook(webhook_id)

Warning

This client doesn’t support this operation.

Raises

UnsuportedOperationError when called.

is_registered(webhook_id)

Warning

This client doesn’t support this operation.

Raises

UnsuportedOperationError when called.

register_webhook(serializable_webhook_info)

Warning

This client doesn’t support this operation.

Raises

UnsuportedOperationError when called.

send_event(serializable_event)

Sends an event to Envase Connect Data. This method allows applications and services to send information to other applications and services.

Parameters

serializable_event (Serializable) – Serializable object that serializes to the structure of a valid Envase Connect Data event.

Returns

The created event.

update_webhook(webhook_id, serializable_webhook_info)

Warning

This client doesn’t support this operation.

Raises

UnsuportedOperationError when called.