API Tools
Low level classes to simplify implementing REST API calls via URLRequest and URLSession. Feel free to use them if you wish.
- 
                  
                  Convenience protocol to define connection parameters for API calls when using See moreURLRequestviaJcConnectionRequestDeclarationSwift public protocol JcConnection
- 
                  
                  Represents credentials to be used for making requests DeclarationSwift public class JcCredentials
- 
                  
                  Convenience class to simplify API calls via wrapped instances of UrlRequestandUrlSessionYou will need instantiate a validJcConnectionobject via theJcConnectionFactoryclass to instantiate an object of this class.Notes:This class should not be used directly, use it as a inherited class and leverage the various _get(resourcePath:completionHandler:),_delete(resourcePath:completionHandler:)_execute(method:resourcePath:contentType:request:completionHandler:)methods from your class.Objects derived from this class are not thread safe and should be reused. Create an instance for each request as required See moreDeclarationSwift public class JcConnectionRequest<T> where T : JcSimpleConnection
- 
                  
                  Undocumented DeclarationSwift public protocol JcEncodableContent : Decodable, Encodable
- 
                  
                  Convenience class to allow multi-part formatted data to be sent/received via http/s Example: (get)return super._getMultipart(resourcePath: args(id)) { (response) in if (response.status == .SUCCESS) { for part in response.content!.parts { var name = part.name var filename = part.fileName var contentType = part.contentType var data = part.content } } }Example: (post)
 See morevar mp = JcMultiPartContent() mp.add("object", contentType: nil, content: Data("{\"name\": \"\(name)\", \"type\":\"\(contentType)\"}".utf8)) mp.add("filesize", contentType: nil, content: Data("\(data.count)".utf8)) mp.add("file", contentType: contentType, content: data) return super._execute(method: JcConnectionRequest.Method.POST, resourcePath: C8Y_BINARIES_API, request: mp) { (response) in if (response.status == .SUCCESS) { ... } }DeclarationSwift public struct JcMultiPartContent
 View on GitHub
            View on GitHub
           API Tools  Reference
      API Tools  Reference