BokaMera.API.Host

<back to all web services

UpdateResource

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/resource/{Id}Update existing resourceUpdates an existing resource if you are authorized to do so.
import 'package:servicestack/servicestack.dart';

class TimeException implements ITimeException, IConvertible
{
    /**
    * Time exception id
    */
    // @ApiMember(Description="Time exception id")
    int? Id;

    /**
    * Indicates whether or not the time exception is recurring
    */
    // @ApiMember(Description="Indicates whether or not the time exception is recurring")
    bool? IsRecurring;

    /**
    * Indicates whether the time exception is blocking the time or not
    */
    // @ApiMember(Description="Indicates whether the time exception is blocking the time or not")
    bool? IsBlock;

    /**
    * The reason of the time exception, example: Vacation, doctors appointment, ...
    */
    // @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
    String? ReasonText;

    /**
    * The public reason of the time exception, example: Vacation, doctors appointment, ...
    */
    // @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
    String? ReasonTextPublic;

    /**
    * Time exception start
    */
    // @ApiMember(Description="Time exception start")
    DateTime? From;

    /**
    * Time exception end
    */
    // @ApiMember(Description="Time exception end")
    DateTime? To;

    /**
    * Resources that owns this exception
    */
    // @ApiMember(Description="Resources that owns this exception")
    List<int>? ResourceIds;

    TimeException({this.Id,this.IsRecurring,this.IsBlock,this.ReasonText,this.ReasonTextPublic,this.From,this.To,this.ResourceIds});
    TimeException.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        IsRecurring = json['IsRecurring'];
        IsBlock = json['IsBlock'];
        ReasonText = json['ReasonText'];
        ReasonTextPublic = json['ReasonTextPublic'];
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        ResourceIds = JsonConverters.fromJson(json['ResourceIds'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'IsRecurring': IsRecurring,
        'IsBlock': IsBlock,
        'ReasonText': ReasonText,
        'ReasonTextPublic': ReasonTextPublic,
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'ResourceIds': JsonConverters.toJson(ResourceIds,'List<int>',context!)
    };

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

enum BookingStatusEnum
{
    Booked,
    Unbooked,
    Reserved,
    Canceled,
    AwaitingPayment,
    AwaitingPaymentNoTimeLimit,
    Payed,
    AwaitingPaymentRequestFromAdmin,
    AwaitingPaymentFromProvider,
    Invoiced,
}

class BookedCustomer implements IConvertible
{
    String? Id;
    String? Firstname;
    String? Lastname;
    String? Email;
    String? Phone;
    String? FacebookUserName;
    String? ImageUrl;
    String? CorporateIdentityNumber;
    String? InvoiceAddress1;
    String? InvoiceAddress2;
    String? InvoiceCity;
    String? InvoicePostalCode;
    String? InvoiceCountryCode;

    BookedCustomer({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.FacebookUserName,this.ImageUrl,this.CorporateIdentityNumber,this.InvoiceAddress1,this.InvoiceAddress2,this.InvoiceCity,this.InvoicePostalCode,this.InvoiceCountryCode});
    BookedCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Firstname = json['Firstname'];
        Lastname = json['Lastname'];
        Email = json['Email'];
        Phone = json['Phone'];
        FacebookUserName = json['FacebookUserName'];
        ImageUrl = json['ImageUrl'];
        CorporateIdentityNumber = json['CorporateIdentityNumber'];
        InvoiceAddress1 = json['InvoiceAddress1'];
        InvoiceAddress2 = json['InvoiceAddress2'];
        InvoiceCity = json['InvoiceCity'];
        InvoicePostalCode = json['InvoicePostalCode'];
        InvoiceCountryCode = json['InvoiceCountryCode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone,
        'FacebookUserName': FacebookUserName,
        'ImageUrl': ImageUrl,
        'CorporateIdentityNumber': CorporateIdentityNumber,
        'InvoiceAddress1': InvoiceAddress1,
        'InvoiceAddress2': InvoiceAddress2,
        'InvoiceCity': InvoiceCity,
        'InvoicePostalCode': InvoicePostalCode,
        'InvoiceCountryCode': InvoiceCountryCode
    };

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

class BookedTime implements IBookedTime, IConvertible
{
    /**
    * Booking id
    */
    // @ApiMember(Description="Booking id")
    int? Id;

    /**
    * The booked service
    */
    // @ApiMember(Description="The booked service")
    int? ServiceId;

    /**
    * Booking start
    */
    // @ApiMember(Description="Booking start")
    DateTime? From;

    /**
    * Booking end
    */
    // @ApiMember(Description="Booking end")
    DateTime? To;

    /**
    * Number of booked spots
    */
    // @ApiMember(Description="Number of booked spots")
    int? BookedSpots;

    /**
    * Number of total spots for the service
    */
    // @ApiMember(Description="Number of total spots for the service")
    int? TotalSpots;

    /**
    * The pause after the booking
    */
    // @ApiMember(Description="The pause after the booking")
    int? PauseAfterInMinutes;

    /**
    * The booking status
    */
    // @ApiMember(Description="The booking status")
    int? StatusId;

    BookingStatusEnum? Status;
    /**
    * The customer the booking belongs to
    */
    // @ApiMember(Description="The customer the booking belongs to")
    BookedCustomer? Customer;

    BookedTime({this.Id,this.ServiceId,this.From,this.To,this.BookedSpots,this.TotalSpots,this.PauseAfterInMinutes,this.StatusId,this.Status,this.Customer});
    BookedTime.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        ServiceId = json['ServiceId'];
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        BookedSpots = json['BookedSpots'];
        TotalSpots = json['TotalSpots'];
        PauseAfterInMinutes = json['PauseAfterInMinutes'];
        StatusId = json['StatusId'];
        Status = JsonConverters.fromJson(json['Status'],'BookingStatusEnum',context!);
        Customer = JsonConverters.fromJson(json['Customer'],'BookedCustomer',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'ServiceId': ServiceId,
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'BookedSpots': BookedSpots,
        'TotalSpots': TotalSpots,
        'PauseAfterInMinutes': PauseAfterInMinutes,
        'StatusId': StatusId,
        'Status': JsonConverters.toJson(Status,'BookingStatusEnum',context!),
        'Customer': JsonConverters.toJson(Customer,'BookedCustomer',context!)
    };

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

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

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

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

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

    /**
    * The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
    */
    // @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
    String? Color;

    /**
    * The email of the resource
    */
    // @ApiMember(Description="The email of the resource")
    String? Email;

    /**
    * The image url of the resource
    */
    // @ApiMember(Description="The image url of the resource")
    Uri? ImageUrl;

    /**
    * The mobile phone number of the resource
    */
    // @ApiMember(Description="The mobile phone number of the resource")
    String? MobilePhone;

    /**
    * Used by example code locks to know what access group the resource is assigned to
    */
    // @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
    String? AccessGroup;

    /**
    * If the resource should receive email notification when booked
    */
    // @ApiMember(Description="If the resource should receive email notification when booked")
    bool? EmailNotification;

    /**
    * If the resource should receive SMS notification when booked
    */
    // @ApiMember(Description="If the resource should receive SMS notification when booked")
    bool? SMSNotification;

    /**
    * If the resource should receive email reminders on bookings
    */
    // @ApiMember(Description="If the resource should receive email reminders on bookings")
    bool? SendEmailReminder;

    /**
    * If the resource should receive SMS reminders on bookings
    */
    // @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    bool? SendSMSReminder;

    /**
    * The resource time exceptions
    */
    // @ApiMember(Description="The resource time exceptions")
    List<TimeException>? Exceptions;

    /**
    * The resource bookings
    */
    // @ApiMember(Description="The resource bookings")
    List<BookedTime>? Bookings;

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

    ResponseStatus? ResponseStatus;

    ResourceQueryResponse({this.Id,this.Name,this.Description,this.Active,this.Color,this.Email,this.ImageUrl,this.MobilePhone,this.AccessGroup,this.EmailNotification,this.SMSNotification,this.SendEmailReminder,this.SendSMSReminder,this.Exceptions,this.Bookings,this.Created,this.Updated,this.ResponseStatus});
    ResourceQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Active = json['Active'];
        Color = json['Color'];
        Email = json['Email'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        MobilePhone = json['MobilePhone'];
        AccessGroup = json['AccessGroup'];
        EmailNotification = json['EmailNotification'];
        SMSNotification = json['SMSNotification'];
        SendEmailReminder = json['SendEmailReminder'];
        SendSMSReminder = json['SendSMSReminder'];
        Exceptions = JsonConverters.fromJson(json['Exceptions'],'List<TimeException>',context!);
        Bookings = JsonConverters.fromJson(json['Bookings'],'List<BookedTime>',context!);
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Active': Active,
        'Color': Color,
        'Email': Email,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
        'MobilePhone': MobilePhone,
        'AccessGroup': AccessGroup,
        'EmailNotification': EmailNotification,
        'SMSNotification': SMSNotification,
        'SendEmailReminder': SendEmailReminder,
        'SendSMSReminder': SendSMSReminder,
        'Exceptions': JsonConverters.toJson(Exceptions,'List<TimeException>',context!),
        'Bookings': JsonConverters.toJson(Bookings,'List<BookedTime>',context!),
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'Updated': JsonConverters.toJson(Updated,'DateTime',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

class AddCustomField implements IConvertible
{
    int? Id;
    String? Value;

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

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

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

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateResource implements ICompany, IConvertible
{
    /**
    * Enter the company id, if blank company id and you are an admin, your company id will be used.
    */
    // @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
    String? CompanyId;

    /**
    * Id of the resource
    */
    // @ApiMember(Description="Id of the resource", IsRequired=true, ParameterType="path")
    int? Id;

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

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

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

    /**
    * The resource color in scheduler
    */
    // @ApiMember(Description="The resource color in scheduler")
    String? Color;

    /**
    * The image url of the resource
    */
    // @ApiMember(Description="The image url of the resource")
    Uri? ImageUrl;

    /**
    * The email of the resource
    */
    // @ApiMember(Description="The email of the resource")
    String? Email;

    /**
    * The mobile phone number of the resource
    */
    // @ApiMember(Description="The mobile phone number of the resource")
    String? MobilePhone;

    /**
    * Used by example code locks to know what access group the resource is assigned to
    */
    // @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
    String? AccessGroup;

    /**
    * If the resource should receive email notification when booked
    */
    // @ApiMember(Description="If the resource should receive email notification when booked")
    bool? EmailNotification;

    /**
    * If the resource should receive SMS notification when booked
    */
    // @ApiMember(Description="If the resource should receive SMS notification when booked")
    bool? SMSNotification;

    /**
    * If the resource should receive email reminders on bookings
    */
    // @ApiMember(Description="If the resource should receive email reminders on bookings")
    bool? SendEmailReminder;

    /**
    * If the resource should receive SMS reminders on bookings
    */
    // @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    bool? SendSMSReminder;

    /**
    * If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved
    */
    // @ApiMember(Description="If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved")
    List<AddCustomField>? CustomFields;

    UpdateResource({this.CompanyId,this.Id,this.Name,this.Description,this.Active,this.Color,this.ImageUrl,this.Email,this.MobilePhone,this.AccessGroup,this.EmailNotification,this.SMSNotification,this.SendEmailReminder,this.SendSMSReminder,this.CustomFields});
    UpdateResource.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Active = json['Active'];
        Color = json['Color'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        Email = json['Email'];
        MobilePhone = json['MobilePhone'];
        AccessGroup = json['AccessGroup'];
        EmailNotification = json['EmailNotification'];
        SMSNotification = json['SMSNotification'];
        SendEmailReminder = json['SendEmailReminder'];
        SendSMSReminder = json['SendSMSReminder'];
        CustomFields = JsonConverters.fromJson(json['CustomFields'],'List<AddCustomField>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Active': Active,
        'Color': Color,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
        'Email': Email,
        'MobilePhone': MobilePhone,
        'AccessGroup': AccessGroup,
        'EmailNotification': EmailNotification,
        'SMSNotification': SMSNotification,
        'SendEmailReminder': SendEmailReminder,
        'SendSMSReminder': SendSMSReminder,
        'CustomFields': JsonConverters.toJson(CustomFields,'List<AddCustomField>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
    'TimeException': TypeInfo(TypeOf.Class, create:() => TimeException()),
    'BookingStatusEnum': TypeInfo(TypeOf.Enum, enumValues:BookingStatusEnum.values),
    'BookedCustomer': TypeInfo(TypeOf.Class, create:() => BookedCustomer()),
    'BookedTime': TypeInfo(TypeOf.Class, create:() => BookedTime()),
    'ResourceQueryResponse': TypeInfo(TypeOf.Class, create:() => ResourceQueryResponse()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'List<TimeException>': TypeInfo(TypeOf.Class, create:() => <TimeException>[]),
    'List<BookedTime>': TypeInfo(TypeOf.Class, create:() => <BookedTime>[]),
    'AddCustomField': TypeInfo(TypeOf.Class, create:() => AddCustomField()),
    'UpdateResource': TypeInfo(TypeOf.Class, create:() => UpdateResource()),
    'List<AddCustomField>': TypeInfo(TypeOf.Class, create:() => <AddCustomField>[]),
});

Dart UpdateResource DTOs

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

HTTP + CSV

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

PUT /resource/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","MobilePhone":"String","AccessGroup":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"CustomFields":[{"Id":0,"Value":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Id":0,"Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","MobilePhone":"String","AccessGroup":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"Exceptions":[{"Id":0,"IsRecurring":false,"IsBlock":false,"ReasonText":"String","ReasonTextPublic":"String","ResourceIds":[0]}],"Bookings":[{"Id":0,"ServiceId":0,"BookedSpots":0,"TotalSpots":0,"PauseAfterInMinutes":0,"StatusId":0,"Status":"Booked","Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","FacebookUserName":"String","ImageUrl":"String","CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}