https://github.com/leonelquinteros/hubspot
Go HubSpot SDK
https://github.com/leonelquinteros/hubspot
api-client go golang hubspot hubspot-api hubspot-sdk rest
Last synced: 4 months ago
JSON representation
Go HubSpot SDK
- Host: GitHub
- URL: https://github.com/leonelquinteros/hubspot
- Owner: leonelquinteros
- License: mit
- Created: 2019-07-29T22:00:57.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-02T04:38:37.000Z (about 5 years ago)
- Last Synced: 2024-09-25T09:11:51.541Z (almost 2 years ago)
- Topics: api-client, go, golang, hubspot, hubspot-api, hubspot-sdk, rest
- Language: Go
- Size: 18.6 KB
- Stars: 12
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/leonelquinteros/hubspot)
[](LICENSE)
[](https://godoc.org/github.com/leonelquinteros/hubspot)
[](https://goreportcard.com/report/github.com/leonelquinteros/hubspot)
# HubSpot API client SDK for Go
## Install
```
go get github.com/leonelquinteros/hubspot
```
## Quickstart
```go
package main
import "github.com/leonelquinteros/hubspot"
func main() {
// Create client object with config from environment variables (HUBSPOT_API_HOST, HUBSPOT_API_KEY, HUBSPOT_OAUTH_TOKEN)
c := hubspot.NewClient(hubspot.NewClientConfig())
// Create new contact
data := hubspot.ContactsRequest{
hubspot.Properties: []hubspot.Property{
hubspot.Property{
Property: "email",
Value: "contact@example.com",
},
hubspot.Property{
Property: "firstname",
Value: "Contact",
},
hubspot.Property{
Property: "lastname",
Value: "Example",
},
},
}
r, err := c.Contacts().Create(data)
if err != nil {
log.Fatal(err)
}
// Get contact by email
contact, err = c.Contacts().GetByEmail("contact@example.com")
if err != nil {
log.Fatal(err)
}
// Print contact object
fmt.Printf("%+v", contact)
}
```
## Full documentation
https://godoc.org/github.com/leonelquinteros/hubspot