How to use the zenpy.lib.api_objects.__init__.BaseObject function in zenpy

To help you get started, we’ve selected a few zenpy 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 facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
if updated:
            self.updated_at = updated


class Source(BaseObject):
    def __init__(self, api=None, from_=None, rel=None, to=None, **kwargs):
        self.api = api
        self.from_ = from_
        self.rel = rel
        self.to = to

        for key, value in kwargs.items():
            setattr(self, key, value)


class Status(BaseObject):
    def __init__(self,
                 api=None,
                 action=None,
                 errors=None,
                 id=None,
                 status=None,
                 success=None,
                 title=None,
                 **kwargs):
        self.api = api
        self.action = action
        self.errors = errors
        self.id = id
        self.status = status
        self.success = success
        self.title = title
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
    @property
    def updated(self):
        """
        |  Comment: When this record last got updated
        """
        if self.updated_at:
            return dateutil.parser.parse(self.updated_at)

    @updated.setter
    def updated(self, updated):
        if updated:
            self.updated_at = updated


class TicketMetricItem(BaseObject):
    def __init__(self, api=None, business=None, calendar=None, **kwargs):
        self.api = api
        self.business = business
        self.calendar = calendar

        for key, value in kwargs.items():
            setattr(self, key, value)


class TicketSharingEvent(BaseObject):
    def __init__(self,
                 api=None,
                 action=None,
                 agreement_id=None,
                 id=None,
                 type=None,
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
    @property
    def user(self):
        """
        |  Comment: The ID of the user for whom this memberships belongs
        """
        if self.api and self.user_id:
            return self.api._get_user(self.user_id)

    @user.setter
    def user(self, user):
        if user:
            self.user_id = user.id
            self._user = user


class PolicyMetric(BaseObject):
    def __init__(self,
                 api=None,
                 business_hours=None,
                 metric=None,
                 priority=None,
                 target=None,
                 **kwargs):
        self.api = api
        self.business_hours = business_hours
        self.metric = metric
        self.priority = priority
        self.target = target

        for key, value in kwargs.items():
            setattr(self, key, value)
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
setattr(self, key, value)

    @property
    def author(self):

        if self.api and self.author_id:
            return self.api._get_user(self.author_id)

    @author.setter
    def author(self, author):
        if author:
            self.author_id = author.id
            self._author = author


class FacebookEvent(BaseObject):
    def __init__(self,
                 api=None,
                 body=None,
                 communication=None,
                 id=None,
                 page=None,
                 ticket_via=None,
                 type=None,
                 **kwargs):
        self.api = api
        self.body = body
        self.communication = communication
        self.id = id
        self.page = page
        self.ticket_via = ticket_via
        self.type = type
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
for key, value in kwargs.items():
            setattr(self, key, value)


class CustomField(BaseObject):
    def __init__(self, api=None, id=None, value=None, **kwargs):
        self.api = api
        self.id = id
        self.value = value

        for key, value in kwargs.items():
            setattr(self, key, value)


class Definitions(BaseObject):
    def __init__(self, api=None, all=None, any=None, **kwargs):
        self.api = api
        self.all = all
        self.any = any

        for key, value in kwargs.items():
            setattr(self, key, value)


class ErrorEvent(BaseObject):
    def __init__(self, api=None, id=None, message=None, type=None, **kwargs):
        self.api = api
        self.id = id
        self.message = message
        self.type = type
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
self.author_id = author.id
            self._author = author

    @property
    def created(self):

        if self.created_at:
            return dateutil.parser.parse(self.created_at)

    @created.setter
    def created(self, created):
        if created:
            self.created_at = created


class CommentPrivacyChangeEvent(BaseObject):
    def __init__(self,
                 api=None,
                 comment_id=None,
                 id=None,
                 public=None,
                 type=None,
                 **kwargs):

        self.api = api
        self.comment_id = comment_id
        self.id = id
        self.public = public
        self.type = type

        for key, value in kwargs.items():
            setattr(self, key, value)
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
    @property
    def updated(self):
        """
        |  Comment: The time the satisfaction rating got updated
        """
        if self.updated_at:
            return dateutil.parser.parse(self.updated_at)

    @updated.setter
    def updated(self, updated):
        if updated:
            self.updated_at = updated


class SatisfactionRatingEvent(BaseObject):
    def __init__(self,
                 api=None,
                 assignee_id=None,
                 body=None,
                 id=None,
                 score=None,
                 type=None,
                 **kwargs):

        self.api = api
        self.assignee_id = assignee_id
        self.body = body
        self.id = id
        self.score = score
        self.type = type
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
    @property
    def updated(self):
        """
        |  Comment: When this record last got updated
        """
        if self.updated_at:
            return dateutil.parser.parse(self.updated_at)

    @updated.setter
    def updated(self, updated):
        if updated:
            self.updated_at = updated


class Response(BaseObject):
    def __init__(self,
                 api=None,
                 comment=None,
                 delivered_at=None,
                 delivery_id=None,
                 id=None,
                 rated_at=None,
                 rating=None,
                 recipient_id=None,
                 survey_id=None,
                 survey_name=None,
                 user_email=None,
                 user_id=None,
                 user_name=None,
                 **kwargs):
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
success=None,
                 title=None,
                 **kwargs):
        self.api = api
        self.action = action
        self.errors = errors
        self.id = id
        self.status = status
        self.success = success
        self.title = title

        for key, value in kwargs.items():
            setattr(self, key, value)


class LogmeinTranscriptEvent(BaseObject):
    def __init__(self, api=None, body=None, id=None, type=None, **kwargs):
        self.api = api
        self.body = body
        self.id = id
        self.type = type

        for key, value in kwargs.items():
            setattr(self, key, value)


class Macro(BaseObject):
    def __init__(self,
                 api=None,
                 actions=None,
                 active=None,
                 created_at=None,
github facetoe / zenpy / zenpy / lib / api_objects / __init__.py View on Github external
if comment:
            self.comment_id = comment.id
            self._comment = comment


class Conditions(BaseObject):
    def __init__(self, api=None, all=None, any=None, **kwargs):
        self.api = api
        self.all = all
        self.any = any

        for key, value in kwargs.items():
            setattr(self, key, value)


class CreateEvent(BaseObject):
    def __init__(self,
                 api=None,
                 field_name=None,
                 id=None,
                 type=None,
                 value=None,
                 **kwargs):
        self.api = api
        self.field_name = field_name
        self.id = id
        self.type = type
        self.value = value

        for key, value in kwargs.items():
            setattr(self, key, value)