DKRouter

public enum DKRouter : URLRequestConvertible

Route network traffic across all supported API endpoints for Dropmark

  • The domain and path for all endpoints on the Dropmark API. Defaults to “https://api.dropmark.com/v1”, and may be modified for different API versions.

    Declaration

    Swift

    public static var baseURLString: String
  • The number of objects to list per page request. Defaults to 24

    Declaration

    Swift

    public static var pageSize: Int

Activity

  • Get a list of the most recently updated items across a user’s teams and personal accounts. Returns a DKItem list.

    Declaration

    Swift

    case activity(parameters: Parameters?)

Authentication

  • Pass in an email and password, and get a user object containing the token necessary to authenticate requests on behalf of the user. Returns a DKUser object.

    Declaration

    Swift

    case authenticate(parameters: Parameters)

Collections

Comments

Emails

  • Get a list of emails associated with the current user. Returns a String list.

    Declaration

    Swift

    case listEmails
  • Add an email for the current user

    Declaration

    Swift

    case createEmail(email: String)
  • Delete an email for the current user

    Declaration

    Swift

    case deleteEmail(id: NSNumber)

Items

Reactions

Search

  • Run a search for collections, items, comments, reactions, and invites using the q parameter. Note: Be sure to use the DKResponseListAny serializer to accept varying object types. Returns a list containing ‘DKCollection’, ‘DKItem’, ‘DKComment’, ‘DKReaction’, and ‘DKInvite’ objects.

    Declaration

    Swift

    case search(queryParameters: Parameters?)

Tags

  • Get a list of tags associated with the current user. Returns a DKTag list.

    Declaration

    Swift

    case listTags
  • Get a list of tags applied to the specified item. Returns a DKTag list.

    Declaration

    Swift

    case listTagsForItem(itemID: NSNumber)
  • Create a new tag and apply it to the specified item. Returns a DKTag object.

    Declaration

    Swift

    case createTagForItem(itemID: NSNumber, name: String)
  • Delete a tag. Returns only a 200 response.

    Declaration

    Swift

    case deleteTag(id: NSNumber)

Teams

Users

  • Create a user (aka register a new account). Returns a DKUser object.

    Declaration

    Swift

    case createUser(bodyParameters: Parameters)
  • Get the user object for the current user. NOTE: The user object returned by this endpoint will not contain a ‘token’ for authentication. Returns a DKUser object.

    Declaration

    Swift

    case getUser(queryParameters: Parameters?)
  • Update information for the current user. Returns a DKUser object.

    Declaration

    Swift

    case updateUser(bodyParameters: Parameters)
  • Get a list of users associated with the current user

    Declaration

    Swift

    case listContacts
  • Check if an email is available for registration. Returns a Bool value.

    Declaration

    Swift

    case getEmailAvailability(email: String)
  • Check if a username is available for registration. Returns a Bool value.

    Declaration

    Swift

    case getUsernameAvailability(username: String)

Uploads

  • Use this endpoint to get an upload signature for direct uploads to Amazon S3

    Declaration

    Swift

    case createUploadSignature(bodyParameters: Parameters)

URLRequestConvertible

  • Returns a URL request or throws if an Error was encountered.

    - Throws: An `Error` if the underlying `URLRequest` is `nil`.
    - Returns: A URL request.
    

    Declaration

    Swift

    public func asURLRequest() throws -> URLRequest

Authentication

  • To access API resources, an API token is required in the header of all requests. To authenticate with this function, first set the DKRouter.apiToken variable. Then pass a reference to a request through.

    Throws

    Returns an error if no API token is found

    Declaration

    Swift

    public static func authenticateAPIRequest(_ urlRequest: inout URLRequest) throws

    Parameters

    urlRequest

    A reference to a URLRequest

  • To authorize requests on behalf of a user, the user’s private token must be encoded and supplied in the Authorization header. To authorize a user’s request for the duration of the app session, set an authenticated user to DKRouter.user.

    Throws

    Returns errors if no user or user token are found

    Declaration

    Swift

    public static func authorizeUserRequest(_ urlRequest: inout URLRequest) throws

    Parameters

    urlRequest

    A reference to a URLRequest