My ServiceStack Backend

<back to all web services

SubsRequest

The following routes are available for this service:
GET/subs
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MSubBenefit:
    id: int = 0
    name: Optional[str] = None
    status: bool = False
    order: int = 0
    has_content: bool = False
    image: Optional[str] = None
    rss_hash: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MBenefit:
    id: int = 0
    name: Optional[str] = None
    status: bool = False
    order: int = 0
    image: Optional[str] = None
    sub_benefits: Optional[List[MSubBenefit]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MSubscription:
    id: int = 0
    name: Optional[str] = None
    description: Optional[str] = None
    status: bool = False
    yearly_price: Decimal = decimal.Decimal(0)
    price: Decimal = decimal.Decimal(0)
    order: int = 0
    icon: Optional[str] = None
    payment_link: Optional[str] = None
    yearly_payment_link: Optional[str] = None
    sid: Optional[str] = None
    yearly_sid: Optional[str] = None
    discount: Decimal = decimal.Decimal(0)
    benefits: Optional[List[MBenefit]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SubsResponse:
    subscriptions: Optional[List[MSubscription]] = None
    response_code: int = 0
    response_message: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SubsRequest:
    lang: Optional[str] = None

Python SubsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /subs HTTP/1.1 
Host: portal-api.migrantleap.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<SubsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MigrantLeap.PortalBackend.Models">
  <ResponseCode>0</ResponseCode>
  <ResponseMessage>String</ResponseMessage>
  <Subscriptions xmlns:d2p1="http://schemas.datacontract.org/2004/07/MigrantLeap.PortalBackend.Providers.Models">
    <d2p1:MSubscription>
      <d2p1:Benefits>
        <d2p1:MBenefit>
          <d2p1:Id>0</d2p1:Id>
          <d2p1:Image>String</d2p1:Image>
          <d2p1:Name>String</d2p1:Name>
          <d2p1:Order>0</d2p1:Order>
          <d2p1:Status>false</d2p1:Status>
          <d2p1:SubBenefits>
            <d2p1:MSubBenefit>
              <d2p1:HasContent>false</d2p1:HasContent>
              <d2p1:Id>0</d2p1:Id>
              <d2p1:Image>String</d2p1:Image>
              <d2p1:Name>String</d2p1:Name>
              <d2p1:Order>0</d2p1:Order>
              <d2p1:RSSHash>String</d2p1:RSSHash>
              <d2p1:Status>false</d2p1:Status>
            </d2p1:MSubBenefit>
          </d2p1:SubBenefits>
        </d2p1:MBenefit>
      </d2p1:Benefits>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Discount>0</d2p1:Discount>
      <d2p1:Icon>String</d2p1:Icon>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:Order>0</d2p1:Order>
      <d2p1:PaymentLink>String</d2p1:PaymentLink>
      <d2p1:Price>0</d2p1:Price>
      <d2p1:Sid>String</d2p1:Sid>
      <d2p1:Status>false</d2p1:Status>
      <d2p1:YearlyPaymentLink>String</d2p1:YearlyPaymentLink>
      <d2p1:YearlyPrice>0</d2p1:YearlyPrice>
      <d2p1:YearlySid>String</d2p1:YearlySid>
    </d2p1:MSubscription>
  </Subscriptions>
</SubsResponse>