https://github.com/zackproser/wealthengine-go
A fully featured Golang SDK for the WealthEngine API
https://github.com/zackproser/wealthengine-go
Last synced: 12 months ago
JSON representation
A fully featured Golang SDK for the WealthEngine API
- Host: GitHub
- URL: https://github.com/zackproser/wealthengine-go
- Owner: zackproser
- License: mit
- Created: 2017-09-18T18:43:23.000Z (over 8 years ago)
- Default Branch: github
- Last Pushed: 2017-09-19T03:09:35.000Z (over 8 years ago)
- Last Synced: 2025-01-15T01:07:38.355Z (over 1 year ago)
- Language: Go
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WealthEngine Go
A fully featured WealthEngine client delivered in a Golang SDK, for quickly getting up and running with the [WealthEngine REST API](https://dev.wealthengine.com/api).
# Getting Started
```bash
go get github.com/zackproser/wealthengine-go
```
```go
package main
import (
"encoding/json"
"fmt"
"github.com/zackproser/wealthengine"
)
func main() {
// Instantiate a new WealthEngine API client,
// Passing in your APIKey and the environment you want to hit ("Prod" or "Dev")
w := wealthengine.New("278s6sfd-z2cy-569h-f35g-7dwa4090g2", "Prod")
// Score a profile by address
score, scoreErr := w.ScoreOneByAddress("proser", "zachary", "3089 nunya", "business", "berkeley", "CA", "94704", "my-model")
// Score a profile by email
//score, scoreErr := w.ScoreOneByEmail("zackproser@gmail.com", "proser", "zachary", "my-model")
// Score a profile by phone
//score, scoreErr := w.ScoreOneByPhone("15103267023", "zachary", "proser", "my-model")
if scoreErr != nil {
fmt.Printf("scoreErr: %v", scoreErr)
}
scoreJson, mErr := json.Marshal(score)
if mErr != nil {
fmt.Printf("Score err: %v", mErr)
}
fmt.Printf("Score: \n\n%v", string(scoreJson))
// Match a profile by email and name
//profile, err := w.MatchOneByEmail("zackproser@gmail.com", "Zachary", "Proser", "full")
// Match a profile by address
//profile, err := w.MatchOneByAddress("proser", "zachary", "somewhere", "else", "berkeley", "CA", "94704", "basic")
// Match a profile by phone
profile, err := w.MatchOneByPhone("15553339021", "zachary", "proser", "basic")
if err != nil {
fmt.Printf("err: %v\n", err)
}
profileJson, mErr := json.Marshal(profile)
if mErr != nil {
fmt.Printf("Error marshaling JSON: %v\n", mErr)
}
fmt.Printf("json: \n%v", string(profileJson))
// Prepare a batch processing request with several BatchLookups
b := wealthengine.Batch{
[]wealthengine.BatchLookup{{"Proser", "Zach", "1234 st", "apt 1", "somecity", "CA", "94711", "zackproser@gmail.com", "1235103333"}, {"Someone", "Else", "1234 st", "apt 1", "Anaheim", "CA", "947111", "zackproser@gmail.com", "1235103333"}, {"Quabbity", "Ashwitz", "Wakka st", "apt 1", "Columbia", "MD", "947111", "zackproser@gmail.com", "47472727889"}},
}
fmt.Printf("Batch: %v\n", b)
// Batch jobs return a job ID for looking up the status and results later
batchJobId, err := w.FindMany(&b, "full")
fmt.Printf("BatchID: %v", batchJobId)
if batchJobId != nil {
//Use the batch ID to check on the status
status, statusErr := w.GetBatchJobStatus(batchJobId)
if statusErr != nil {
fmt.Printf("StatusErr: %v\n", statusErr)
}
fmt.Printf("Status: %v\n", status)
// Use the batch ID to get the final job results
results, finalErr := w.GetBatchJobResults(batchJobId)
if finalErr != nil {
fmt.Printf("finalErr: %v", finalErr)
}
resultsJson, resultsJsonErr := json.Marshal(results)
if resultsJsonErr != nil {
fmt.Printf("resultsJsonErr: %v", resultsJsonErr)
}
fmt.Printf("Results: %v", string(resultsJson))
}
}
```
# Documentation
[Godocs](https://godoc.org/github.com/zackproser/wealthengine-go)