POST | /users/checkusername | Check username availability |
---|
import 'package:servicestack/servicestack.dart';
class ApiDtoBase implements IConvertible
{
String? ApiKey;
int? StoreId;
int? ChainId;
ApiDtoBase({this.ApiKey,this.StoreId,this.ChainId});
ApiDtoBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ApiKey = json['ApiKey'];
StoreId = json['StoreId'];
ChainId = json['ChainId'];
return this;
}
Map<String, dynamic> toJson() => {
'ApiKey': ApiKey,
'StoreId': StoreId,
'ChainId': ChainId
};
getTypeName() => "ApiDtoBase";
TypeContext? context = _ctx;
}
enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
class CheckUsernameRequest extends ApiDtoBase implements IRestrictedApiRequest, IConvertible
{
/**
* Api Key - grants access to resources
*/
// @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
String? ApiKey;
/**
* StoreId OR ChainId is required
*/
// @ApiMember(DataType="integer", Description="StoreId OR ChainId is required", Name="StoreId", ParameterType="query")
int? StoreId;
/**
* StoreId OR ChainId is required
*/
// @ApiMember(DataType="integer", Description="StoreId OR ChainId is required", Name="ChainId", ParameterType="query")
int? ChainId;
/**
* Username should be between 4 and 255 characters long
*/
// @ApiMember(DataType="string", Description="Username should be between 4 and 255 characters long", IsRequired=true, Name="Username", ParameterType="query")
String? Username;
int? RestrictedId;
RestrictedResourceType? RestrictedResourceType;
CheckUsernameRequest({this.ApiKey,this.StoreId,this.ChainId,this.Username,this.RestrictedId,this.RestrictedResourceType});
CheckUsernameRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
ApiKey = json['ApiKey'];
StoreId = json['StoreId'];
ChainId = json['ChainId'];
Username = json['Username'];
RestrictedId = json['RestrictedId'];
RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'ApiKey': ApiKey,
'StoreId': StoreId,
'ChainId': ChainId,
'Username': Username,
'RestrictedId': RestrictedId,
'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
});
getTypeName() => "CheckUsernameRequest";
TypeContext? context = _ctx;
}
class CheckUsernameResponse implements IApiResponse, IConvertible
{
bool? Valid;
int? StatusCode;
String? Message;
CheckUsernameResponse({this.Valid,this.StatusCode,this.Message});
CheckUsernameResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Valid = json['Valid'];
StatusCode = json['StatusCode'];
Message = json['Message'];
return this;
}
Map<String, dynamic> toJson() => {
'Valid': Valid,
'StatusCode': StatusCode,
'Message': Message
};
getTypeName() => "CheckUsernameResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'clubready.com', types: <String, TypeInfo> {
'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
'CheckUsernameRequest': TypeInfo(TypeOf.Class, create:() => CheckUsernameRequest()),
'CheckUsernameResponse': TypeInfo(TypeOf.Class, create:() => CheckUsernameResponse()),
});
Dart CheckUsernameRequest 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 /users/checkusername HTTP/1.1
Host: clubready.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
StoreId: 0,
ChainId: 0,
Username: String,
RestrictedId: 0,
RestrictedResourceType: Chain
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Valid: False, StatusCode: 0, Message: String }