BokaMera.API.Host

<back to all web services

CreateDateSchedule

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

class DateScheduleDateResponse implements IConvertible
{
    int? Id;
    DateTime? From;
    DateTime? To;
    ResponseStatus? ResponseStatus;

    DateScheduleDateResponse({this.Id,this.From,this.To,this.ResponseStatus});
    DateScheduleDateResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

class ScheduleResources implements IConvertible
{
    int? Id;
    /**
    * Name of the resource
    */
    // @ApiMember(Description="Name of the resource")
    String? Name;

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

    ScheduleResources({this.Id,this.Name,this.ImageUrl});
    ScheduleResources.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
    };

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

class ScheduleServices implements IConvertible
{
    int? Id;
    /**
    * Name of the service
    */
    // @ApiMember(Description="Name of the service")
    String? Name;

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

    ScheduleServices({this.Id,this.Name,this.ImageUrl});
    ScheduleServices.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
    };

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

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

    /**
    * Name of the schedule
    */
    // @ApiMember(Description="Name of the schedule")
    String? Name;

    /**
    * Description of the schedule
    */
    // @ApiMember(Description="Description of the schedule")
    String? Description;

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

    /**
    * If the schedule is only connected to some specific resources. Note: You must have IncludeResources property to see this.
    */
    // @ApiMember(Description="If the schedule is only connected to some specific resources. Note: You must have IncludeResources property to see this.", IsRequired=true)
    bool? IsResourceSpecific;

    /**
    * Schedule dates
    */
    // @ApiMember(Description="Schedule dates")
    List<DateScheduleDateResponse>? ScheduleDates;

    /**
    * The resources that is connected to the schedule
    */
    // @ApiMember(Description="The resources that is connected to the schedule")
    List<ScheduleResources>? Resources;

    /**
    * The services that is connected to the schedule
    */
    // @ApiMember(Description="The services that is connected to the schedule")
    List<ScheduleServices>? Services;

    /**
    * The timestamp when the schedule was updated
    */
    // @ApiMember(Description="The timestamp when the schedule was updated", IsRequired=true)
    DateTime? UpdatedDate;

    /**
    * The timestamp when the schedule was created
    */
    // @ApiMember(Description="The timestamp when the schedule was created", IsRequired=true)
    DateTime? CreatedDate;

    ResponseStatus? ResponseStatus;

    DateScheduleQueryResponse({this.Id,this.Name,this.Description,this.Active,this.IsResourceSpecific,this.ScheduleDates,this.Resources,this.Services,this.UpdatedDate,this.CreatedDate,this.ResponseStatus});
    DateScheduleQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Active = json['Active'];
        IsResourceSpecific = json['IsResourceSpecific'];
        ScheduleDates = JsonConverters.fromJson(json['ScheduleDates'],'List<DateScheduleDateResponse>',context!);
        Resources = JsonConverters.fromJson(json['Resources'],'List<ScheduleResources>',context!);
        Services = JsonConverters.fromJson(json['Services'],'List<ScheduleServices>',context!);
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Active': Active,
        'IsResourceSpecific': IsResourceSpecific,
        'ScheduleDates': JsonConverters.toJson(ScheduleDates,'List<DateScheduleDateResponse>',context!),
        'Resources': JsonConverters.toJson(Resources,'List<ScheduleResources>',context!),
        'Services': JsonConverters.toJson(Services,'List<ScheduleServices>',context!),
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

class AddDateScheduleDate implements IConvertible
{
    /**
    * The from date for the timeslot
    */
    // @ApiMember(Description="The from date for the timeslot", IsRequired=true)
    DateTime? From;

    /**
    * The to date for the timeslot
    */
    // @ApiMember(Description="The to date for the timeslot", IsRequired=true)
    DateTime? To;

    AddDateScheduleDate({this.From,this.To});
    AddDateScheduleDate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!)
    };

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

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

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

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

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

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

class AddScheduleService implements IConvertible
{
    /**
    * The service id
    */
    // @ApiMember(Description="The service id", IsRequired=true)
    int? Id;

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

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

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

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateDateSchedule 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 schedule name
    */
    // @ApiMember(Description="The schedule name")
    String? Name;

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

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

    /**
    * The number of days the schedule is valid from todays date
    */
    // @ApiMember(Description="The number of days the schedule is valid from todays date", IsRequired=true)
    int? NumberOfScheduleDays;

    /**
    * The dates for the schedule. This is the actual timeslots.
    */
    // @ApiMember(Description="The dates for the schedule. This is the actual timeslots.")
    List<AddDateScheduleDate>? ScheduleDates;

    /**
    * If the schedule is only connected to some resources, add them here. If empty, it will be used by all resources.
    */
    // @ApiMember(Description="If the schedule is only connected to some resources, add them here. If empty, it will be used by all resources.")
    List<AddScheduleResource>? Resources;

    /**
    * Set what services the schedule should be connected to.
    */
    // @ApiMember(Description="Set what services the schedule should be connected to.")
    List<AddScheduleService>? Services;

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

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

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Name': Name,
        'Description': Description,
        'Active': Active,
        'NumberOfScheduleDays': NumberOfScheduleDays,
        'ScheduleDates': JsonConverters.toJson(ScheduleDates,'List<AddDateScheduleDate>',context!),
        'Resources': JsonConverters.toJson(Resources,'List<AddScheduleResource>',context!),
        'Services': JsonConverters.toJson(Services,'List<AddScheduleService>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'DateScheduleDateResponse': TypeInfo(TypeOf.Class, create:() => DateScheduleDateResponse()),
    'ScheduleResources': TypeInfo(TypeOf.Class, create:() => ScheduleResources()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'ScheduleServices': TypeInfo(TypeOf.Class, create:() => ScheduleServices()),
    'DateScheduleQueryResponse': TypeInfo(TypeOf.Class, create:() => DateScheduleQueryResponse()),
    'List<DateScheduleDateResponse>': TypeInfo(TypeOf.Class, create:() => <DateScheduleDateResponse>[]),
    'List<ScheduleResources>': TypeInfo(TypeOf.Class, create:() => <ScheduleResources>[]),
    'List<ScheduleServices>': TypeInfo(TypeOf.Class, create:() => <ScheduleServices>[]),
    'AddDateScheduleDate': TypeInfo(TypeOf.Class, create:() => AddDateScheduleDate()),
    'AddScheduleResource': TypeInfo(TypeOf.Class, create:() => AddScheduleResource()),
    'AddScheduleService': TypeInfo(TypeOf.Class, create:() => AddScheduleService()),
    'CreateDateSchedule': TypeInfo(TypeOf.Class, create:() => CreateDateSchedule()),
    'List<AddDateScheduleDate>': TypeInfo(TypeOf.Class, create:() => <AddDateScheduleDate>[]),
    'List<AddScheduleResource>': TypeInfo(TypeOf.Class, create:() => <AddScheduleResource>[]),
    'List<AddScheduleService>': TypeInfo(TypeOf.Class, create:() => <AddScheduleService>[]),
});

Dart CreateDateSchedule DTOs

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

HTTP + XML

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

POST /schedules/date HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateDateSchedule xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Description>String</Description>
  <Name>String</Name>
  <NumberOfScheduleDays>0</NumberOfScheduleDays>
  <Resources>
    <AddScheduleResource>
      <Id>0</Id>
    </AddScheduleResource>
  </Resources>
  <ScheduleDates>
    <AddDateScheduleDate>
      <From>0001-01-01T00:00:00</From>
      <To>0001-01-01T00:00:00</To>
    </AddDateScheduleDate>
  </ScheduleDates>
  <Services>
    <AddScheduleService>
      <Id>0</Id>
    </AddScheduleService>
  </Services>
</CreateDateSchedule>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DateScheduleQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <CreatedDate>0001-01-01T00:00:00</CreatedDate>
  <Description>String</Description>
  <Id>0</Id>
  <IsResourceSpecific>false</IsResourceSpecific>
  <Name>String</Name>
  <Resources>
    <ScheduleResources>
      <Id>0</Id>
      <ImageUrl i:nil="true" />
      <Name>String</Name>
    </ScheduleResources>
  </Resources>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <ScheduleDates>
    <DateScheduleDateResponse>
      <From>0001-01-01T00:00:00</From>
      <Id>0</Id>
      <ResponseStatus xmlns:d4p1="http://schemas.servicestack.net/types">
        <d4p1:ErrorCode>String</d4p1:ErrorCode>
        <d4p1:Message>String</d4p1:Message>
        <d4p1:StackTrace>String</d4p1:StackTrace>
        <d4p1:Errors>
          <d4p1:ResponseError>
            <d4p1:ErrorCode>String</d4p1:ErrorCode>
            <d4p1:FieldName>String</d4p1:FieldName>
            <d4p1:Message>String</d4p1:Message>
            <d4p1:Meta xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <d7p1:KeyValueOfstringstring>
                <d7p1:Key>String</d7p1:Key>
                <d7p1:Value>String</d7p1:Value>
              </d7p1:KeyValueOfstringstring>
            </d4p1:Meta>
          </d4p1:ResponseError>
        </d4p1:Errors>
        <d4p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d4p1:Meta>
      </ResponseStatus>
      <To>0001-01-01T00:00:00</To>
    </DateScheduleDateResponse>
  </ScheduleDates>
  <Services>
    <ScheduleServices>
      <Id>0</Id>
      <ImageUrl i:nil="true" />
      <Name>String</Name>
    </ScheduleServices>
  </Services>
  <UpdatedDate>0001-01-01T00:00:00</UpdatedDate>
</DateScheduleQueryResponse>