Esempio n. 1
0
class Tags(JsonMappedModel):
    __mapping__ = {"id": Attr('tag_id', int), "name": Attr('tag_name', str)}

    def __init__(self, tag_id, tag_name, **attrs):
        super().__init__(**attrs)
        self.tag_id = tag_id
        self.tag_name = tag_name
Esempio n. 2
0
class Category(BaseApiClass):
    __mapping__ = {
        "id": Attr("id", int),
        "name": Attr("name", str),
    }

    def __init__(self, category_id: int = None, category_name: str = None):
        self.id = category_id
        self.name = category_name
Esempio n. 3
0
class Category(JsonMappedModel):
    __mapping__ = {
        'id': Attr('categ_id', int),
        "name": Attr('categ_name', str)
    }

    def __init__(self, categ_id, categ_name, **attrs):
        super().__init__(**attrs)
        self.categ_id = categ_id
        self.categ_name = categ_name
Esempio n. 4
0
class Customer(BaseApiClass):
    __mapping__ = {
        "id": Attr("id", int),
        "username": Attr("user_name", str),
        "address": Attr("address", Address)
    }

    def __init__(self,
                 customer_id: int = None,
                 user_name: str = None,
                 address: Address = None):
        self.id = customer_id
        self.user_name = user_name
        self.address = address
Esempio n. 5
0
class User(BaseApiClass):
    __mapping__ = {
        "id": Attr("id", int),
        "name": Attr("user_name", str),
        "firstName": Attr("first_name", str),
        "lastName": Attr("last_name", str),
        "email": Attr("email", str),
        "password": Attr("password", str),
        "phone": Attr("phone", str),
        "userStatus": Attr("user_status", UserStatus),
    }

    def __init__(self,
                 user_id: int = None,
                 user_name: str = None,
                 first_name: str = None,
                 last_name: str = None,
                 email: str = None,
                 password: str = None,
                 phone: str = None,
                 user_status: UserStatus = None):
        self.id = user_id
        self.user_name = user_name
        self.first_name = first_name
        self.last_name = last_name
        self.email = email
        self.password = password
        self.phone = phone
        self.user_status = user_status
Esempio n. 6
0
class Address(BaseApiClass):
    __mapping__ = {
        "street": Attr("street", str),
        "city": Attr("city", str),
        "state": Attr("state", str),
        "zip": Attr("zip", str),
    }

    def __init__(self,
                 street: str = None,
                 city: str = None,
                 state: str = None,
                 zip_code: str = None):
        self.street = street
        self.city = city
        self.state = state
        self.zip = zip_code
Esempio n. 7
0
class Parameter(JsonMappedModel):
    __mapping__ = {
        'Name': Attr('name', str),
        'Type': Attr('type', str),
        'Value': Attr('_value', str),
        'KeyId': Attr('key_id', str),
        'Overwrite': Attr('overwrite', bool),
    }

    def __init__(self, type=None, name=None, value=None, key_id=None):
        self.type = type
        self.name = name
        self._value = value
        self.key_id = key_id
        self.overwrite = True

    @property
    def value(self):
        try:
            return json.loads(self._value)
        except ValueError:
            return self._value
Esempio n. 8
0
class Pet(JsonModel):
    __mapping__ = {
        'id': Attr('pet_id', int),
        'category': Attr('category', Category),
        'name': Attr('pet_name', str),
        'status': Attr('status', str),
        'tags': Attr('tags', [Tags]),
        'photoUrls': Attr('photo_url', [PhotoUrls])
    }

    def __init__(self, pet_id, categ_id, categ_name, pet_name, photo_url,
                 tag_id, tag_name, status, **attrs):
        super().__init__(**attrs)
        self.pet_id = pet_id
        self.pet_name = pet_name
        self.status = status
        # self.photo_url = [PhotoUrls(photo_url)]
        self.tags = [Tags(tag_id, tag_name)]
        self.category = Category(categ_id, categ_name)
Esempio n. 9
0
class Pet(BaseApiClass):
    __mapping__ = {
        "id": Attr("id", int),
        "name": Attr("name", str),
        "category": Attr("category", Category),
        "photoUrls": Attr("photo_urls", [str]),
        "tags": Attr("tags", [Tag]),
        "status": Attr("status", PetStatus),
    }

    def __init__(self,
                 pet_id: int = None,
                 name: str = None,
                 category: Category = None,
                 photo_urls: [] = None,
                 tags: [Tag] = None,
                 status: PetStatus = None):
        self.id = pet_id
        self.name = name
        self.category = category
        self.photo_urls = photo_urls
        self.tags = tags
        self.status = status
Esempio n. 10
0
class Order(BaseApiClass):
    __mapping__ = {
        "id": Attr("id", int),
        "petId": Attr("pet_id", int),
        "quantity": Attr("quantity", int),
        "shipDate": Attr("ship_date", str),
        "status": Attr("status", OrderStatus),
        "complete": Attr("complete", bool),
    }

    def __init__(self,
                 order_id: int = None,
                 pet_id: int = None,
                 quantity: int = None,
                 ship_date: str = None,
                 status: OrderStatus = None,
                 complete: bool = None):
        self.id = order_id
        self.pet_id = pet_id
        self.quantity = quantity
        self.ship_date = ship_date
        self.status = status
        self.complete = complete
Esempio n. 11
0
class ParamsResponse(JsonMappedModel):
    __mapping__ = {
        'Parameters': Attr('parameters', [Parameter]),
        'ResponseMetadata': Attr('metadata', Metadata),
        'NextToken': Attr('next_token', str),
    }
Esempio n. 12
0
 class EnumMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', TestEnum),
         'other': Attr('other', OtherEnum),
     }
Esempio n. 13
0
class Metadata(JsonMappedModel):
    __mapping__ = {
        'HTTPStatusCode': Attr('status_code', int),
        'RequestId': Attr('request_id', str),
    }
Esempio n. 14
0
 class TestMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', CustomType),
     }
Esempio n. 15
0
class TestExtendedModel(TestMappedModel):
    __mapping__ = {'second': Attr('second', str)}
Esempio n. 16
0
 class TestMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', int, coerce=False),
     }
Esempio n. 17
0
class PhotoUrls(JsonMappedModel):
    __mapping__ = {"photoUrls": Attr('photo_url', str)}

    def __init__(self, photo_url, **attrs):
        super().__init__(**attrs)
        self.photo_url = photo_url
Esempio n. 18
0
class TestListChildMapping(JsonMappedModel):
    __mapping__ = {'children': Attr('children', [TestMappedModel])}
Esempio n. 19
0
class TestDifferentAttrNaming(TestMappedModel):
    __mapping__ = {'my-thing': Attr('my_thing', str)}
Esempio n. 20
0
 class IntMappedModel(JsonMappedModel):
     __mapping__ = {'test': Attr('test', int, coerce=True)}
Esempio n. 21
0
 class FlexMapping(JsonMappedModel):
     __mapping__ = {'test': Attr('test', attr_type)}
Esempio n. 22
0
 class IntMappedModel(JsonMappedModel):
     __mapping__ = {'test': Attr('test', dict)}
Esempio n. 23
0
 class TestMappedModel(JsonMappedModel):
     __mapping__ = {
         'nope': Attr('nope', SubMappedModel),
     }
Esempio n. 24
0
 class SubMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', int),
     }
Esempio n. 25
0
class TestRequiredMappedModel(JsonMappedModel):
    __mapping__ = {
        'test': Attr('test', int),
        'other': Attr('other', int, required=True),
    }
Esempio n. 26
0
 class UUIDMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', [uuid.UUID]),
     }
Esempio n. 27
0
class Tag(BaseApiClass):
    __mapping__ = {"id": Attr("id", int), "name": Attr("name", str)}

    def __init__(self, tag_id: int = None, tag_name: str = None):
        self.id = tag_id
        self.name = tag_name
Esempio n. 28
0
 class MixedMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', int),
         'another': Attr('another', int, serialize=False)
     }
Esempio n. 29
0
 class TestMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', str),
     }
     test = ''
Esempio n. 30
0
 class StrMappedModel(JsonMappedModel):
     __mapping__ = {
         'test': Attr('test', [str]),
     }