POST | /users/notes/create | Add multiple notes. |
---|
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 SubmittedNote implements IConvertible
{
int? UserId;
String? Subject;
String? Text;
SubmittedNote({this.UserId,this.Subject,this.Text});
SubmittedNote.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
UserId = json['UserId'];
Subject = json['Subject'];
Text = json['Text'];
return this;
}
Map<String, dynamic> toJson() => {
'UserId': UserId,
'Subject': Subject,
'Text': Text
};
getTypeName() => "SubmittedNote";
TypeContext? context = _ctx;
}
class CreateUserNotesRequestDto extends ApiDtoBase implements IConvertible
{
int? PostedBy;
List<SubmittedNote>? UserNotes;
CreateUserNotesRequestDto({this.PostedBy,this.UserNotes});
CreateUserNotesRequestDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
PostedBy = json['PostedBy'];
UserNotes = JsonConverters.fromJson(json['UserNotes'],'List<SubmittedNote>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'PostedBy': PostedBy,
'UserNotes': JsonConverters.toJson(UserNotes,'List<SubmittedNote>',context!)
});
getTypeName() => "CreateUserNotesRequestDto";
TypeContext? context = _ctx;
}
enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
class CreateUserNotesRequest extends CreateUserNotesRequestDto 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;
/**
* ClubReady Club ID (StoreID internally)
*/
// @ApiMember(DataType="integer", Description="ClubReady Club ID (StoreID internally)", IsRequired=true, Name="StoreId", ParameterType="query")
int? StoreId;
/**
* Notes are being posted by this ClubReady User ID.
*/
// @ApiMember(DataType="integer", Description="Notes are being posted by this ClubReady User ID.", Name="PostedBy", ParameterType="query")
int? PostedBy;
/**
* Create notes
*/
// @ApiMember(Description="Create notes", IsRequired=true, Name="UserNotes")
List<SubmittedNote>? UserNotes;
int? RestrictedId;
RestrictedResourceType? RestrictedResourceType;
CreateUserNotesRequest({this.ApiKey,this.StoreId,this.PostedBy,this.UserNotes,this.RestrictedId,this.RestrictedResourceType});
CreateUserNotesRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
ApiKey = json['ApiKey'];
StoreId = json['StoreId'];
PostedBy = json['PostedBy'];
UserNotes = JsonConverters.fromJson(json['UserNotes'],'List<SubmittedNote>',context!);
RestrictedId = json['RestrictedId'];
RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'ApiKey': ApiKey,
'StoreId': StoreId,
'PostedBy': PostedBy,
'UserNotes': JsonConverters.toJson(UserNotes,'List<SubmittedNote>',context!),
'RestrictedId': RestrictedId,
'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
});
getTypeName() => "CreateUserNotesRequest";
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 CreateUserNotesResponseDto extends ApiResponseBase implements IConvertible
{
List<int>? NoteIds;
CreateUserNotesResponseDto({this.NoteIds});
CreateUserNotesResponseDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
NoteIds = JsonConverters.fromJson(json['NoteIds'],'List<int>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'NoteIds': JsonConverters.toJson(NoteIds,'List<int>',context!)
});
getTypeName() => "CreateUserNotesResponseDto";
TypeContext? context = _ctx;
}
class CreateUserNotesResponse extends CreateUserNotesResponseDto implements IConvertible
{
List<int>? NoteIds;
CreateUserNotesResponse({this.NoteIds});
CreateUserNotesResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
NoteIds = JsonConverters.fromJson(json['NoteIds'],'List<int>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'NoteIds': JsonConverters.toJson(NoteIds,'List<int>',context!)
});
getTypeName() => "CreateUserNotesResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'clubready.com', types: <String, TypeInfo> {
'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
'SubmittedNote': TypeInfo(TypeOf.Class, create:() => SubmittedNote()),
'CreateUserNotesRequestDto': TypeInfo(TypeOf.Class, create:() => CreateUserNotesRequestDto()),
'List<SubmittedNote>': TypeInfo(TypeOf.Class, create:() => <SubmittedNote>[]),
'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
'CreateUserNotesRequest': TypeInfo(TypeOf.Class, create:() => CreateUserNotesRequest()),
'ApiResponseBase': TypeInfo(TypeOf.Class, create:() => ApiResponseBase()),
'CreateUserNotesResponseDto': TypeInfo(TypeOf.Class, create:() => CreateUserNotesResponseDto()),
'CreateUserNotesResponse': TypeInfo(TypeOf.Class, create:() => CreateUserNotesResponse()),
});
Dart CreateUserNotesRequest 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/notes/create HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateUserNotesRequest 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>
<PostedBy xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</PostedBy>
<UserNotes xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">
<SubmittedNote>
<Subject>String</Subject>
<Text>String</Text>
<UserId>0</UserId>
</SubmittedNote>
</UserNotes>
</CreateUserNotesRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateUserNotesResponse 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> <NoteIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models"> <d2p1:long>0</d2p1:long> </NoteIds> </CreateUserNotesResponse>