1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 20:28:38 -04:00

Stop using form elements for API

Just send the JSON as the request body
This commit is contained in:
2017-11-13 20:48:19 -05:00
parent 9624f0c5bc
commit 5a6be5a07b
23 changed files with 87 additions and 159 deletions

View File

@ -9,13 +9,13 @@ import (
func createSecurity(client *http.Client, security *handlers.Security) (*handlers.Security, error) {
var s handlers.Security
err := create(client, security, &s, "/v1/securities/", "security")
err := create(client, security, &s, "/v1/securities/")
return &s, err
}
func getSecurity(client *http.Client, securityid int64) (*handlers.Security, error) {
var s handlers.Security
err := read(client, &s, "/v1/securities/"+strconv.FormatInt(securityid, 10), "security")
err := read(client, &s, "/v1/securities/"+strconv.FormatInt(securityid, 10))
if err != nil {
return nil, err
}
@ -24,7 +24,7 @@ func getSecurity(client *http.Client, securityid int64) (*handlers.Security, err
func getSecurities(client *http.Client) (*handlers.SecurityList, error) {
var sl handlers.SecurityList
err := read(client, &sl, "/v1/securities/", "securities")
err := read(client, &sl, "/v1/securities/")
if err != nil {
return nil, err
}
@ -33,7 +33,7 @@ func getSecurities(client *http.Client) (*handlers.SecurityList, error) {
func updateSecurity(client *http.Client, security *handlers.Security) (*handlers.Security, error) {
var s handlers.Security
err := update(client, security, &s, "/v1/securities/"+strconv.FormatInt(security.SecurityId, 10), "security")
err := update(client, security, &s, "/v1/securities/"+strconv.FormatInt(security.SecurityId, 10))
if err != nil {
return nil, err
}
@ -41,7 +41,7 @@ func updateSecurity(client *http.Client, security *handlers.Security) (*handlers
}
func deleteSecurity(client *http.Client, s *handlers.Security) error {
err := remove(client, "/v1/securities/"+strconv.FormatInt(s.SecurityId, 10), "security")
err := remove(client, "/v1/securities/"+strconv.FormatInt(s.SecurityId, 10))
if err != nil {
return err
}