force is a Go client library for accessing the Salesforce API ☁️
Switch branches/tags
Nothing to show
Clone or download

README.md

force

force is a Go client library for accessing the Salesforce API.

GoDoc TravisCI Build Status CircleCI Build Status Coverage Status

WARNING: Both the documentation and the package itself is under heavy development and in a very early stage. That means, this repo is full of untested code and the API can break without any further notice. Therefore, it comes with absolutely no warranty at all. Feel free to browse or even contribute to it :)

Usage

import "github.com/jpmonette/force"

Construct a new Force client, then use the various services on the client to access different parts of the Salesforce API. For example, to retrieve query performance feedback:

  c, _ := force.NewClient(client, "http://emea.salesforce.com/")
  explain, err := c.QueryExplain("SELECT Id, Name, OwnerId FROM Account LIMIT 10")

To execute some anonymous Apex code, you can use the ExecuteAnonymous function, part of the Tooling service:

c.Tooling.ExecuteAnonymous("System.debug('Hello world!');")

Authentication

The force library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you. The easiest and recommended way to do this is using the oauth2 library, but you can always use any other library that provides an http.Client.

Roadmap

This library is being initially developed for one of my internal project, so API methods will likely be implemented in the order that they are needed by my project. Eventually, I would like to cover the entire Salesforce API, so contributions are of course always welcome. The calling pattern is pretty well established, so adding new methods is relatively straightforward.

License

This library is distributed under the MIT license found in the LICENSE file.