Ejemplo n.º 1
0
class UserSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'users'
        url = 'user_management/users'
        create_url = 'users/register'
        authorise_url = 'users/{}/authorise'
        magic_fields_url = 'users/{}/magic_fields'
        model = User

    id = fields.Int()
    auth_type = fields.String(data_key='authType', missing=None)
    email = fields.Email()
    password = fields.String()
    device_id = RelatedResourceLinkField(schema=DeviceSchema,
                                         data_key='device')
    user_info = fields.Nested(UserInfoSchema, data_key='userInfo')
    cohorts = RelatedResourceLinkField(schema=CohortSchema, many=True)
    magic_fields = RelatedResourceField(schema=MagicFieldSchema,
                                        many=True,
                                        data_key='magicFields')
    devices = RelatedResourceField(schema=DeviceSchema,
                                   many=True,
                                   data_key='devices')
    user_emails = RelatedResourceField(schema=UserEmailSchema,
                                       data_key='userEmails',
                                       many=True)
    user_consent = RelatedResourceField(schema=UserConsentSchema,
                                        data_key='userConsent')
    token = fields.String(missing=None)
Ejemplo n.º 2
0
class LeagueTableSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'league_tables'
        url = 'league_tables'
        model = LeagueTable

    id = fields.Int(required=False, allow_none=False)
    team_id = RelatedResourceLinkField(schema=TeamSchema, data_key='team')
    external_id = fields.String(required=True,
                                allow_none=True,
                                data_key='externalId')
    featured_team = fields.Boolean(required=True,
                                   allow_none=False,
                                   data_key='featuredTeam')
    position = fields.Int(missing=0)
    played = fields.Int(missing=0)
    goals_for = fields.Int(data_key='goalsFor', missing=0)
    goals_against = fields.Int(data_key='goalsAgainst', missing=0)
    start_day_position = fields.Int(data_key='startDayPosition', missing=0)
    won = fields.Int(missing=0)
    lost = fields.Int(missing=0)
    drawn = fields.Int(missing=0)
    goal_difference = fields.Int(data_key='goalDifference', missing=0)
    points = fields.Int(missing=0)
    competition_id = RelatedResourceLinkField(schema=CompetitionSchema,
                                              data_key='competition')
    season_id = RelatedResourceLinkField(schema=SeasonSchema,
                                         data_key='season')
    group_id = RelatedResourceLinkField(schema=LeagueTableGroupSchema,
                                        data_key='group')
Ejemplo n.º 3
0
class ProductVariantSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = ProductVariant
        url = 'sell/product_variants'
        api_type = 'product_variants'

    class ProductVariantTranslationSchema(Schema):
        class Meta:
            unknown = EXCLUDE

        language = fields.String()
        title = fields.String()

    id = fields.Int()
    price = fields.Integer()
    stocks = RelatedResourceLinkField(schema=ProductVariantStocksSchema,
                                      many=True,
                                      missing=[],
                                      microservice_aware=True)
    product = RelatedResourceLinkField(
        schema='livestyled.schemas.product.ProductSchema',
        microservice_aware=True)
    external_id = fields.String(missing=None, data_key='externalId')
    translations = fields.Nested(ProductVariantTranslationSchema,
                                 many=True,
                                 missing=None)
Ejemplo n.º 4
0
class PaymentIntentSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'payment_intents'
        url = 'payment/payment_intents'
        model = PaymentIntent

    id = fields.Int(missing=None)
    external_id = fields.String(data_key='externalId',
                                missing=None,
                                allow_none=True)
    payment_source = RelatedResourceLinkField(schema=PaymentSourceSchema,
                                              data_key='paymentSource',
                                              microservice_aware=True,
                                              missing=None)
    payment_customer = RelatedResourceLinkField(schema=PaymentCustomerSchema,
                                                data_key='paymentCustomer',
                                                microservice_aware=True,
                                                missing=None)
    status = fields.String()
    amount = fields.Int()
    currency = fields.String()
    last_payment_error = fields.String(data_key='lastPaymentError',
                                       missing=None)
    live_mode = fields.Bool(data_key='livemode')
    save_payment_source = fields.Bool(data_key='savePaymentSource')
    next_action = fields.Dict(data_key='nextAction',
                              missing=None,
                              allow_none=True)
    order_type = fields.String(data_key='orderType')
    order = RelatedResourceLinkField(schema=OrderSchema,
                                     data_key='orderId',
                                     microservice_aware=True)
Ejemplo n.º 5
0
class ProductVariantStockSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = ProductVariantStock
        api_type = 'product_variant_stocks'
        url = 'sell/product_variant_stocks'

    initial = fields.Integer()
    on_hand = fields.Integer(missing=None, data_key='onHand')
    fulfilment_point = RelatedResourceLinkField(schema=FulfilmentPointSchema, microservice_aware=True, data_key='fulfilmentPoint')
    product_variant = RelatedResourceLinkField(schema=ProductVariantSchema, microservice_aware=True, data_key='productVariant')
Ejemplo n.º 6
0
class DevicePreferenceSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = DevicePreference
        api_type = 'device_preferences'
        url = 'device_preferences'
        default_ordering = '-createdAt'

    id = fields.Int()
    created_at = fields.AwareDateTime(data_key='createdAt')
    venue_id = RelatedResourceLinkField(schema=VenueSchema, data_key='venue', allow_none=True)
    device_id = RelatedResourceLinkField(schema=DeviceSchema, data_key='device', microservice_aware=True)
    event_id = RelatedResourceLinkField(schema=EventSchema, data_key='event', allow_none=True)
Ejemplo n.º 7
0
class MerchantAccountFulfilmentPointSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'merchant_account_fulfilment_points'
        url = 'payment/merchant_account_fulfilment_points'
        model = MerchantAccountFulfilmentPoint

    id = fields.Int(missing=None)
    merchant_account = RelatedResourceLinkField(schema=MerchantAccountSchema,
                                                data_key='merchantAccount',
                                                microservice_aware=True)
    fulfilment_point = RelatedResourceLinkField(schema=FulfilmentPointSchema,
                                                data_key='fulfilmentPoint',
                                                microservice_aware=True)
Ejemplo n.º 8
0
class AudienceDeviceSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'audience_devices'
        url = 'user_management/audience_devices'
        model = AudienceDevice

    audience = RelatedResourceLinkField(schema=AudienceSchema,
                                        microservice_aware=True)
    device = RelatedResourceLinkField(schema=DeviceSchema,
                                      microservice_aware=True)
    created_at = fields.AwareDateTime(data_key='createdAt',
                                      allow_none=True,
                                      missing=None)
Ejemplo n.º 9
0
class DeviceFormDataSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = DeviceFormData
        api_type = 'form_data'
        url = 'engage/form_data'
        default_ordering = 'id'

    id = fields.Int()
    expires_at = fields.AwareDateTime(data_key='expiresAt', load_only=True, allow_none=True)
    created_at = fields.AwareDateTime(data_key='createdAt', load_only=True, allow_none=True)
    updated_at = fields.AwareDateTime(data_key='updatedAt', load_only=True, allow_none=True)
    data = fields.List(fields.Inferred, data_key='data')
    device_id = RelatedResourceLinkField(schema=DeviceSchema, data_key='device', microservice_aware=True)
    form_id = RelatedResourceLinkField(schema=FormSchema, data_key='form', microservice_aware=True)
Ejemplo n.º 10
0
class EventSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'events'
        url = 'events'
        model = Event

    id = fields.Int()
    status = fields.String()
    type = fields.String()
    title = fields.String()
    description = fields.String()
    image_url = fields.Url(data_key='imageUrl')
    promoted = fields.Boolean()
    event_dates = fields.Nested(EventDateSchema,
                                data_key='eventDates',
                                many=True)
    app = fields.Function(get_id_from_url)
    venues = fields.List(RelatedResourceLinkField(schema=VenueSchema),
                         many=True,
                         missing=None)
    artists = fields.List(fields.Inferred),  # TODO
    useful_info = fields.List(fields.Inferred, data_key='usefulInfo'),  # TODO
    user_actions = fields.List(fields.Inferred,
                               data_key='userActions'),  # TODO
    social_media = fields.List(fields.Inferred,
                               data_key='socialMedia'),  # TODO
    translations = fields.List(fields.Inferred),  # TODO
    updated_at = fields.AwareDateTime(data_key='updatedAt', allow_none=True)
    created_at = fields.AwareDateTime(data_key='createdAt', allow_none=True)
    core_event_category = fields.Nested(CoreEventCategory,
                                        data_key='coreEventCategory',
                                        missing=None)
Ejemplo n.º 11
0
class MerchantAccountFulfilmentPointPspTokenSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'merchant_account_fulfilment_point_psp_tokens'
        url = 'payment/merchant_account_fulfilment_point_psp_tokens'
        model = MerchantAccountFulfilmentPointPspToken

    id = fields.Int(missing=None)
    merchant_account_fulfilment_point = RelatedResourceLinkField(
        schema=MerchantAccountFulfilmentPointSchema,
        data_key='merchantAccountFulfilmentPoint',
        microservice_aware=True)
    payment_source = RelatedResourceLinkField(schema=PaymentSourceSchema,
                                              data_key='paymentSource',
                                              microservice_aware=True)
    psp_token = fields.String(data_key='pspToken')
Ejemplo n.º 12
0
class BookingSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = Booking
        api_type = 'bookings'
        url = 'bookings'

    id = fields.Int()
    title = fields.String()
    device_id = RelatedResourceLinkField(schema=DeviceSchema, data_key='device')
    user_id = RelatedResourceLinkField(schema=UserSchema, data_key='user')
    event_id = RelatedResourceLinkField(schema=EventSchema, data_key='event')
    updated_at = fields.AwareDateTime(data_key='updatedAt', allow_none=True)
    created_at = fields.AwareDateTime(data_key='createdAt', allow_none=True)
    action = fields.String()
    type = fields.String()
Ejemplo n.º 13
0
class AudienceRealityValuesSchema(Schema):
    class Meta:
        unknown = EXCLUDE

    reality = RelatedResourceLinkField(schema=RealitySchema,
                                       microservice_aware=True)
    values = fields.Nested(AudienceRealityValuesValueSchema, many=True)
Ejemplo n.º 14
0
class TicketAuthSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'ticket_auths'
        url = 'ticket_auths'
        model = TicketAuth

    id = fields.Int()
    client_email = fields.String(required=False,
                                 missing=None,
                                 data_key='clientEmail')
    client_id = fields.String(required=False,
                              missing=None,
                              data_key='clientId')
    access_token = fields.String(required=False,
                                 missing=None,
                                 data_key='accessToken')
    expire_at = fields.AwareDateTime(data_key='expireAt',
                                     allow_none=False,
                                     missing=None)
    refresh_token = fields.String(required=False,
                                  missing=None,
                                  data_key='refreshToken')
    user_email = RelatedResourceField(schema=UserEmailSchema,
                                      required=False,
                                      missing=None,
                                      data_key='userEmail')
    ticket_integration = RelatedResourceLinkField(
        schema=TicketIntegrationSchema,
        required=False,
        missing=None,
        data_key='ticketIntegration')
Ejemplo n.º 15
0
class DevicePushConsentSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = DevicePushConsent

    id = fields.Int()
    consent = fields.Boolean()
    push_consent_id = RelatedResourceLinkField(schema=PushConsentSchema, data_key='pushConsent')
Ejemplo n.º 16
0
def parent_ticket_selector(parent_ticket, ticket):
    if isinstance(parent_ticket, str):
        return RelatedResourceLinkField(schema=Ticket,
                                        required=False,
                                        missing=None,
                                        data_key='parentTicket')
    elif isinstance(parent_ticket, dict):
        return fields.Nested(TicketSchema)
Ejemplo n.º 17
0
class DeviceRealitySchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'device_realities'
        url = 'user_management/device_realities'
        model = DeviceReality

    id = fields.Int()
    reality = RelatedResourceLinkField(schema=RealitySchema,
                                       allow_none=False,
                                       microservice_aware=True)
    device = RelatedResourceLinkField(schema=DeviceSchema,
                                      allow_none=False,
                                      microservice_aware=True)
    value = fields.String(missing=None)
    updated_at = fields.AwareDateTime(data_key='updatedAt',
                                      allow_none=True,
                                      missing=None)
    created_at = fields.AwareDateTime(data_key='createdAt',
                                      allow_none=True,
                                      missing=None)
Ejemplo n.º 18
0
class ProductModifierItemSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = ProductModifierItem
        url = 'sell/product_modifier_items'

    id = fields.Int()
    external_id = fields.String(data_key='externalId')
    additional_price = fields.Integer(data_key='additionalPrice')
    translations = fields.Nested(ProductModifierItemTranslationsSchema, many=True, missing=[])
    modifier_list = RelatedResourceLinkField('livestyled.schemas.product.ProductModifierListSchema', data_key='modifierList', microservice_aware=True)
    status = fields.String(missing=None)
Ejemplo n.º 19
0
class FulfilmentPointSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'fulfilment_points'
        url = 'sell/fulfilment_points'
        model = FulfilmentPoint

    id = fields.Int()
    status = fields.String()
    image_url = fields.String(data_key='imageUrl', missing=None)
    map_image_url = fields.String(data_key='mapImageUrl', missing=None)
    lat = fields.String(missing=None)
    long = fields.String(missing=None)
    type = fields.String(missing=None)
    position = fields.Int(missing=None)
    reference = fields.String(missing=None)
    translations = fields.Nested(FulfilmentPointTranslationSchema, many=True)
    categories = RelatedResourceField(schema=FulfilmentPointCategorySchema, many=True, missing=[])
    venue = RelatedResourceLinkField(schema=VenueSchema, required=False, missing=None)
    external_id = fields.String(missing=None, data_key='externalId')
    audiences = fields.List(RelatedResourceLinkField(schema=AudienceSchema, microservice_aware=True), many=True, missing=[])
Ejemplo n.º 20
0
class UserCreateSchema(Schema):
    class Meta:
        api_type = 'users'
        create_url = 'users/register'
        model = User

    auth_type = fields.String(data_key='authType')
    first_name = fields.String(data_key='firstName')
    last_name = fields.String(data_key='lastName')
    email = fields.Email()
    password = fields.String()
    device_id = RelatedResourceLinkField(schema=DeviceSchema,
                                         data_key='device')
Ejemplo n.º 21
0
class PaymentCustomerSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'payment_customers'
        url = 'payment/payment_customers'
        model = PaymentCustomer

    id = fields.Int(missing=None)
    user_id = RelatedResourceLinkField(schema=UserSchema,
                                       data_key='user',
                                       microservice_aware=True)
    external_ids = fields.Dict(data_key='externalIds')
    payment_sources = fields.List(fields.Dict(), data_key='paymentSources')
Ejemplo n.º 22
0
class DeviceTokenSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'device_tokens'
        url = 'device_tokens'
        model = DeviceToken

    id = fields.Int()
    provider = fields.String()
    provider_token = fields.String(data_key='providerToken')
    payload = fields.Raw(allow_none=True)
    device_id = RelatedResourceLinkField(schema=DeviceSchema,
                                         data_key='device')
Ejemplo n.º 23
0
class FixtureSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'fixtures'
        url = 'fixtures'
        model = Fixture

    class ScoreSchema(Schema):
        goals = fields.Int(allow_none=True)
        penalties = fields.Int(allow_none=True)

    class FixtureUrlSchema(Schema):
        class Meta:
            unknown = EXCLUDE

        title = fields.String(allow_none=True)
        url = fields.String(allow_none=True)
        is_enabled = fields.Boolean()

    id = fields.Int(load_only=True)
    start_at = fields.DateTime(data_key='startAt')
    is_fulltime = fields.Boolean(data_key='isFullTime')
    is_terminated = fields.Boolean(data_key='isTerminated')
    home_id = RelatedResourceLinkField(schema=TeamSchema, data_key='home')
    away_id = RelatedResourceLinkField(schema=TeamSchema, data_key='away')
    home_score = fields.Nested(ScoreSchema, data_key='homeScore')
    away_score = fields.Nested(ScoreSchema, data_key='awayScore')
    season_id = RelatedResourceLinkField(schema=SeasonSchema,
                                         data_key='season')
    competition_id = RelatedResourceLinkField(schema=CompetitionSchema,
                                              data_key='competition')
    venue_id = RelatedResourceLinkField(schema=SportVenueSchema,
                                        data_key='sportVenue')
    external_id = fields.String(missing=None, data_key='externalId')
    status = fields.String()
    url = fields.Nested(FixtureUrlSchema, allow_none=True, missing=None)
    allow_overwrite = fields.Boolean(data_key='allowOverwrite')
Ejemplo n.º 24
0
class MagicFieldSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'magic_fields'
        url = 'magic_fields'
        model = MagicField

    id = fields.Int()
    key = fields.String()
    value = fields.String()
    user_id = RelatedResourceLinkField(
        schema='livestyled.schemas.user.UserSchema',
        required=False,
        missing=None,
        data_key='user')
Ejemplo n.º 25
0
class UserSSOSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'user_sso'
        url = 'user_ssos'
        model = UserSSO

    id = fields.Int()
    access_token = fields.String(data_key='accessToken',
                                 missing=None,
                                 allow_none=True)
    refresh_token = fields.String(data_key='refreshToken',
                                  missing=None,
                                  allow_none=True)
    sub = fields.String()
    expires = fields.AwareDateTime(missing=None, allow_none=True)
    user_id = RelatedResourceLinkField(schema=UserSchema, data_key='user')
Ejemplo n.º 26
0
class MerchantAccountSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'merchant_accounts'
        url = 'payment/merchant_accounts'
        model = MerchantAccount

    id = fields.Int(missing=None)
    status = fields.String()
    payment_gateway_id = RelatedResourceLinkField(schema=PaymentGatewaySchema,
                                                  data_key='paymentGateway',
                                                  microservice_aware=True)
    config = fields.Dict(allow_none=True)
    label = fields.String()
    fulfilment_points = RelatedResourceField(schema=FulfilmentPointSchema,
                                             many=True,
                                             data_key='fulfilmentPoints')
Ejemplo n.º 27
0
class ScreenVariationSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'screen_variation'
        url = 'canvas/screen_variations'
        model = ScreenVariation

    id = fields.Int()
    priority = fields.Int()
    created_at = fields.DateTime(data_key='createdAt',
                                 required=False,
                                 missing=None)
    updated_at = fields.DateTime(data_key='updatedAt',
                                 required=False,
                                 missing=None)
    screen = RelatedResourceLinkField(schema=ScreenSchema,
                                      allow_none=False,
                                      microservice_aware=True)
Ejemplo n.º 28
0
class PushBroadcastSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'push_broadcasts'
        url = 'push_broadcasts'
        publish_url = 'push_broadcasts/publish'
        model = PushBroadcast

    id = fields.Int(required=False, allow_none=False)
    title = fields.String(data_key='title')
    message = fields.String(data_key='message')
    deep_link = fields.String(data_key='deepLink')
    ttl = fields.Int()
    message_id = fields.String(data_key='messageId')
    delivered = fields.Int()
    updated_at = fields.AwareDateTime(data_key='updatedAt', allow_none=True)
    created_at = fields.AwareDateTime(data_key='createdAt', allow_none=True)
    push_consent_id = RelatedResourceLinkField(schema=PushConsentSchema,
                                               data_key='pushConsent')
Ejemplo n.º 29
0
class ProductSchema(Schema):
    class Meta:
        unknown = EXCLUDE
        model = Product
        api_type = 'products'
        url = 'sell/products'

    id = fields.Int()
    status = fields.String(missing=None)
    reference = fields.String(missing=None)
    modifier_lists = fields.List(RelatedResourceLinkField(schema=ProductModifierListSchema, microservice_aware=True), data_key='modifierLists', many=True, missing=None)
    external_id = fields.String(data_key='externalId', missing=None)
    holding_time = fields.Raw(missing=None, data_key='holdingTime')
    reconciliation_group = fields.Raw(missing=None, data_key='reconciliation_group')
    images = fields.Nested(ProductImageSchema, many=True)
    categories = RelatedResourceField(schema=ProductCategorySchema, many=True, missing=[], microservice_aware=True)
    translations = fields.Nested(ProductTranslationSchema, many=True, missing=[])
    fulfilment_points = RelatedResourceField(schema=FulfilmentPointSchema, many=True, missing=[], data_key='fulfilmentPoints', microservice_aware=True)
    variants = RelatedResourceField(schema=ProductVariantSchema, many=True, missing=[], microservice_aware=True)
    core_product_category = fields.Nested(CoreProductCategorySchema, missing=None, data_key='coreProductCategory')
Ejemplo n.º 30
0
class RealitySchema(Schema):
    class Meta:
        unknown = EXCLUDE
        api_type = 'realities'
        url = 'user_management/realities'
        model = Reality

    id = fields.Int()
    reality_type = RelatedResourceLinkField(schema=RealityTypeSchema,
                                            allow_none=False,
                                            data_key='realityType',
                                            microservice_aware=True)
    name = fields.String(missing=None)
    config = fields.Raw(missing={})
    updated_at = fields.AwareDateTime(data_key='updatedAt',
                                      allow_none=True,
                                      missing=None)
    created_at = fields.AwareDateTime(data_key='createdAt',
                                      allow_none=True,
                                      missing=None)
    status = fields.String()