# Path: pykintone/result.py
# class Result(object):
# 
#     def __init__(self, response):
#         self.ok = response.ok
#         self.message = ""
#         self.error = None
#         if not self.ok:
#             _e = response.json()
#             self.error = Error(_e["message"], _e["id"], _e["code"])
#             self.detail = {}
#             if "errors" in _e:
#                 self.detail = _e["errors"]


from pykintone.result import Result
                from pykintone.user_api.user import User
                from pykintone.user_api.organization import Organization
                from pykintone.user_api.title import Title
                from collections import namedtuple
                from pykintone.user_api.group import Group
    def __init__(self, response):
        super(GetUsersResult, self).__init__(response)
        self.raw = []
        self.users = []
        if self.ok:
            serialized = response.json()
            if "users" in serialized:
                self.raw = serialized["users"]
                self.users = [User.deserialize(u) for u in self.raw]


class UserOrganizationTitlesResult(Result):

    def __init__(self, response):
        super(UserOrganizationTitlesResult, self).__init__(response)
        self.raw = []
        self.organization_titles = []
        if self.ok:
            serialized = response.json()
            if "organizationTitles" in serialized:
                self.raw = serialized["organizationTitles"]
                OrganizationTitle = namedtuple("OrganizationTitle", ["organization", "title"])
                for ot in self.raw:
                    o = Organization.deserialize(ot["organization"])
                    t = None
                    if ot["title"] is not None:
                        t = Title.deserialize(ot["title"])
                    self.organization_titles.append(OrganizationTitle(o, t))



# Path: pykintone/result.py
# class Result(object):
# 
#     def __init__(self, response):
#         self.ok = response.ok
#         self.message = ""
#         self.error = None
#         if not self.ok:
#             _e = response.json()
#             self.error = Error(_e["message"], _e["id"], _e["code"])
#             self.detail = {}
#             if "errors" in _e:
#                 self.detail = _e["errors"]


# Path: pykintone/user_api/user_api_result.py
from pykintone.result import Result
                from pykintone.user_api.user import User
                from pykintone.user_api.organization import Organization
                from pykintone.user_api.title import Title
                from collections import namedtuple
                from pykintone.user_api.group import Group

    def __init__(self, response):
        super(GetUsersResult, self).__init__(response)
        self.raw = []
        self.users = []
        if self.ok:
            serialized = response.json()
            if "users" in serialized:
                self.raw = serialized["users"]
                self.users = [User.deserialize(u) for u in self.raw]


class UserOrganizationTitlesResult(Result):

    def __init__(self, response):
        super(UserOrganizationTitlesResult, self).__init__(response)
        self.raw = []
        self.organization_titles = []
        if self.ok:
            serialized = response.json()
            if "organizationTitles" in serialized:
                self.raw = serialized["organizationTitles"]
                OrganizationTitle = namedtuple("OrganizationTitle", ["organization", "title"])
                for ot in self.raw:
                    o = Organization.deserialize(ot["organization"])
                    t = None
                    if ot["title"] is not None:
                        t = Title.deserialize(ot["title"])
                    self.organization_titles.append(OrganizationTitle(o, t))



class GetUserGroupsResult(Result):