POST | /users/passwordreset | Send password reset email to a 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 ApiDtoBase:
api_key: Optional[str] = None
store_id: Optional[int] = None
chain_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PasswordResetRequestDto(ApiDtoBase):
email: Optional[str] = None
username: Optional[str] = None
filter: int = 0
class RestrictedResourceType(str, Enum):
STORE = 'Store'
CHAIN = 'Chain'
USER = 'User'
UNDEFINED = 'Undefined'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PasswordResetRequest(PasswordResetRequestDto, IRestrictedApiRequest):
# @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
api_key: Optional[str] = None
"""
Api Key - grants access to resources
"""
# @ApiMember(DataType="integer", Description="ClubReady Club ID (StoreID internally)", Name="StoreId", ParameterType="query")
store_id: Optional[int] = None
"""
ClubReady Club ID (StoreID internally)
"""
# @ApiMember(DataType="integer", Description="StoreId OR ChainId is required", Name="ChainId", ParameterType="query")
chain_id: Optional[int] = None
"""
StoreId OR ChainId is required
"""
# @ApiMember(DataType="string", Description="ClubReady username", Name="UserName", ParameterType="query")
username: Optional[str] = None
"""
ClubReady username
"""
# @ApiMember(DataType="string", Description="User's email address.", Name="Email", ParameterType="query")
email: Optional[str] = None
"""
User's email address.
"""
# @ApiMember(DataType="integer", Description="0 = All, 1 = Prospects, 2 = Active, 3 = Inactive, 4 = All Members, 5 = Past Due", Name="Filter", ParameterType="query")
filter: int = 0
"""
0 = All, 1 = Prospects, 2 = Active, 3 = Inactive, 4 = All Members, 5 = Past Due
"""
restricted_id: Optional[int] = None
restricted_resource_type: Optional[RestrictedResourceType] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiResponseBase:
success: bool = False
message: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PasswordResetResponseDto(ApiResponseBase):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PasswordResetResponse(PasswordResetResponseDto):
success: bool = False
message: Optional[str] = None
Python PasswordResetRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /users/passwordreset HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PasswordResetRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Members.Model">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
<ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
<StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
<Email xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Email>
<Filter xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</Filter>
<Username xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Username>
</PasswordResetRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <PasswordResetResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Members.Model"> <Message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Message> <Success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Success> </PasswordResetResponse>