Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /schedules/date | Add new date schedule | Add new date schedule to the company for the currently logged in user, only administrators are allowed to add schedules. |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BokaMera.API.ServiceModel.Dtos
Namespace Global
Namespace BokaMera.API.ServiceModel.Dtos
Public Partial Class AddDateScheduleDate
'''<Summary>
'''The from date for the timeslot
'''</Summary>
<ApiMember(Description:="The from date for the timeslot", IsRequired:=true)>
Public Overridable Property From As Date
'''<Summary>
'''The to date for the timeslot
'''</Summary>
<ApiMember(Description:="The to date for the timeslot", IsRequired:=true)>
Public Overridable Property To As Date
End Class
Public Partial Class AddScheduleResource
'''<Summary>
'''The resource id
'''</Summary>
<ApiMember(Description:="The resource id", IsRequired:=true)>
Public Overridable Property Id As Integer
End Class
Public Partial Class AddScheduleService
'''<Summary>
'''The service id
'''</Summary>
<ApiMember(Description:="The service id", IsRequired:=true)>
Public Overridable Property Id As Integer
End Class
<ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class CreateDateSchedule
Implements ICompany
Public Sub New()
ScheduleDates = New List(Of AddDateScheduleDate)
Resources = New List(Of AddScheduleResource)
Services = New List(Of AddScheduleService)
End Sub
'''<Summary>
'''The company id, if empty will use the company id for the user you are logged in with.
'''</Summary>
<ApiMember(Description:="The company id, if empty will use the company id for the user you are logged in with.")>
Public Overridable Property CompanyId As Nullable(Of Guid)
'''<Summary>
'''The schedule name
'''</Summary>
<ApiMember(Description:="The schedule name")>
Public Overridable Property Name As String
'''<Summary>
'''The schedule description
'''</Summary>
<ApiMember(Description:="The schedule description")>
Public Overridable Property Description As String
'''<Summary>
'''If schedule is active or not
'''</Summary>
<ApiMember(Description:="If schedule is active or not")>
Public Overridable Property Active As Boolean
'''<Summary>
'''The number of days the schedule is valid from todays date
'''</Summary>
<ApiMember(Description:="The number of days the schedule is valid from todays date", IsRequired:=true)>
Public Overridable Property NumberOfScheduleDays As Integer
'''<Summary>
'''The dates for the schedule. This is the actual timeslots.
'''</Summary>
<ApiMember(Description:="The dates for the schedule. This is the actual timeslots.")>
Public Overridable Property ScheduleDates As List(Of AddDateScheduleDate)
'''<Summary>
'''If the schedule is only connected to some resources, add them here. If empty, it will be used by all resources.
'''</Summary>
<ApiMember(Description:="If the schedule is only connected to some resources, add them here. If empty, it will be used by all resources.")>
Public Overridable Property Resources As List(Of AddScheduleResource)
'''<Summary>
'''Set what services the schedule should be connected to.
'''</Summary>
<ApiMember(Description:="Set what services the schedule should be connected to.")>
Public Overridable Property Services As List(Of AddScheduleService)
End Class
Public Partial Class DateScheduleDateResponse
Public Overridable Property Id As Integer
Public Overridable Property From As Date
Public Overridable Property To As Date
Public Overridable Property ResponseStatus As ResponseStatus
End Class
Public Partial Class DateScheduleQueryResponse
Public Sub New()
ScheduleDates = New List(Of DateScheduleDateResponse)
Resources = New List(Of ScheduleResources)
Services = New List(Of ScheduleServices)
End Sub
'''<Summary>
'''The schedule id
'''</Summary>
<ApiMember(Description:="The schedule id")>
Public Overridable Property Id As Integer
'''<Summary>
'''Name of the schedule
'''</Summary>
<ApiMember(Description:="Name of the schedule")>
Public Overridable Property Name As String
'''<Summary>
'''Description of the schedule
'''</Summary>
<ApiMember(Description:="Description of the schedule")>
Public Overridable Property Description As String
'''<Summary>
'''If the schedule is active or not
'''</Summary>
<ApiMember(Description:="If the schedule is active or not")>
Public Overridable Property Active As Boolean
'''<Summary>
'''If the schedule is only connected to some specific resources. Note: You must have IncludeResources property to see this.
'''</Summary>
<ApiMember(Description:="If the schedule is only connected to some specific resources. Note: You must have IncludeResources property to see this.", IsRequired:=true)>
Public Overridable Property IsResourceSpecific As Nullable(Of Boolean)
'''<Summary>
'''Schedule dates
'''</Summary>
<ApiMember(Description:="Schedule dates")>
Public Overridable Property ScheduleDates As List(Of DateScheduleDateResponse)
'''<Summary>
'''The resources that is connected to the schedule
'''</Summary>
<ApiMember(Description:="The resources that is connected to the schedule")>
Public Overridable Property Resources As List(Of ScheduleResources)
'''<Summary>
'''The services that is connected to the schedule
'''</Summary>
<ApiMember(Description:="The services that is connected to the schedule")>
Public Overridable Property Services As List(Of ScheduleServices)
'''<Summary>
'''The timestamp when the schedule was updated
'''</Summary>
<ApiMember(Description:="The timestamp when the schedule was updated", IsRequired:=true)>
Public Overridable Property UpdatedDate As Date
'''<Summary>
'''The timestamp when the schedule was created
'''</Summary>
<ApiMember(Description:="The timestamp when the schedule was created", IsRequired:=true)>
Public Overridable Property CreatedDate As Date
Public Overridable Property ResponseStatus As ResponseStatus
End Class
Public Partial Class ScheduleResources
Public Overridable Property Id As Integer
'''<Summary>
'''Name of the resource
'''</Summary>
<ApiMember(Description:="Name of the resource")>
Public Overridable Property Name As String
'''<Summary>
'''The image url of the resource
'''</Summary>
<ApiMember(Description:="The image url of the resource")>
Public Overridable Property ImageUrl As Uri
End Class
Public Partial Class ScheduleServices
Public Overridable Property Id As Integer
'''<Summary>
'''Name of the service
'''</Summary>
<ApiMember(Description:="Name of the service")>
Public Overridable Property Name As String
'''<Summary>
'''The image url of the service
'''</Summary>
<ApiMember(Description:="The image url of the service")>
Public Overridable Property ImageUrl As Uri
End Class
End Namespace
End Namespace
VB.NET CreateDateSchedule DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Name":"String","Description":"String","Active":false,"NumberOfScheduleDays":0,"ScheduleDates":[{}],"Resources":[{"Id":0}],"Services":[{"Id":0}]}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Id":0,"Name":"String","Description":"String","Active":false,"IsResourceSpecific":false,"ScheduleDates":[{"Id":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}],"Resources":[{"Id":0,"Name":"String"}],"Services":[{"Id":0,"Name":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}