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 .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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/json
Content-Type: application/json
Content-Length: length
{"ApiKey":"String","StoreId":0,"PostedBy":0,"UserNotes":[{"UserId":0,"Subject":"String","Text":"String"}],"RestrictedId":0,"RestrictedResourceType":"Store","ChainId":0}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"NoteIds":[0],"Success":false,"Message":"String"}