Agentivity API

<back to all web services

AirSegmentsPerLocation

The following routes are available for this service:
GET/AirSegmentsPerLocation/user
import Foundation
import ServiceStack

// @DataContract(Namespace="schemas.agentivity.com/types")
public class AirSegmentsPerLocation : CompanyLevelRequestBase
{
    // @DataMember
    public var dateStart:String

    // @DataMember
    public var dateEnd:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case dateStart
        case dateEnd
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dateStart = try container.decodeIfPresent(String.self, forKey: .dateStart)
        dateEnd = try container.decodeIfPresent(String.self, forKey: .dateEnd)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if dateStart != nil { try container.encode(dateStart, forKey: .dateStart) }
        if dateEnd != nil { try container.encode(dateEnd, forKey: .dateEnd) }
    }
}

// @DataContract(Namespace="schemas.agentivity.com/types")
public class CompanyLevelRequestBase : PagingMetadata, IMemberUsername, IMemberOwningCompanyCode
{
    /**
    * Comma Delimited List of Owning Company Codes
    */
    // @DataMember
    public var owningCompanyCode:[String]

    /**
    * UserName in form of an email address
    */
    // @DataMember
    public var userName:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case owningCompanyCode
        case userName
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        owningCompanyCode = try container.decodeIfPresent([String].self, forKey: .owningCompanyCode) ?? []
        userName = try container.decodeIfPresent(String.self, forKey: .userName)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if owningCompanyCode != nil { try container.encode(owningCompanyCode, forKey: .owningCompanyCode) }
        if userName != nil { try container.encode(userName, forKey: .userName) }
    }
}

// @DataContract(Name="Metadata", Namespace="schemas.agentivity.com/types")
public class PagingMetadata : Codable
{
    /**
    * Starting Record
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Starting Record", Name="Offset", ParameterType="query")
    public var offset:String

    /**
    * Number of records to return (PageSize)
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Number of records to return (PageSize)", Name="Limit", ParameterType="query")
    public var limit:String

    /**
    * Total Number of Records in a Full Reponse (if no paging)
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Total Number of Records in a Full Reponse (if no paging)", Name="TotalRecords", ParameterType="query")
    public var totalRecords:Int

    /**
    * Total Number of Records in this Reponse (on this page)
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Total Number of Records in this Reponse (on this page)", Name="ResponseRecords", ParameterType="query")
    public var responseRecords:Int

    required public init(){}
}


Swift AirSegmentsPerLocation DTOs

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

HTTP + OTHER

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

GET /AirSegmentsPerLocation/user HTTP/1.1 
Host: api.agentivity.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{Unable to show example output for type 'ICollection`1' using the custom 'other' filter}Cannot dynamically create an instance of type 'System.Collections.Generic.ICollection`1[AgentivityAPI.ServiceModel.Types.AirSegmentsPerCarrierItemResponse]'. Reason: Cannot create an instance of an interface.