POST | /club/guest-pass/create | Create a guest pass for a user. |
---|
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;
}
class CreateGuestPassRequestDto extends ApiDtoBase implements IConvertible
{
int? UserId;
int? GuestPassTypeId;
bool? Activated;
DateTime? Expires;
CreateGuestPassRequestDto({this.UserId,this.GuestPassTypeId,this.Activated,this.Expires});
CreateGuestPassRequestDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
UserId = json['UserId'];
GuestPassTypeId = json['GuestPassTypeId'];
Activated = json['Activated'];
Expires = JsonConverters.fromJson(json['Expires'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'UserId': UserId,
'GuestPassTypeId': GuestPassTypeId,
'Activated': Activated,
'Expires': JsonConverters.toJson(Expires,'DateTime',context!)
});
getTypeName() => "CreateGuestPassRequestDto";
TypeContext? context = _ctx;
}
enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
class CreateGuestPassRequest extends CreateGuestPassRequestDto 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;
/**
* User ID
*/
// @ApiMember(DataType="string", Description="User ID", IsRequired=true, Name="UserId", ParameterType="query")
int? UserId;
/**
* Store ID
*/
// @ApiMember(DataType="integer", Description="Store ID", IsRequired=true, Name="StoreId", ParameterType="query")
int? StoreId;
/**
* Guest pass type to create.
*/
// @ApiMember(DataType="integer", Description="Guest pass type to create.", IsRequired=true, Name="GuestPassTypeId", ParameterType="query")
int? GuestPassTypeId;
/**
* Activate this Guest Pass immediately? (True or False)
*/
// @ApiMember(DataType="bool", Description="Activate this Guest Pass immediately? (True or False)", IsRequired=true, Name="Activated", ParameterType="query")
bool? Activated;
/**
* When will this pass expire? (leave blank for never)
*/
// @ApiMember(DataType="datetime", Description="When will this pass expire? (leave blank for never)", Name="Expires", ParameterType="query")
DateTime? Expires;
int? RestrictedId;
RestrictedResourceType? RestrictedResourceType;
CreateGuestPassRequest({this.ApiKey,this.UserId,this.StoreId,this.GuestPassTypeId,this.Activated,this.Expires,this.RestrictedId,this.RestrictedResourceType});
CreateGuestPassRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
ApiKey = json['ApiKey'];
UserId = json['UserId'];
StoreId = json['StoreId'];
GuestPassTypeId = json['GuestPassTypeId'];
Activated = json['Activated'];
Expires = JsonConverters.fromJson(json['Expires'],'DateTime',context!);
RestrictedId = json['RestrictedId'];
RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'ApiKey': ApiKey,
'UserId': UserId,
'StoreId': StoreId,
'GuestPassTypeId': GuestPassTypeId,
'Activated': Activated,
'Expires': JsonConverters.toJson(Expires,'DateTime',context!),
'RestrictedId': RestrictedId,
'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
});
getTypeName() => "CreateGuestPassRequest";
TypeContext? context = _ctx;
}
class ApiResponseBase implements IConvertible
{
bool? Success;
String? Message;
ApiResponseBase({this.Success,this.Message});
ApiResponseBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Success = json['Success'];
Message = json['Message'];
return this;
}
Map<String, dynamic> toJson() => {
'Success': Success,
'Message': Message
};
getTypeName() => "ApiResponseBase";
TypeContext? context = _ctx;
}
class CreateGuestPassResponseDto extends ApiResponseBase implements IConvertible
{
int? GuestPassId;
CreateGuestPassResponseDto({this.GuestPassId});
CreateGuestPassResponseDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
GuestPassId = json['GuestPassId'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'GuestPassId': GuestPassId
});
getTypeName() => "CreateGuestPassResponseDto";
TypeContext? context = _ctx;
}
class CreateGuestPassResponse extends CreateGuestPassResponseDto implements IConvertible
{
bool? Success;
int? GuestPassId;
String? Message;
CreateGuestPassResponse({this.Success,this.GuestPassId,this.Message});
CreateGuestPassResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
Success = json['Success'];
GuestPassId = json['GuestPassId'];
Message = json['Message'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'Success': Success,
'GuestPassId': GuestPassId,
'Message': Message
});
getTypeName() => "CreateGuestPassResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'clubready.com', types: <String, TypeInfo> {
'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
'CreateGuestPassRequestDto': TypeInfo(TypeOf.Class, create:() => CreateGuestPassRequestDto()),
'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
'CreateGuestPassRequest': TypeInfo(TypeOf.Class, create:() => CreateGuestPassRequest()),
'ApiResponseBase': TypeInfo(TypeOf.Class, create:() => ApiResponseBase()),
'CreateGuestPassResponseDto': TypeInfo(TypeOf.Class, create:() => CreateGuestPassResponseDto()),
'CreateGuestPassResponse': TypeInfo(TypeOf.Class, create:() => CreateGuestPassResponse()),
});
Dart CreateGuestPassRequest 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 /club/guest-pass/create HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateGuestPassRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.ClubAccess.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>
<Activated xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Activated>
<Expires xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</Expires>
<GuestPassTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</GuestPassTypeId>
<UserId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</UserId>
</CreateGuestPassRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateGuestPassResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.ClubAccess.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> <GuestPassId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</GuestPassId> </CreateGuestPassResponse>