Other Classes

The following classes are available globally.

  • Arbitrary precision integer value.

    See more

    Declaration

    Swift

    open class BigInteger: ObjectBase
  • Utility functions for asserting/converting query result into a single item.

    See more

    Declaration

    Swift

    public class Single
  • Arbitrary precision decimal value.

    See more

    Declaration

    Swift

    open class BigDecimal: ObjectBase
  • Encapsulates a map of HTTP cookies.

    See more

    Declaration

    Swift

    open class HTTPCookies: ObjectBase
  • Encapsulates a map of HTTP headers, allowing case-insensitive lookup.

    See more

    Declaration

    Swift

    open class HTTPHeaders: ObjectBase
  • Encapsulates the definitions from a parsed Open Data Protocol (OData) service metadata (CSDL) document.

    See also

    CsdlParser.
    See more

    Declaration

    Swift

    open class CSDLDocument: ObjectBase
  • Exception thrown when an error occurs during the parsing of an Open Data Protocol (OData) service metadata (CSDL) document.

    See also

    CsdlParser.
    See more

    Declaration

    Swift

    open class CSDLError: DataSchemaError
  • Callback which can locate and fetch the text of an Open Data Protocol (OData) service metadata (CSDL) document.

    See also

    CsdlParser.csdlFetcher.
    See more

    Declaration

    Swift

    open class CSDLFetcher: ObjectBase
  • Bitmask flags for CsdlParser.csdlOptions.

    See more

    Declaration

    Swift

    public class CSDLOption
  • Parser for Open Data Protocol (OData) service metadata documents (CSDL).

    See more

    Declaration

    Swift

    open class CSDLParser: ObjectBase
  • OData CSDL compatibility checker.

    See more

    Declaration

    Swift

    open class CsdlCompatibilityChecker: ObjectBase
  • Encapsulates an OData data service.

    See also

    DataQuery.

    Example using proxy classes

    open func dataServiceExample() throws -> Void {
        let provider = OnlineODataProvider(serviceName: "NorthwindService",
            serviceRoot: "http://services.odata.org/V4/Northwind/Northwind.svc/")
        let service = NorthwindService(provider: provider)
        // Alternate using generic DataService - allows provider-specific functions
        // and properties (e.g. traceRequests) to be accessed via `service` object.
        // let service: NorthwindService<OnlineODataProvider> = new NorthwindService(provider: provider)
        let query = DataQuery()
            .select(Customer.customerID, Customer.companyName, Customer.contactName)
            .orderBy(Customer.companyName)
        let customers = try service.fetchCustomers(matching: query)
        self.showCustomers(customers)
        let customer = customers.first!.copy()
        customer.companyName = "Created Inc."
        try service.createEntity(customer)
        customer.companyName = "Updated Inc."
        try service.updateEntity(customer)
        try service.deleteEntity(customer)
    }
    

    Example using dynamic API

    open func dataServiceExample() throws -> Void {
        let provider = OnlineODataProvider(serviceName: "NorthwindService",
            serviceRoot: "http://services.odata.org/V4/Northwind/Northwind.svc/")
        let service = AnyDataService(provider: provider)
        // Alternate using generic DataService - allows provider-specific functions
        // and properties (e.g. traceRequests) to be accessed via `service` object.
        // let service: DataService<OnlineODataProvider> = new DataService(provider: provider)
        let customersEntitySet = service.entitySet(withName: "Customers")
        let customerEntityType = customersEntitySet.entityType
        let customerIDProperty = customerEntityType.property(withName: "CustomerID")
        let companyNameProperty = customerEntityType.property(withName: "CompanyName")
        let contactNameProperty = customerEntityType.property(withName: "ContactName")
        let query = DataQuery()
            .select(customerIDProperty, companyNameProperty, contactNameProperty)
            .from(customersEntitySet).orderBy(companyNameProperty)
        let customers = try service.executeQuery(query).entityList()
        self.showCustomers(customers)
        let customer = customers.first().copyEntity()
        companyNameProperty.setStringValue(in: customer, to: "Created Inc.")
        try service.createEntity(customer)
        companyNameProperty.setStringValue(in: customer, to: "Updated Inc.")
        try service.updateEntity(customer)
        try service.deleteEntity(customer)
    }
    
    See more

    Declaration

    Swift

    open class AnyDataService: ObjectBase
  • A data query subclass for queries that obtain a response from caller-supplied JSON text.

    See more

    Declaration

    Swift

    open class FromJSON: DataQuery
  • Options for interaction with a data network.

    See more

    Declaration

    Swift

    open class NetworkOptions: ObjectBase
  • Options for interaction with a data service.

    See more

    Declaration

    Swift

    open class ServiceOptions: ObjectBase
  • A utility class for formatting OData values as JSON strings.

    See more

    Declaration

    Swift

    public class ToJSON