Required role: | REGISUserRole |
POST | /Registration/{uuid}/Add/{reporting_term} |
---|
import Foundation
import ServiceStack
public class AddRegistrationsRequest : Codable
{
public var uuid:String
public var transaction_uuid:String
public var reporting_term:String
public var sections:[AddRegistrationRequest] = []
public var authorizing_uuid:String
required public init(){}
}
public class AddRegistrationRequest : Codable
{
public var section_uuid:String
public var amount:Double
public var is_audit:Bool
public var is_provisional:Bool
required public init(){}
}
public class AddRegistrationsResponse : InvoiceResponse
{
public var transaction_uuid:String
public var studentSectionInvoiceItems:[StudentSectionInvoiceItemResponse] = []
public var sectionRates:[String:[SectionRateWithAmountResponse]] = [:]
public var creditTuitionRate:InvoiceItemAdminResponse
public var auditTuitionRate:InvoiceItemAdminResponse
public var studentAge:Int?
public var studentAgeAtEarliestSectionStartDate:Int?
public var isRegentGrad:Bool
public var isOnlyUnclassified:Bool
public var canRegisterForAuditInTerm:Bool
public var canRegisterForCreditInTerm:Bool
public var messages:[String] = []
public var currentTermAuditHours:Double
public var currentTermCreditHours:Double
public var totalCreditHours:Double
public var availableInvoiceItems:[InvoiceItemAdminResponse] = []
public var availableBenefits:[BenefitResponse] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case transaction_uuid
case studentSectionInvoiceItems
case sectionRates
case creditTuitionRate
case auditTuitionRate
case studentAge
case studentAgeAtEarliestSectionStartDate
case isRegentGrad
case isOnlyUnclassified
case canRegisterForAuditInTerm
case canRegisterForCreditInTerm
case messages
case currentTermAuditHours
case currentTermCreditHours
case totalCreditHours
case availableInvoiceItems
case availableBenefits
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
transaction_uuid = try container.decodeIfPresent(String.self, forKey: .transaction_uuid)
studentSectionInvoiceItems = try container.decodeIfPresent([StudentSectionInvoiceItemResponse].self, forKey: .studentSectionInvoiceItems) ?? []
sectionRates = try container.decodeIfPresent([String:[SectionRateWithAmountResponse]].self, forKey: .sectionRates) ?? [:]
creditTuitionRate = try container.decodeIfPresent(InvoiceItemAdminResponse.self, forKey: .creditTuitionRate)
auditTuitionRate = try container.decodeIfPresent(InvoiceItemAdminResponse.self, forKey: .auditTuitionRate)
studentAge = try container.decodeIfPresent(Int.self, forKey: .studentAge)
studentAgeAtEarliestSectionStartDate = try container.decodeIfPresent(Int.self, forKey: .studentAgeAtEarliestSectionStartDate)
isRegentGrad = try container.decodeIfPresent(Bool.self, forKey: .isRegentGrad)
isOnlyUnclassified = try container.decodeIfPresent(Bool.self, forKey: .isOnlyUnclassified)
canRegisterForAuditInTerm = try container.decodeIfPresent(Bool.self, forKey: .canRegisterForAuditInTerm)
canRegisterForCreditInTerm = try container.decodeIfPresent(Bool.self, forKey: .canRegisterForCreditInTerm)
messages = try container.decodeIfPresent([String].self, forKey: .messages) ?? []
currentTermAuditHours = try container.decodeIfPresent(Double.self, forKey: .currentTermAuditHours)
currentTermCreditHours = try container.decodeIfPresent(Double.self, forKey: .currentTermCreditHours)
totalCreditHours = try container.decodeIfPresent(Double.self, forKey: .totalCreditHours)
availableInvoiceItems = try container.decodeIfPresent([InvoiceItemAdminResponse].self, forKey: .availableInvoiceItems) ?? []
availableBenefits = try container.decodeIfPresent([BenefitResponse].self, forKey: .availableBenefits) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if transaction_uuid != nil { try container.encode(transaction_uuid, forKey: .transaction_uuid) }
if studentSectionInvoiceItems.count > 0 { try container.encode(studentSectionInvoiceItems, forKey: .studentSectionInvoiceItems) }
if sectionRates.count > 0 { try container.encode(sectionRates, forKey: .sectionRates) }
if creditTuitionRate != nil { try container.encode(creditTuitionRate, forKey: .creditTuitionRate) }
if auditTuitionRate != nil { try container.encode(auditTuitionRate, forKey: .auditTuitionRate) }
if studentAge != nil { try container.encode(studentAge, forKey: .studentAge) }
if studentAgeAtEarliestSectionStartDate != nil { try container.encode(studentAgeAtEarliestSectionStartDate, forKey: .studentAgeAtEarliestSectionStartDate) }
if isRegentGrad != nil { try container.encode(isRegentGrad, forKey: .isRegentGrad) }
if isOnlyUnclassified != nil { try container.encode(isOnlyUnclassified, forKey: .isOnlyUnclassified) }
if canRegisterForAuditInTerm != nil { try container.encode(canRegisterForAuditInTerm, forKey: .canRegisterForAuditInTerm) }
if canRegisterForCreditInTerm != nil { try container.encode(canRegisterForCreditInTerm, forKey: .canRegisterForCreditInTerm) }
if messages.count > 0 { try container.encode(messages, forKey: .messages) }
if currentTermAuditHours != nil { try container.encode(currentTermAuditHours, forKey: .currentTermAuditHours) }
if currentTermCreditHours != nil { try container.encode(currentTermCreditHours, forKey: .currentTermCreditHours) }
if totalCreditHours != nil { try container.encode(totalCreditHours, forKey: .totalCreditHours) }
if availableInvoiceItems.count > 0 { try container.encode(availableInvoiceItems, forKey: .availableInvoiceItems) }
if availableBenefits.count > 0 { try container.encode(availableBenefits, forKey: .availableBenefits) }
}
}
public class InvoiceResponse : Codable
{
public var responseStatus:ResponseStatus
public var invoiceUUID:String
public var regent_id:Int
public var uuid:String
public var reporting_term:String
public var total_charges:Double?
public var total_credits:Double?
public var current_status:String
public var timestamp:Date
required public init(){}
}
public class StudentSectionInvoiceItemResponse : InvoiceItemResponse
{
public var studentSection:StudentSectionResponse
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case studentSection
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
studentSection = try container.decodeIfPresent(StudentSectionResponse.self, forKey: .studentSection)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if studentSection != nil { try container.encode(studentSection, forKey: .studentSection) }
}
}
public class InvoiceItemResponse : Codable
{
public var responseStatus:ResponseStatus
public var invoiceItemUUID:String
public var rate_id:Int
public var rate_code:String
public var rate_description:String
public var charge:Double?
public var credit:Double?
required public init(){}
}
public class StudentSectionResponse : SectionResponse
{
public var studentSectionUUID:String
public var registered_amount:Double
public var is_provisional:Bool
public var is_audit:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case studentSectionUUID
case registered_amount
case is_provisional
case is_audit
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
studentSectionUUID = try container.decodeIfPresent(String.self, forKey: .studentSectionUUID)
registered_amount = try container.decodeIfPresent(Double.self, forKey: .registered_amount)
is_provisional = try container.decodeIfPresent(Bool.self, forKey: .is_provisional)
is_audit = try container.decodeIfPresent(Bool.self, forKey: .is_audit)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if studentSectionUUID != nil { try container.encode(studentSectionUUID, forKey: .studentSectionUUID) }
if registered_amount != nil { try container.encode(registered_amount, forKey: .registered_amount) }
if is_provisional != nil { try container.encode(is_provisional, forKey: .is_provisional) }
if is_audit != nil { try container.encode(is_audit, forKey: .is_audit) }
}
}
public class SectionResponse : Codable
{
public var responseStatus:ResponseStatus
public var secUUID:String
public var course_name:String
public var section_code:String
public var course_title:String
public var course_short_title:String
public var course_description:String
public var crosslist_description:String
public var crosslist_course_name:String
public var location_long_name:String
public var room:String
public var instructors:[InstructorResponse] = []
public var required_documents:[DocumentResponse] = []
public var start_date:Date?
public var end_date:Date?
public var first_meeting_date:Date?
public var last_meeting_date:Date?
public var meeting_days:String
public var start_times:[String] = []
public var end_times:[String] = []
public var is_online_only:Bool
public var is_weekend:Bool
public var is_weekday:Bool
public var is_evening:Bool
public var is_waitlist:Bool
public var has_special_requirements:Bool
public var special_requirements:String
public var is_unlisted:Bool
public var credit_amounts:[Double] = []
public var audit_amounts:[Double] = []
public var audits_short_name:String
public var audits_long_name:String
public var credits_short_name:String
public var credits_long_name:String
public var distance_ed_materials:String
public var prerequisites:String
public var corequisites:String
public var capacity:Int?
public var flat_fee_amount:Double?
public var additional_fee_amount:Double?
public var registered_students:Int
public var three_credit_plus:Int
public var two_credit:Int
public var one_credit:Int
public var three_audit_plus:Int
public var two_audit:Int
public var one_audit:Int
public var crosslist_registered_students:Int
public var grades_received:Int
public var crosslist_grades_received:Int
public var registration_start_date:Date?
public var registration_end_date:Date?
public var add_start_date:Date?
public var add_end_date:Date?
public var drop_start_date:Date?
public var drop_end_date:Date?
public var grading_end_date:Date?
public var term:String
public var reporting_term:String
public var reporting_year:Int
public var current_status:String
public var added_by:String
public var added_date:Date?
public var changed_by:String
public var changed_date:Date?
public var timestamp:Date
required public init(){}
}
public class InstructorResponse : Codable
{
public var responseStatus:ResponseStatus
public var regent_id:Int
public var regent_login:String
public var preferred_name:String
public var first_name:String
public var last_name:String
public var full_name:String
public var email:String
public var image_base64:String
required public init(){}
}
public class DocumentResponse : Codable
{
public var code:String
public var document_name:String
public var document_description:String
required public init(){}
}
public class InvoiceItemAdminResponse : Codable
{
public var responseStatus:ResponseStatus
public var invoiceItemUUID:String
public var rate_id:Int
public var rate_code:String
public var rate_description:String
public var is_required:Bool
public var is_optional:Bool
public var charge:Double?
public var credit:Double?
required public init(){}
}
public class BenefitResponse : Codable
{
public var rate_id:Int
public var rate_code:String
public var rate_description:String
public var percentage_rate:Double
public var is_optional:Bool
public var is_required:Bool
required public init(){}
}
Swift AddRegistrationsRequest 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 /Registration/{uuid}/Add/{reporting_term} HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
uuid: String,
transaction_uuid: String,
reporting_term: String,
sections:
[
{
section_uuid: String,
amount: 0,
is_audit: False,
is_provisional: False
}
],
authorizing_uuid: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { transaction_uuid: String, studentSectionInvoiceItems: [ { studentSection: { studentSectionUUID: String, registered_amount: 0, is_provisional: False, is_audit: False, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, secUUID: String, course_name: String, section_code: String, course_title: String, course_short_title: String, course_description: String, crosslist_description: String, crosslist_course_name: String, location_long_name: String, room: String, instructors: [ { responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, regent_id: 0, regent_login: String, preferred_name: String, first_name: String, last_name: String, full_name: String, email: String, image_base64: String } ], required_documents: [ { code: String, document_name: String, document_description: String } ], start_date: 0001-01-01, end_date: 0001-01-01, first_meeting_date: 0001-01-01, last_meeting_date: 0001-01-01, meeting_days: String, start_times: [ String ], end_times: [ String ], is_online_only: False, is_weekend: False, is_weekday: False, is_evening: False, is_waitlist: False, has_special_requirements: False, special_requirements: String, is_unlisted: False, credit_amounts: [ 0 ], audit_amounts: [ 0 ], audits_short_name: String, audits_long_name: String, credits_short_name: String, credits_long_name: String, distance_ed_materials: String, prerequisites: String, corequisites: String, capacity: 0, flat_fee_amount: 0, additional_fee_amount: 0, registered_students: 0, three_credit_plus: 0, two_credit: 0, one_credit: 0, three_audit_plus: 0, two_audit: 0, one_audit: 0, crosslist_registered_students: 0, grades_received: 0, crosslist_grades_received: 0, registration_start_date: 0001-01-01, registration_end_date: 0001-01-01, add_start_date: 0001-01-01, add_end_date: 0001-01-01, drop_start_date: 0001-01-01, drop_end_date: 0001-01-01, grading_end_date: 0001-01-01, term: String, reporting_term: String, reporting_year: 0, current_status: String, added_by: String, added_date: 0001-01-01, changed_by: String, changed_date: 0001-01-01, timestamp: 0001-01-01 }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, invoiceItemUUID: String, rate_id: 0, rate_code: String, rate_description: String, charge: 0, credit: 0 } ], sectionRates: { String: [ { rate_id: 0, charge: 0, credit: 0, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, uuid: String, secUUID: String, section_id: 0, course_name: String, section_code: String, title: String, reporting_term: String, rate_code: String, rate_description: String, is_override_credit_rate: False, is_override_audit_rate: False } ] }, creditTuitionRate: { responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, invoiceItemUUID: String, rate_id: 0, rate_code: String, rate_description: String, is_required: False, is_optional: False, charge: 0, credit: 0 }, auditTuitionRate: { responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, invoiceItemUUID: String, rate_id: 0, rate_code: String, rate_description: String, is_required: False, is_optional: False, charge: 0, credit: 0 }, studentAge: 0, studentAgeAtEarliestSectionStartDate: 0, isRegentGrad: False, isOnlyUnclassified: False, canRegisterForAuditInTerm: False, canRegisterForCreditInTerm: False, messages: [ String ], currentTermAuditHours: 0, currentTermCreditHours: 0, totalCreditHours: 0, availableInvoiceItems: [ { responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, invoiceItemUUID: String, rate_id: 0, rate_code: String, rate_description: String, is_required: False, is_optional: False, charge: 0, credit: 0 } ], availableBenefits: [ { rate_id: 0, rate_code: String, rate_description: String, percentage_rate: 0, is_optional: False, is_required: False } ], responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, invoiceUUID: String, regent_id: 0, uuid: String, reporting_term: String, total_charges: 0, total_credits: 0, current_status: String, timestamp: 0001-01-01 }