POST | /scheduling/class-schedule | Create a Class Schedule |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ClubReady.Web.Api.Scheduling.Model;
using ClubReady.Core.Api.Models;
using ClubReady.Web.Api;
namespace ClubReady.Core.Api.Models
{
public partial class ApiDtoBase
{
public virtual string ApiKey { get; set; }
public virtual int? StoreId { get; set; }
public virtual int? ChainId { get; set; }
}
public partial class ApiResponseBase
{
public virtual bool Success { get; set; }
public virtual string Message { get; set; }
}
public partial class CreateClassScheduleRequestDto
: ApiDtoBase
{
public virtual int ClassId { get; set; }
public virtual DateTime ClassDateTime { get; set; }
public virtual int? TrainerId { get; set; }
public virtual string AlternateClassName { get; set; }
}
public partial class CreateClassScheduleResponseDto
: ApiResponseBase
{
public virtual int? ClassScheduleId { get; set; }
}
}
namespace ClubReady.Web.Api
{
public enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
}
namespace ClubReady.Web.Api.Scheduling.Model
{
public partial class CreateClassScheduleRequest
: CreateClassScheduleRequestDto, IRestrictedApiRequest
{
///<summary>
///Api Key - grants access to resources
///</summary>
[ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")]
public virtual string ApiKey { get; set; }
///<summary>
///Store ID
///</summary>
[ApiMember(DataType="integer", Description="Store ID", IsRequired=true, Name="StoreId", ParameterType="query")]
public virtual int? StoreId { get; set; }
///<summary>
///Class ID
///</summary>
[ApiMember(DataType="integer", Description="Class ID", IsRequired=true, Name="ClassId", ParameterType="query")]
public virtual int ClassId { get; set; }
///<summary>
///Date and Time for Class
///</summary>
[ApiMember(DataType="date-time", Description="Date and Time for Class", IsRequired=true, Name="ClassDateTime", ParameterType="query")]
public virtual DateTime ClassDateTime { get; set; }
///<summary>
///Trainer ID
///</summary>
[ApiMember(DataType="integer", Description="Trainer ID", Name="TrainerId", ParameterType="query")]
public virtual int? TrainerId { get; set; }
///<summary>
///Alternate Class Name
///</summary>
[ApiMember(DataType="string", Description="Alternate Class Name", Name="AlternateClassName", ParameterType="query")]
public virtual string AlternateClassName { get; set; }
public virtual int? RestrictedId { get; set; }
public virtual RestrictedResourceType RestrictedResourceType { get; set; }
}
public partial class CreateClassScheduleResponse
: CreateClassScheduleResponseDto
{
public virtual bool Success { get; set; }
public virtual int? ClassScheduleId { get; set; }
public virtual string Message { get; set; }
}
}
C# CreateClassScheduleRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /scheduling/class-schedule HTTP/1.1
Host: clubready.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
StoreId: 0,
ClassId: 0,
ClassDateTime: 0001-01-01,
TrainerId: 0,
AlternateClassName: String,
RestrictedId: 0,
RestrictedResourceType: Store,
ChainId: 0
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Success: False, ClassScheduleId: 0, Message: String }