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 OrganizationMember:
id: int = 0
organization_id: int = 0
user_id: int = 0
user_name: Optional[str] = None
is_owner: bool = False
is_moderator: bool = False
deny_all: bool = False
deny_posts: bool = False
deny_comments: bool = False
notes: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OrganizationMemberInvite:
id: int = 0
organization_id: int = 0
user_id: int = 0
user_name: Optional[str] = None
dismissed: Optional[datetime.datetime] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OrganizationSubscription:
id: int = 0
organization_id: int = 0
user_id: int = 0
user_name: Optional[str] = None
post_types: List[str] = field(default_factory=list)
frequency_days: Optional[int] = None
last_synced_id: Optional[int] = None
last_synced: Optional[datetime.datetime] = None
created: datetime.datetime = datetime.datetime(1, 1, 1)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetUserOrganizationsResponse:
members: List[OrganizationMember] = field(default_factory=list)
member_invites: List[OrganizationMemberInvite] = field(default_factory=list)
subscriptions: List[OrganizationSubscription] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetUserOrganizations(IGet):
pass
Python GetUserOrganizations DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/GetUserOrganizations HTTP/1.1
Host: techstacks.io
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
members:
[
{
id: 0,
organizationId: 0,
userId: 0,
userName: String,
isOwner: False,
isModerator: False,
denyAll: False,
denyPosts: False,
denyComments: False,
notes: String
}
],
memberInvites:
[
{
id: 0,
organizationId: 0,
userId: 0,
userName: String,
dismissed: 0001-01-01
}
],
subscriptions:
[
{
id: 0,
organizationId: 0,
userId: 0,
userName: String,
postTypes:
[
String
],
frequencyDays: 0,
lastSyncedId: 0,
lastSynced: 0001-01-01,
created: 0001-01-01
}
]
}