BokaMera.API.Host

<back to all web services

CreateResourceType

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/resourcetypesAdd a new resourcetypeAdd a new resourcetype to the company of the currently logged in user, only administrators are allowed to add resourcetypes.
import 'package:servicestack/servicestack.dart';

class ResourceTypeResource 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;

    /**
    * The priority of the resource
    */
    // @ApiMember(Description="The priority of the resource")
    int? Priority;

    /**
    * 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;

    ResourceTypeResource({this.Id,this.Name,this.Active,this.Description,this.Email,this.Phone,this.Color,this.ImageUrl,this.Priority,this.EmailNotification,this.SMSNotification,this.EmailReminder,this.SMSReminder});
    ResourceTypeResource.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!);
        Priority = json['Priority'];
        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!),
        'Priority': Priority,
        'EmailNotification': EmailNotification,
        'SMSNotification': SMSNotification,
        'EmailReminder': EmailReminder,
        'SMSReminder': SMSReminder
    };

    getTypeName() => "ResourceTypeResource";
    TypeContext? context = _ctx;
}

class ResourceTypeQueryResponse implements IConvertible
{
    /**
    * The resourcetype id
    */
    // @ApiMember(Description="The resourcetype id")
    int? Id;

    /**
    * The resourcetype name
    */
    // @ApiMember(Description="The resourcetype name")
    String? Name;

    /**
    * The resourcetype description
    */
    // @ApiMember(Description="The resourcetype description")
    String? Description;

    /**
    * The resources in the resourcetype. Only shows active resources if not admin.
    */
    // @ApiMember(Description="The resources in the resourcetype. Only shows active resources if not admin.")
    List<ResourceTypeResource>? Resources;

    /**
    * If resourcetype is active or not
    */
    // @ApiMember(Description="If resourcetype is active or not")
    bool? Active;

    /**
    * Then date when the resource was created
    */
    // @ApiMember(Description="Then date when the resource was created")
    DateTime? Created;

    /**
    * Then date when the resource was updated
    */
    // @ApiMember(Description="Then date when the resource was updated")
    DateTime? Updated;

    ResourceTypeQueryResponse({this.Id,this.Name,this.Description,this.Resources,this.Active,this.Created,this.Updated});
    ResourceTypeQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Resources = JsonConverters.fromJson(json['Resources'],'List<ResourceTypeResource>',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,
        'Name': Name,
        'Description': Description,
        'Resources': JsonConverters.toJson(Resources,'List<ResourceTypeResource>',context!),
        'Active': Active,
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'Updated': JsonConverters.toJson(Updated,'DateTime',context!)
    };

    getTypeName() => "ResourceTypeQueryResponse";
    TypeContext? context = _ctx;
}

class AddResourceTypeResource implements IConvertible
{
    /**
    * The resource id
    */
    // @ApiMember(Description="The resource id")
    int? Id;

    /**
    * The priority of the resource. If no priority is set it will take random resource when booking a time.
    */
    // @ApiMember(Description="The priority of the resource. If no priority is set it will take random resource when booking a time.")
    int? Priority;

    AddResourceTypeResource({this.Id,this.Priority});
    AddResourceTypeResource.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Priority = json['Priority'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Priority': Priority
    };

    getTypeName() => "AddResourceTypeResource";
    TypeContext? context = _ctx;
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateResourceType implements ICompany, IConvertible
{
    /**
    * The company id, if empty will use the company id for the user you are logged in with.
    */
    // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    String? CompanyId;

    /**
    * The resourcetype name
    */
    // @ApiMember(Description="The resourcetype name")
    String? Name;

    /**
    * The resources to be included
    */
    // @ApiMember(Description="The resources to be included")
    List<AddResourceTypeResource>? Resources;

    /**
    * The resourcetype description
    */
    // @ApiMember(Description="The resourcetype description")
    String? Description;

    /**
    * If resourcetype is active or not
    */
    // @ApiMember(Description="If resourcetype is active or not")
    bool? Active;

    CreateResourceType({this.CompanyId,this.Name,this.Resources,this.Description,this.Active});
    CreateResourceType.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Name = json['Name'];
        Resources = JsonConverters.fromJson(json['Resources'],'List<AddResourceTypeResource>',context!);
        Description = json['Description'];
        Active = json['Active'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Name': Name,
        'Resources': JsonConverters.toJson(Resources,'List<AddResourceTypeResource>',context!),
        'Description': Description,
        'Active': Active
    };

    getTypeName() => "CreateResourceType";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'ResourceTypeResource': TypeInfo(TypeOf.Class, create:() => ResourceTypeResource()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'ResourceTypeQueryResponse': TypeInfo(TypeOf.Class, create:() => ResourceTypeQueryResponse()),
    'List<ResourceTypeResource>': TypeInfo(TypeOf.Class, create:() => <ResourceTypeResource>[]),
    'AddResourceTypeResource': TypeInfo(TypeOf.Class, create:() => AddResourceTypeResource()),
    'CreateResourceType': TypeInfo(TypeOf.Class, create:() => CreateResourceType()),
    'List<AddResourceTypeResource>': TypeInfo(TypeOf.Class, create:() => <AddResourceTypeResource>[]),
});

Dart CreateResourceType DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /resourcetypes HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Name: String,
	Resources: 
	[
		{
			Id: 0,
			Priority: 0
		}
	],
	Description: String,
	Active: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Name: String,
	Description: String,
	Resources: 
	[
		{
			Id: 0,
			Name: String,
			Active: False,
			Description: String,
			Email: String,
			Phone: String,
			Color: String,
			Priority: 0,
			EmailNotification: False,
			SMSNotification: False,
			EmailReminder: False,
			SMSReminder: False
		}
	],
	Active: False
}