Harvester

master

A Swift interface to the Harvest time tracking API
tin-whistle/Harvester

Harvester

A Swift interface to the Harvest time tracking API

Harvest API

See the Harvest API V2 Documentation to learn how the Harvest REST API is structured.

Using Harvester

Integration

Harvester is distributed as a Swift package. The repository URL is https://github.com/tin-whistle/Harvester.git

Authentication

Authentication is done using either the OAuth 2 standard or a Personal Access Token. Requests to the Harvest API must include an access token from one of these sources. The Harvester example project uses the Personal Access Token scheme, but you may choose to use an OAuth library or write your own implementation. The only requirement is that your implementation must conform to the AuthorizationProvider protocol which supports authorization, deauthorization, and provides an access token.

OAuth

Any app which wishes to use OAuth with the Harvest API must first be registered with Harvest (requires a Harvest account).

  1. Once logged in, chose Create New OAuth2 Application.
  2. Fill in the app Name.
  3. Fill in the Redirect URL.
  4. Set Multi Account to I need access to one account.
  5. Set Products to I want access to Harvest.
  6. Choose Create Application.
  7. Use the Client ID and Client Secret values generated on this page with your OAuth library or custom implementation.

Personal Access Token

Personal access tokens can be generated on the Harvest developers web page. (requires a Harvest account).

  1. Once logged in, chose Create New Personal Access Token.
  2. Fill in the access token Name.
  3. Choose Create Personal Access Token.
  4. Use the Your Token value generated on this page to authorize all requests to the Harvest API. This will only work for requests to your own account.

Configuration

HarvestAPI is the main point of contact with the Harvester library. It is initialized with a HarvestAPIConfiguration containing the following properties:

  1. appName - The name of your app. This is sent to Harvest as part of a user agent string. It is used to identify which app a request came from.
  2. contactEmail - The email address which Harvest should use to contact you with questions or comments. This is sent to Harvest as part of a user agent string.
  3. authorizationProvider - Your AuthorizationProvider implementation (see Authentication section above).

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Mar 17 2024 17:14:49 GMT-0900 (Hawaii-Aleutian Daylight Time)