1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-14 17:20:04 -05:00
ofxgo/cmd/ofx/util.go
Aaron Lindsay d8491bed1d Make Client an interface instead of a struct
This makes it easier to maintain per-institution hacks that start
interacting with each other if you try to do them all in the same client
code. This commit also breaks out the existing Vanguard hack into its
own Client implementation.
2018-10-03 10:18:54 -04:00

33 lines
717 B
Go

package main
import (
"fmt"
"github.com/aclindsa/ofxgo"
"os"
)
func newRequest() (ofxgo.Client, *ofxgo.Request) {
ver, err := ofxgo.NewOfxVersion(ofxVersion)
if err != nil {
fmt.Println("Error creating new OfxVersion enum:", err)
os.Exit(1)
}
var client = ofxgo.GetClient(serverURL,
&ofxgo.BasicClient{
AppID: appID,
AppVer: appVer,
SpecVersion: ver,
NoIndent: noIndentRequests,
})
var query ofxgo.Request
query.URL = serverURL
query.Signon.ClientUID = ofxgo.UID(clientUID)
query.Signon.UserID = ofxgo.String(username)
query.Signon.UserPass = ofxgo.String(password)
query.Signon.Org = ofxgo.String(org)
query.Signon.Fid = ofxgo.String(fid)
return client, &query
}