My ServiceStack Backend

<back to all web services

UserSubRequest

The following routes are available for this service:
GET/subs/user
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 UserSubResponse:
    subscription: Optional[MSubscription] = None
    response_code: int = 0
    response_message: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UserSubRequest:
    pass

Python UserSubRequest DTOs

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

HTTP + OTHER

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

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

{"subscription":{"id":0,"name":"String","description":"String","status":false,"yearlyPrice":0,"price":0,"order":0,"icon":"String","paymentLink":"String","yearlyPaymentLink":"String","sid":"String","yearlySid":"String","discount":0,"benefits":[{"id":0,"name":"String","status":false,"order":0,"image":"String","subBenefits":[{"id":0,"name":"String","status":false,"order":0,"hasContent":false,"image":"String","rssHash":"String"}]}]},"responseCode":0,"responseMessage":"String"}