HarvestController

public final class HarvestController

The Harvest controller is responsible for all interactions with the Harvest API. It must be initialised with a company name, account username and account password.

Currently the controller uses basic Auth to access the API but should support the OAuth flow in the future.

  • The controller for managing Timers

    Declaration

    Swift

    public let timersController: TimersController
  • The controller for managing contacts

    Declaration

    Swift

    public let contactsController: ContactsController
  • The controller for getting the user account

    Declaration

    Swift

    public let accountController: AccountController
  • The controller for managing clients

    Declaration

    Swift

    public let clientsController: ClientsController
  • Initialises a new harvest controller with the given credentials. You must supply credentials to log in and access the harvest API.

    Declaration

    Swift

    public init(accountName: String!, username: String!, password: String!)

    Parameters

    accountName

    The name of the account as used when logging into the website as ’https://xxxx.harvestapp.com’ where xxxx is your account name

    username

    The username of the account to log in with. This is usually the users email address

    password

    The password for the supplied username

  • Gets all registered users for the given account

    Declaration

    Swift

    public func getUsers(completionHandler: (users: [User?]?, requestError: NSError?) -> ())

    Parameters

    completionHandler

    The completion handler to return users and errors to

  • Gets projects for the account

    • parameters:
    • completionHandler: The completion handler to return projects and errors to

    Declaration

    Swift

    public func getProjects(completionHandler: (projects: [Project?]?, requestError: NSError?) -> ())
  • Gets clients for the account

    • parameters:
    • completionHandler: The completion handler to return clients and errors to

    Declaration

    Swift

    public func getClients(completionHandler: (clients: [Client?]?, requestError: NSError?) -> ())