Session

public struct Session

The Session struct is a wrapper for the REST API calls

  • identifying whether developers are using their own UI or the Judo Out of the box UI

    Declaration

    Swift

    public var uiClientMode = false
  • Set the app to sandboxed mode

    Declaration

    Swift

    public var sandboxed: Bool = false
  • POST Helper Method for accessing the judo REST API

    Parameter

    Parameter path: the path

    Parameter

    Parameter parameters: information that is set in the HTTP Body

    Parameter

    Parameter completion: completion callblack block with the results

    Declaration

    Swift

    public func POST(path: String, parameters: JSONDictionary, completion: JudoCompletionBlock)

    Parameters

    path

    the path

    parameters

    information that is set in the HTTP Body

    completion

    completion callblack block with the results

  • Helper Method to create a JSON HTTP request with authentication

    Parameter

    Parameter url: the url for the request

    Returns

    a JSON HTTP request with authorization set

    Declaration

    Swift

    public func judoRequest(url: String) -> NSMutableURLRequest

    Parameters

    url

    the url for the request

    Return Value

    a JSON HTTP request with authorization set

  • Helper Method to create a JSON HTTP request with authentication

    Parameter

    Parameter request: the request that is accessed

    Parameter

    Parameter completion: a block that gets called when the call finishes, it carries two objects that indicate whether the call was a success or a failure

    Returns

    a NSURLSessionDataTask that can be used to manipulate the call

    Declaration

    Swift

    public func task(request: NSURLRequest, completion: JudoCompletionBlock) -> NSURLSessionDataTask

    Parameters

    request

    the request that is accessed

    completion

    a block that gets called when the call finishes, it carries two objects that indicate whether the call was a success or a failure

    Return Value

    a NSURLSessionDataTask that can be used to manipulate the call