BokaMera.API.Host

<back to all web services

LicensePlanQuery

The following routes are available for this service:
GET/licenses/plans/Get all license plansThis service is used to get get all license plans that exists.
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
Object = TypeVar('Object')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryBase:
    skip: Optional[int] = None
    take: Optional[int] = None
    order_by: Optional[str] = None
    order_by_desc: Optional[str] = None
    include: Optional[str] = None
    fields: Optional[str] = None
    meta: Optional[Dict[str, str]] = None


From = TypeVar('From')
Into = TypeVar('Into')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryDb2(Generic[From, Into], QueryBase, IReturn[QueryResponse[Into]]):
    @staticmethod
    def response_type(): return QueryResponse[Into]


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VossPlanResponse:
    id: Optional[str] = None
    name: Optional[str] = None
    length_unit: Optional[str] = None
    length: Optional[str] = None


class LengthUnit(IntEnum):
    WEEK = 1
    MONTH = 2
    YEAR = 3


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicensePlanQueryResponse:
    id: int = 0
    voss_plan_id: Optional[str] = None
    name: Optional[str] = None
    description: Optional[str] = None
    voss_plan: Optional[VossPlanResponse] = None
    plan_length: int = 0
    plan_length_unit: Optional[LengthUnit] = None
    updated_date: datetime.datetime = datetime.datetime(1, 1, 1)
    created_date: datetime.datetime = datetime.datetime(1, 1, 1)
    active: bool = False


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


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicensePlan(BaseModel, IBaseModelUpdated, IBaseModelCreated):
    # @Ignore()
    voss_plan: Optional[VossPlanResponse] = None

    # @Required()
    id: int = 0

    voss_plan_id: Optional[str] = None
    # @Required()
    plan_length: int = 0

    # @Required()
    plan_length_unit_id: int = 0

    # @Required()
    name: Optional[str] = None

    # @Required()
    description: Optional[str] = None

    updated_date: datetime.datetime = datetime.datetime(1, 1, 1)
    active: bool = False
    created_date: datetime.datetime = datetime.datetime(1, 1, 1)


# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicensePlanQuery(QueryDb2[LicensePlan, LicensePlanQueryResponse]):
    # @ApiMember(Description="Search active plan.", ParameterType="query")
    active: bool = False
    """
    Search active plan.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AccessKeyTypeResponse:
    id: int = 0
    key_type: Optional[str] = None
    description: Optional[str] = None


T = TypeVar('T')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryResponse(Generic[T]):
    offset: int = 0
    total: int = 0
    results: List[AccessKeyTypeResponse] = field(default_factory=list)
    meta: Optional[Dict[str, str]] = None
    response_status: Optional[ResponseStatus] = None

Python LicensePlanQuery DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /licenses/plans/ HTTP/1.1 
Host: api-staging.bookmore.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"Id":0,"Name":"String","Description":"String","VossPlan":{"Name":"String","LengthUnit":"String","Length":"String"},"PlanLength":0,"PlanLengthUnit":"Week","Active":false}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}