Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /administrators/{Id} | Update administrator on your company | If you want to update a administrator to your company. |
---|
import 'package:servicestack/servicestack.dart';
class CompanyUserResource implements IConvertible
{
/**
* The resource id
*/
// @ApiMember(Description="The resource id")
int? Id;
/**
* The resource name
*/
// @ApiMember(Description="The resource name")
String? Name;
/**
* The resource status
*/
// @ApiMember(Description="The resource status")
bool? Active;
/**
* The resource description
*/
// @ApiMember(Description="The resource description")
String? Description;
/**
* The resource email
*/
// @ApiMember(Description="The resource email")
String? Email;
/**
* The resource phone
*/
// @ApiMember(Description="The resource phone")
String? Phone;
/**
* The resource color
*/
// @ApiMember(Description="The resource color")
String? Color;
/**
* The resource image
*/
// @ApiMember(Description="The resource image")
Uri? ImageUrl;
/**
* If the resource want to receive email notifications
*/
// @ApiMember(Description="If the resource want to receive email notifications")
bool? EmailNotification;
/**
* If the resource want to receive sms notifications
*/
// @ApiMember(Description="If the resource want to receive sms notifications")
bool? SMSNotification;
/**
* If the resource want to receive email reminders
*/
// @ApiMember(Description="If the resource want to receive email reminders")
bool? EmailReminder;
/**
* If the resource want to receive sms reminders
*/
// @ApiMember(Description="If the resource want to receive sms reminders")
bool? SMSReminder;
CompanyUserResource({this.Id,this.Name,this.Active,this.Description,this.Email,this.Phone,this.Color,this.ImageUrl,this.EmailNotification,this.SMSNotification,this.EmailReminder,this.SMSReminder});
CompanyUserResource.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Active = json['Active'];
Description = json['Description'];
Email = json['Email'];
Phone = json['Phone'];
Color = json['Color'];
ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
EmailNotification = json['EmailNotification'];
SMSNotification = json['SMSNotification'];
EmailReminder = json['EmailReminder'];
SMSReminder = json['SMSReminder'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Active': Active,
'Description': Description,
'Email': Email,
'Phone': Phone,
'Color': Color,
'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
'EmailNotification': EmailNotification,
'SMSNotification': SMSNotification,
'EmailReminder': EmailReminder,
'SMSReminder': SMSReminder
};
getTypeName() => "CompanyUserResource";
TypeContext? context = _ctx;
}
class CompanyUserRolesQueryResponse implements IConvertible
{
String? RoleId;
String? Name;
String? Description;
CompanyUserRolesQueryResponse({this.RoleId,this.Name,this.Description});
CompanyUserRolesQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleId = json['RoleId'];
Name = json['Name'];
Description = json['Description'];
return this;
}
Map<String, dynamic> toJson() => {
'RoleId': RoleId,
'Name': Name,
'Description': Description
};
getTypeName() => "CompanyUserRolesQueryResponse";
TypeContext? context = _ctx;
}
class CompanyUserQueryResponse implements IConvertible
{
String? Id;
String? CompanyId;
String? Firstname;
String? Lastname;
String? Email;
String? Phone;
String? WorkerId;
int? ResourceId;
/**
* The resource information connected to the administrator.
*/
// @ApiMember(Description="The resource information connected to the administrator.")
CompanyUserResource? Resource;
/**
* The roles that are connected to the administrator.
*/
// @ApiMember(Description="The roles that are connected to the administrator.")
List<CompanyUserRolesQueryResponse>? Roles;
bool? Active;
DateTime? Created;
DateTime? Updated;
CompanyUserQueryResponse({this.Id,this.CompanyId,this.Firstname,this.Lastname,this.Email,this.Phone,this.WorkerId,this.ResourceId,this.Resource,this.Roles,this.Active,this.Created,this.Updated});
CompanyUserQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
CompanyId = json['CompanyId'];
Firstname = json['Firstname'];
Lastname = json['Lastname'];
Email = json['Email'];
Phone = json['Phone'];
WorkerId = json['WorkerId'];
ResourceId = json['ResourceId'];
Resource = JsonConverters.fromJson(json['Resource'],'CompanyUserResource',context!);
Roles = JsonConverters.fromJson(json['Roles'],'List<CompanyUserRolesQueryResponse>',context!);
Active = json['Active'];
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'CompanyId': CompanyId,
'Firstname': Firstname,
'Lastname': Lastname,
'Email': Email,
'Phone': Phone,
'WorkerId': WorkerId,
'ResourceId': ResourceId,
'Resource': JsonConverters.toJson(Resource,'CompanyUserResource',context!),
'Roles': JsonConverters.toJson(Roles,'List<CompanyUserRolesQueryResponse>',context!),
'Active': Active,
'Created': JsonConverters.toJson(Created,'DateTime',context!),
'Updated': JsonConverters.toJson(Updated,'DateTime',context!)
};
getTypeName() => "CompanyUserQueryResponse";
TypeContext? context = _ctx;
}
class AddCompanyUserRolesResponse implements IConvertible
{
String? RoleId;
AddCompanyUserRolesResponse({this.RoleId});
AddCompanyUserRolesResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleId = json['RoleId'];
return this;
}
Map<String, dynamic> toJson() => {
'RoleId': RoleId
};
getTypeName() => "AddCompanyUserRolesResponse";
TypeContext? context = _ctx;
}
// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateCompanyUser implements ICompany, IConvertible
{
/**
* Enter the company and id for the application user, if blank company id and you are an admin, your company id will be used.
*/
// @ApiMember(Description="Enter the company and id for the application user, if blank company id and you are an admin, your company id will be used.", ParameterType="query")
String? CompanyId;
/**
* Enter the user id for the administrator.
*/
// @ApiMember(Description="Enter the user id for the administrator.", IsRequired=true, ParameterType="path")
String? Id;
// @ApiMember()
String? Firstname;
// @ApiMember()
String? Lastname;
// @ApiMember()
String? Phone;
// @ApiMember()
String? Email;
// @ApiMember()
int? ResourceId;
// @ApiMember()
List<AddCompanyUserRolesResponse>? Roles;
// @ApiMember()
int? WorkerId;
UpdateCompanyUser({this.CompanyId,this.Id,this.Firstname,this.Lastname,this.Phone,this.Email,this.ResourceId,this.Roles,this.WorkerId});
UpdateCompanyUser.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
Firstname = json['Firstname'];
Lastname = json['Lastname'];
Phone = json['Phone'];
Email = json['Email'];
ResourceId = json['ResourceId'];
Roles = JsonConverters.fromJson(json['Roles'],'List<AddCompanyUserRolesResponse>',context!);
WorkerId = json['WorkerId'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id,
'Firstname': Firstname,
'Lastname': Lastname,
'Phone': Phone,
'Email': Email,
'ResourceId': ResourceId,
'Roles': JsonConverters.toJson(Roles,'List<AddCompanyUserRolesResponse>',context!),
'WorkerId': WorkerId
};
getTypeName() => "UpdateCompanyUser";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'CompanyUserResource': TypeInfo(TypeOf.Class, create:() => CompanyUserResource()),
'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
'CompanyUserRolesQueryResponse': TypeInfo(TypeOf.Class, create:() => CompanyUserRolesQueryResponse()),
'CompanyUserQueryResponse': TypeInfo(TypeOf.Class, create:() => CompanyUserQueryResponse()),
'List<CompanyUserRolesQueryResponse>': TypeInfo(TypeOf.Class, create:() => <CompanyUserRolesQueryResponse>[]),
'AddCompanyUserRolesResponse': TypeInfo(TypeOf.Class, create:() => AddCompanyUserRolesResponse()),
'UpdateCompanyUser': TypeInfo(TypeOf.Class, create:() => UpdateCompanyUser()),
'List<AddCompanyUserRolesResponse>': TypeInfo(TypeOf.Class, create:() => <AddCompanyUserRolesResponse>[]),
});
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.
PUT /administrators/{Id} HTTP/1.1
Host: testapi.bokamera.se
Accept: application/json
Content-Type: application/json
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Phone":"String","Email":"String","ResourceId":0,"Roles":[{}],"WorkerId":0}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","WorkerId":"String","ResourceId":0,"Resource":{"Id":0,"Name":"String","Active":false,"Description":"String","Email":"String","Phone":"String","Color":"String","EmailNotification":false,"SMSNotification":false,"EmailReminder":false,"SMSReminder":false},"Roles":[{"Name":"String","Description":"String"}],"Active":false}