How to use the messagebird.base.Base function in messagebird

To help you get started, we’ve selected a few messagebird examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github messagebird / python-rest-api / messagebird / call_flow.py View on Github external
self._updatedAt = self.value_to_time(value)

    def load(self, data):
        if data.get('data') is not None:
            items = data.get('data')[0].items()
        else:
            items = list(data.items())

        for name, value in items:
            if hasattr(self, name) and not callable(getattr(self, name)):
                setattr(self, name, value)

        return self


class CallFlowNumber(Base):
    def __init__(self):
        self.id = None
        self.number = None
        self.callFlowId = None
        self._createdAt = None
        self._updatedAt = None

    @property
    def createdAt(self):
        return self._createdAt

    @createdAt.setter
    def createdAt(self, value):
        self._createdAt = self.value_to_time(value)

    @property
github messagebird / python-rest-api / messagebird / base_list.py View on Github external
from messagebird.base import Base


class Links(Base):

    def __init__(self):
        self.first = None
        self.previous = None
        self.next = None
        self.last = None


class BaseList(Base):

    def __init__(self, item_type):
        """When setting items, they are instantiated as objects of type item_type."""
        self.limit = None
        self.offset = None
        self.count = None
        self.totalCount = None
github messagebird / python-rest-api / messagebird / voice_recording.py View on Github external
from messagebird.base import Base


class VoiceRecording(Base):

    def __init__(self):
        self.id = None
        self.format = None
        self.type = None
        self.legId = None
        self.status = None
        self.duration = None
        self._createdDatetime = None
        self._updatedDatetime = None
        self._links = None

    @property
    def createdDatetime(self):
        return self._createdDatetime
github messagebird / python-rest-api / messagebird / voice_webhook.py View on Github external
for item in value:
                self._items.append(VoiceWebhook().load(item))

    def __str__(self):
        item_ids = []
        if self._items is not None:
            for voice_item in self._items:
                item_ids.append(voice_item.id)

        return "\n".join([
            'items IDs  : %s' % item_ids,
            'count      : %s' % len(item_ids)
        ])


class VoiceCreateWebhookRequest(Base):
    def __init__(self, title=None, url=None, token=None):
        validate_is_not_blank(url, "url cannot be empty")
        self.title = title
        self._url = url
        self.token = token

    @property
    def url(self):
        return self._url

    @url.setter
    def url(self, value):
        validate_is_not_blank(value, "url cannot be empty")
        self._url = value

    def __dict__(self):
github messagebird / python-rest-api / messagebird / conversation_channel.py View on Github external
from messagebird.base import Base


class Channel(Base):
    def __init__(self):
        self.id = None
        self.name = None
        self.platformId = None
        self.status = None
        self._createdDateTime = None
        self._updatedDateTime = None

    @property
    def createdDateTime(self):
        return self._createdDateTime

    @createdDateTime.setter
    def createdDateTime(self, value):
        self._createdDateTime = self.value_to_time(value)
github messagebird / python-rest-api / messagebird / call.py View on Github external
from messagebird.base import Base
from messagebird.call_data import CallData

CALL_STATUS_STARTING = "starting"
CALL_STATUS_ONGOING = "ongoing"
CALL_STATUS_ENDED = "ended"


class Call(Base):

    def __init__(self):
        self.id = None
        self._data = None

    @property
    def data(self):
        return self._data

    @data.setter
    def data(self, value):
        self._data = CallData().load(value[0])

    def __str__(self):
        return "\n".join([
            'id                 : %s' % self.id,
github messagebird / python-rest-api / messagebird / conversation_message.py View on Github external
'status            : %s' % self.status,
            'type              : %s' % self.type,
            'content           : %s' % self.content,
            'created date time : %s' % self._createdDatetime,
            'updated date time : %s' % self._updatedDatetime
        ])


class ConversationMessageReference(Base):
    def __init__(self):
        self.totalCount = None
        self.href = None
        self.lastMessageId = None


class ConversationMessageList(Base):

    def __init__(self):
        self.offset = None
        self.limit = None
        self.count = None
        self.totalCount = None
        self._items = None

    @property
    def items(self):
        return self._items

    @items.setter
    def items(self, value):
        items = []
        if isinstance(value, list):
github messagebird / python-rest-api / messagebird / webhook.py View on Github external
from messagebird.base import Base


class Webhook(Base):

    def __init__(self):
        self.url = None
        self.token = None

    def __str__(self):
        return "\n".join([
            'url                : %s' % self.url,
            'token              : %s' % self.token,
        ])
github messagebird / python-rest-api / messagebird / mms.py View on Github external
from messagebird.base import Base
from messagebird.recipient import Recipient


class MMS(Base):
    def __init__(self):
        self.id = None
        self.href = None
        self.direction = None
        self.originator = None
        self.subject = None
        self.body = None
        self.mediaUrls = None
        self.reference = None
        self._scheduledDatetime = None
        self._createdDatetime = None
        self._recipients = None

    @property
    def scheduledDatetime(self):
        return self._scheduledDatetime
github messagebird / python-rest-api / messagebird / base_list.py View on Github external
from messagebird.base import Base


class Links(Base):

    def __init__(self):
        self.first = None
        self.previous = None
        self.next = None
        self.last = None


class BaseList(Base):

    def __init__(self, item_type):
        """When setting items, they are instantiated as objects of type item_type."""
        self.limit = None
        self.offset = None
        self.count = None
        self.totalCount = None
        self._links = None
        self._items = None

        self.itemType = item_type

    @property
    def links(self):
        return self._links