POST | /api/PostSchedulingGroup |
---|
import Foundation
import ServiceStack
/**
* PostSchedulingGroupRequires active-e Lesson Scheduling Service
*/
// @DataContract
public class PostSchedulingGroupRequest : BaseRequest
{
/**
* Class ID
*/
// @DataMember
// @ApiMember(DataType="string", Description="Class ID", IsRequired=true, Name="ClassId", ParameterType="query")
public var classId:String
/**
* The start date of the student.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The start date of the student.", Format="date-time", Name="StartDate", ParameterType="query")
public var appointmentStart:Date?
/**
* The name of the student
*/
// @DataMember
// @ApiMember(DataType="string", Description="The name of the student", IsRequired=true, Name="StudentName", ParameterType="query")
public var studentName:String
/**
* Online reference number of this appointment
*/
// @DataMember
// @ApiMember(DataType="string", Description="Online reference number of this appointment", Name="RefNumber", ParameterType="query")
public var refNumber:String
/**
* The AIM customer account # of the customer. Optional.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The AIM customer account # of the customer. Optional.", Format="int32", Name="CustomerAcct", ParameterType="query")
public var customerAcct:Int?
/**
* Customer Information
*/
// @DataMember
// @ApiMember(DataType="object", Description="Customer Information", Name="CustomerInfo", ParameterType="query")
public var customerInfo:CustomerInfo
/**
* Additional Customer or Appointment info
*/
// @DataMember
// @ApiMember(DataType="array", Description="Additional Customer or Appointment info", Name="FormInputList", ParameterType="query")
public var formInputList:[FormInput] = []
/**
* Credit Card info of the customer for this appointment
*/
// @DataMember
// @ApiMember(DataType="object", Description="Credit Card info of the customer for this appointment", Name="CcInfo", ParameterType="query")
public var ccInfo:CcInfo
/**
* Notes on this appointment
*/
// @DataMember
// @ApiMember(DataType="string", Description="Notes on this appointment", Name="Notes", ParameterType="query")
public var notes:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case classId
case appointmentStart
case studentName
case refNumber
case customerAcct
case customerInfo
case formInputList
case ccInfo
case notes
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
classId = try container.decodeIfPresent(String.self, forKey: .classId)
appointmentStart = try container.decodeIfPresent(Date.self, forKey: .appointmentStart)
studentName = try container.decodeIfPresent(String.self, forKey: .studentName)
refNumber = try container.decodeIfPresent(String.self, forKey: .refNumber)
customerAcct = try container.decodeIfPresent(Int.self, forKey: .customerAcct)
customerInfo = try container.decodeIfPresent(CustomerInfo.self, forKey: .customerInfo)
formInputList = try container.decodeIfPresent([FormInput].self, forKey: .formInputList) ?? []
ccInfo = try container.decodeIfPresent(CcInfo.self, forKey: .ccInfo)
notes = try container.decodeIfPresent(String.self, forKey: .notes)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if classId != nil { try container.encode(classId, forKey: .classId) }
if appointmentStart != nil { try container.encode(appointmentStart, forKey: .appointmentStart) }
if studentName != nil { try container.encode(studentName, forKey: .studentName) }
if refNumber != nil { try container.encode(refNumber, forKey: .refNumber) }
if customerAcct != nil { try container.encode(customerAcct, forKey: .customerAcct) }
if customerInfo != nil { try container.encode(customerInfo, forKey: .customerInfo) }
if formInputList.count > 0 { try container.encode(formInputList, forKey: .formInputList) }
if ccInfo != nil { try container.encode(ccInfo, forKey: .ccInfo) }
if notes != nil { try container.encode(notes, forKey: .notes) }
}
}
// @DataContract
public class BaseRequest : Codable
{
/**
* This is your AIM API Key provided by Tri-Tech
*/
// @DataMember
// @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
public var apiKey:String
// @DataMember
// @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
public var oAuthToken:String
required public init(){}
}
// @DataContract(Name="CustomerInfo")
public class CustomerInfo : Codable
{
/**
* The WebId of the customer. Optional.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The WebId of the customer. Optional.", Format="int32", IsRequired=true, Name="WebId", ParameterType="query")
public var webId:Int?
/**
* Name of the customer.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Name of the customer.", IsRequired=true, Name="Name", ParameterType="query")
public var name:String
/**
* Address line 1 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 1 of the customer", Name="Addr1", ParameterType="query")
public var addr1:String
/**
* Address line 2 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 2 of the customer", Name="Addr2", ParameterType="query")
public var addr2:String
/**
* City of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="City of the customer", Name="City", ParameterType="query")
public var city:String
/**
* State/Province of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="State/Province of the customer", Name="St", ParameterType="query")
public var st:String
/**
* Zip code of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Zip code of the customer", Name="Zip", ParameterType="query")
public var zip:String
/**
* Country of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Country of the customer", Name="Country", ParameterType="query")
public var country:String
/**
* Phone number of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Phone number of the customer", Name="Phone", ParameterType="query")
public var phone:String
/**
* Email address of the customer. Required.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Email address of the customer. Required.", IsRequired=true, Name="Email", ParameterType="query")
public var email:String
required public init(){}
}
// @DataContract(Name="FormInput")
public class FormInput : Codable
{
/**
* Field Name of the Input Field
*/
// @DataMember
// @ApiMember(DataType="string", Description="Field Name of the Input Field", IsRequired=true, Name="Key", ParameterType="query")
public var key:String
/**
* Value of the Input Field.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Value of the Input Field.", IsRequired=true, Name="Value", ParameterType="query")
public var value:String
/**
* Whether or not the field is encryped with the C2B encryption key.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Whether or not the field is encryped with the C2B encryption key.", IsRequired=true, Name="Encrypted", ParameterType="query")
public var encrypted:Bool
required public init(){}
}
// @DataContract(Name="CCInfo")
public class CcInfo : Codable
{
/**
* Token returned from processor
*/
// @DataMember
// @ApiMember(DataType="string", Description="Token returned from processor", IsRequired=true, Name="TokenStr", ParameterType="query")
public var tokenStr:String
/**
* Card Type (VISA, MCARD, AMEX, DSCVR)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Card Type (VISA, MCARD, AMEX, DSCVR)", IsRequired=true, Name="CardType", ParameterType="query")
public var cardType:String
/**
* Last four of the card
*/
// @DataMember
// @ApiMember(DataType="string", Description="Last four of the card", IsRequired=true, Name="LastFour", ParameterType="query")
public var lastFour:String
/**
* Expiration Date of the Card. (MM/YY)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Expiration Date of the Card. (MM/YY)", Name="Expiration", ParameterType="query")
public var expiration:String
/**
* Reason the card is on file.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Reason the card is on file.", Name="ReasonOnFile", ParameterType="query")
public var reasonOnFile:String
/**
* ID of the existing Token Record in AIM, if applicable
*/
// @DataMember
// @ApiMember(DataType="integer", Description="ID of the existing Token Record in AIM, if applicable", Format="int64", Name="TokenPk", ParameterType="query")
public var tokenPk:Int?
/**
* Is this the customer's primary card? Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Is this the customer's primary card? Defaults to false.", Name="Primary", ParameterType="query")
public var primary:Bool?
required public init(){}
}
// @DataContract
public class PostSchedulingPrivateResponse : BaseResponse
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
// @DataContract
public class BaseResponse : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
public var status:BaseResponseResult
required public init(){}
}
// @DataContract
public class BaseResponseResult : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
public var statusCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
public var login:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
public var errorCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
public var errorDisplayText:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
public var errorMessage:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
public var domainName:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
public var ipAddress:String
required public init(){}
}
Swift PostSchedulingGroupRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/PostSchedulingGroup HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PostSchedulingGroupRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<OAuthToken>String</OAuthToken>
<AppointmentStart>0001-01-01T00:00:00</AppointmentStart>
<CcInfo>
<CardType>String</CardType>
<Expiration>String</Expiration>
<LastFour>String</LastFour>
<Primary>false</Primary>
<ReasonOnFile>String</ReasonOnFile>
<TokenPk>0</TokenPk>
<TokenStr>String</TokenStr>
</CcInfo>
<ClassId>00000000-0000-0000-0000-000000000000</ClassId>
<CustomerAcct>0</CustomerAcct>
<CustomerInfo>
<Addr1>String</Addr1>
<Addr2>String</Addr2>
<City>String</City>
<Country>String</Country>
<Email>String</Email>
<Name>String</Name>
<Phone>String</Phone>
<St>String</St>
<WebId>0</WebId>
<Zip>String</Zip>
</CustomerInfo>
<FormInputList>
<FormInput>
<Encrypted>false</Encrypted>
<Key>String</Key>
<Value>String</Value>
</FormInput>
</FormInputList>
<Notes>String</Notes>
<RefNumber>String</RefNumber>
<StudentName>String</StudentName>
</PostSchedulingGroupRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <PostSchedulingPrivateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService"> <Status> <DomainName>String</DomainName> <ErrorCode>String</ErrorCode> <ErrorDisplayText>String</ErrorDisplayText> <ErrorMessage>String</ErrorMessage> <IpAddress>String</IpAddress> <Login>String</Login> <StatusCode>String</StatusCode> </Status> </PostSchedulingPrivateResponse>