1
0
mirror of synced 2024-11-28 16:06:04 +03:00

Merge pull request #16 from gwinn/master

update api endpoint
This commit is contained in:
Alex Lushpai 2018-07-21 18:59:30 +03:00 committed by GitHub
commit 5a0564d955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -40,7 +40,7 @@ func (c *MgClient) ActivateTransportChannel(request Channel) (ActivateResponse,
var resp ActivateResponse var resp ActivateResponse
outgoing, _ := json.Marshal(&request) outgoing, _ := json.Marshal(&request)
data, status, err := c.PostRequest("/transport/channels", []byte(outgoing)) data, status, err := c.PostRequest("/channels", []byte(outgoing))
if err != nil { if err != nil {
return resp, status, err return resp, status, err
} }
@ -79,7 +79,7 @@ func (c *MgClient) UpdateTransportChannel(request Channel) (UpdateResponse, int,
var resp UpdateResponse var resp UpdateResponse
outgoing, _ := json.Marshal(&request) outgoing, _ := json.Marshal(&request)
data, status, err := c.PutRequest(fmt.Sprintf("/transport/channels/%d", request.ID), []byte(outgoing)) data, status, err := c.PutRequest(fmt.Sprintf("/channels/%d", request.ID), []byte(outgoing))
if err != nil { if err != nil {
return resp, status, err return resp, status, err
} }
@ -113,7 +113,7 @@ func (c *MgClient) DeactivateTransportChannel(id uint64) (DeleteResponse, int, e
var buf []byte var buf []byte
data, status, err := c.DeleteRequest( data, status, err := c.DeleteRequest(
fmt.Sprintf("/transport/channels/%s", strconv.FormatUint(id, 10)), fmt.Sprintf("/channels/%s", strconv.FormatUint(id, 10)),
buf, buf,
) )
if err != nil { if err != nil {
@ -164,7 +164,7 @@ func (c *MgClient) Messages(request SendData) (MessagesResponse, int, error) {
var resp MessagesResponse var resp MessagesResponse
outgoing, _ := json.Marshal(&request) outgoing, _ := json.Marshal(&request)
data, status, err := c.PostRequest("/transport/messages", []byte(outgoing)) data, status, err := c.PostRequest("/messages", []byte(outgoing))
if err != nil { if err != nil {
return resp, status, err return resp, status, err
} }
@ -208,7 +208,7 @@ func (c *MgClient) UpdateMessages(request UpdateData) (MessagesResponse, int, er
var resp MessagesResponse var resp MessagesResponse
outgoing, _ := json.Marshal(&request) outgoing, _ := json.Marshal(&request)
data, status, err := c.PutRequest("/transport/messages", []byte(outgoing)) data, status, err := c.PutRequest("/messages", []byte(outgoing))
if err != nil { if err != nil {
return resp, status, err return resp, status, err
} }
@ -249,7 +249,7 @@ func (c *MgClient) DeleteMessage(request DeleteData) (MessagesResponse, int, err
outgoing, _ := json.Marshal(&request) outgoing, _ := json.Marshal(&request)
data, status, err := c.DeleteRequest( data, status, err := c.DeleteRequest(
"/transport/messages/", "/messages/",
[]byte(outgoing), []byte(outgoing),
) )
if err != nil { if err != nil {

View File

@ -8,7 +8,7 @@ import (
"net/http" "net/http"
) )
var prefix = "/api/v1" var prefix = "/api/transport/v1"
// GetRequest implements GET Request // GetRequest implements GET Request
func (c *MgClient) GetRequest(urlWithParameters string) ([]byte, int, error) { func (c *MgClient) GetRequest(urlWithParameters string) ([]byte, int, error) {