GET | /user/current |
---|
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 ResponseBase:
response_status: Optional[ResponseStatus] = None
class BusinessType(IntEnum):
COMPANY = 0
PRIVATE_ENTREPRENEUR = 1
NON_PROFIT = 2
LAW_OFFICE = 3
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupplierSimple:
id: int = 0
owner_id: int = 0
vat_number: Optional[str] = None
business_type: Optional[BusinessType] = None
country_id: int = 0
name: Optional[str] = None
short_name: Optional[str] = None
registration_number: Optional[str] = None
established_date: datetime.datetime = datetime.datetime(1, 1, 1)
registration_date: datetime.datetime = datetime.datetime(1, 1, 1)
duns: Optional[str] = None
operating_license_number: Optional[str] = None
is_accounting: bool = False
is_small_tax_payer: bool = False
email: Optional[str] = None
phone_number: Optional[str] = None
website: Optional[str] = None
class SupplierStatus(IntEnum):
REGISTERED = 0
AWAITING_VEOLIA_CONFIRMATION = 1
ACTIVE = 2
REJECTED = 3
LOCKED = 4
DELETED = 5
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CurrentSupplier(SupplierSimple):
status: Optional[SupplierStatus] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CurrentUser:
id: int = 0
email: Optional[str] = None
user_name: Optional[str] = None
phone_number: Optional[str] = None
display_name: Optional[str] = None
organization_unit: Optional[str] = None
position: Optional[str] = None
status: int = 0
supplier: Optional[CurrentSupplier] = None
roles: Optional[List[str]] = None
permissions: Optional[List[str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BrowseCurrentUserResponse(ResponseBase):
user: Optional[CurrentUser] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BrowseCurrentUser(IGet):
pass
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.
GET /user/current HTTP/1.1 Host: szallitoiportal-be.veolia.hu Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { User: { Id: 0, Email: String, UserName: String, PhoneNumber: String, DisplayName: String, OrganizationUnit: String, Position: String, Status: 0, Supplier: { Status: 0, Id: 0, OwnerId: 0, VatNumber: String, BusinessType: 0, CountryId: 0, Name: String, ShortName: String, RegistrationNumber: String, EstablishedDate: 0001-01-01, RegistrationDate: 0001-01-01, Duns: String, OperatingLicenseNumber: String, IsAccounting: False, IsSmallTaxPayer: False, Email: String, PhoneNumber: String, Website: String }, Roles: [ String ], Permissions: [ String ] }, ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } }