| PUT | /api/roles |
|---|
import 'package:servicestack/servicestack.dart';
class ListItemFilterModel implements IConvertible
{
String? ListItemFilterId;
String? FilterName;
String? ListId;
String? ListItemId;
bool? ListItemIsInFilter;
ListItemFilterModel({this.ListItemFilterId,this.FilterName,this.ListId,this.ListItemId,this.ListItemIsInFilter});
ListItemFilterModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ListItemFilterId = json['ListItemFilterId'];
FilterName = json['FilterName'];
ListId = json['ListId'];
ListItemId = json['ListItemId'];
ListItemIsInFilter = json['ListItemIsInFilter'];
return this;
}
Map<String, dynamic> toJson() => {
'ListItemFilterId': ListItemFilterId,
'FilterName': FilterName,
'ListId': ListId,
'ListItemId': ListItemId,
'ListItemIsInFilter': ListItemIsInFilter
};
getTypeName() => "ListItemFilterModel";
TypeContext? context = _ctx;
}
class RoleDetailsModel implements IConvertible
{
/**
* Role Id
*/
// @ApiMember(DataType="Guid", Description="Role Id", Name="RoleId")
String? RoleId;
/**
* Role Name
*/
// @ApiMember(DataType="string", Description="Role Name", Name="RoleName")
String? RoleName;
/**
* Role Connection Definition Id
*/
// @ApiMember(DataType="Guid", Description="Role Connection Definition Id", Name="RoleConnectionDefinitionId")
String? RoleConnectionDefinitionId;
/**
* Contact Types the Role applies to
*/
// @ApiMember(DataType="List", Description="Contact Types the Role applies to", Name="ContactTypes")
List<String>? ContactTypes;
/**
* Does the role require contacts to accept it?
*/
// @ApiMember(DataType="bool", Description="Does the role require contacts to accept it?", Name="RequireContactsToAccept")
bool? RequireContactsToAccept;
/**
* Filters linked to the custom role.
*/
// @ApiMember(DataType="List", Description="Filters linked to the custom role.", Name="ListItemFilters")
List<ListItemFilterModel>? ListItemFilters;
RoleDetailsModel({this.RoleId,this.RoleName,this.RoleConnectionDefinitionId,this.ContactTypes,this.RequireContactsToAccept,this.ListItemFilters});
RoleDetailsModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleId = json['RoleId'];
RoleName = json['RoleName'];
RoleConnectionDefinitionId = json['RoleConnectionDefinitionId'];
ContactTypes = JsonConverters.fromJson(json['ContactTypes'],'List<String>',context!);
RequireContactsToAccept = json['RequireContactsToAccept'];
ListItemFilters = JsonConverters.fromJson(json['ListItemFilters'],'List<ListItemFilterModel>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'RoleId': RoleId,
'RoleName': RoleName,
'RoleConnectionDefinitionId': RoleConnectionDefinitionId,
'ContactTypes': JsonConverters.toJson(ContactTypes,'List<String>',context!),
'RequireContactsToAccept': RequireContactsToAccept,
'ListItemFilters': JsonConverters.toJson(ListItemFilters,'List<ListItemFilterModel>',context!)
};
getTypeName() => "RoleDetailsModel";
TypeContext? context = _ctx;
}
class ObjectShareModel implements IConvertible
{
String? ObjectShareId;
String? ObjectId;
String? ObjectName;
String? Name;
String? Description;
String? Reference;
String? ContactId;
String? ContactName;
String? ContactType;
String? ContactImageUrlPrimary;
String? ContactImageUrlPrimaryThmbnail;
String? ShareStatusId;
String? ShareStatusName;
ObjectShareModel({this.ObjectShareId,this.ObjectId,this.ObjectName,this.Name,this.Description,this.Reference,this.ContactId,this.ContactName,this.ContactType,this.ContactImageUrlPrimary,this.ContactImageUrlPrimaryThmbnail,this.ShareStatusId,this.ShareStatusName});
ObjectShareModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ObjectShareId = json['ObjectShareId'];
ObjectId = json['ObjectId'];
ObjectName = json['ObjectName'];
Name = json['Name'];
Description = json['Description'];
Reference = json['Reference'];
ContactId = json['ContactId'];
ContactName = json['ContactName'];
ContactType = json['ContactType'];
ContactImageUrlPrimary = json['ContactImageUrlPrimary'];
ContactImageUrlPrimaryThmbnail = json['ContactImageUrlPrimaryThmbnail'];
ShareStatusId = json['ShareStatusId'];
ShareStatusName = json['ShareStatusName'];
return this;
}
Map<String, dynamic> toJson() => {
'ObjectShareId': ObjectShareId,
'ObjectId': ObjectId,
'ObjectName': ObjectName,
'Name': Name,
'Description': Description,
'Reference': Reference,
'ContactId': ContactId,
'ContactName': ContactName,
'ContactType': ContactType,
'ContactImageUrlPrimary': ContactImageUrlPrimary,
'ContactImageUrlPrimaryThmbnail': ContactImageUrlPrimaryThmbnail,
'ShareStatusId': ShareStatusId,
'ShareStatusName': ShareStatusName
};
getTypeName() => "ObjectShareModel";
TypeContext? context = _ctx;
}
/**
* Updates a Role record, and updates Sharing.
*/
// @Api(Description="Updates a Role record, and updates Sharing.")
class UpdateRoleWithSharing implements IConvertible
{
/**
* Details of the Contact Role to be Updated.
*/
// @ApiMember(DataType="RoleDetailsModel", Description="Details of the Contact Role to be Updated.", IsRequired=true, Name="RoleDetails", ParameterType="query")
RoleDetailsModel? RoleDetails;
/**
*
*/
// @ApiMember(DataType="FormCollection", Description="", Name="Form", ParameterType="query")
FormCollection? Form;
/**
* List of Object Share details.
*/
// @ApiMember(DataType="List<ObjectShareModel>", Description="List of Object Share details.", Name="ShareList", ParameterType="query")
List<ObjectShareModel>? ShareList;
UpdateRoleWithSharing({this.RoleDetails,this.Form,this.ShareList});
UpdateRoleWithSharing.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleDetails = JsonConverters.fromJson(json['RoleDetails'],'RoleDetailsModel',context!);
Form = JsonConverters.fromJson(json['Form'],'FormCollection',context!);
ShareList = JsonConverters.fromJson(json['ShareList'],'List<ObjectShareModel>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'RoleDetails': JsonConverters.toJson(RoleDetails,'RoleDetailsModel',context!),
'Form': JsonConverters.toJson(Form,'FormCollection',context!),
'ShareList': JsonConverters.toJson(ShareList,'List<ObjectShareModel>',context!)
};
getTypeName() => "UpdateRoleWithSharing";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'pfapi.pstpf.com.au', types: <String, TypeInfo> {
'ListItemFilterModel': TypeInfo(TypeOf.Class, create:() => ListItemFilterModel()),
'RoleDetailsModel': TypeInfo(TypeOf.Class, create:() => RoleDetailsModel()),
'List<ListItemFilterModel>': TypeInfo(TypeOf.Class, create:() => <ListItemFilterModel>[]),
'ObjectShareModel': TypeInfo(TypeOf.Class, create:() => ObjectShareModel()),
'UpdateRoleWithSharing': TypeInfo(TypeOf.Class, create:() => UpdateRoleWithSharing()),
'FormCollection': TypeInfo(TypeOf.Class, create:() => FormCollection()),
'List<ObjectShareModel>': TypeInfo(TypeOf.Class, create:() => <ObjectShareModel>[]),
});
Dart UpdateRoleWithSharing 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.
PUT /api/roles HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
RoleDetails:
{
RoleName: String,
ContactTypes:
[
00000000-0000-0000-0000-000000000000
],
RequireContactsToAccept: False,
ListItemFilters:
[
{
FilterName: String,
ListItemIsInFilter: False
}
]
},
Form: [],
ShareList:
[
{
ObjectName: String,
Name: String,
Description: String,
Reference: String,
ContactName: String,
ContactType: String,
ContactImageUrlPrimary: String,
ContactImageUrlPrimaryThmbnail: String,
ShareStatusName: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}