Compare commits

..

No commits in common. "0f678ff28a908146c7085721c5be968dbbbdf777" and "61d7b5850d44c5f96a67bed9a9e8b53380aa1d21" have entirely different histories.

4 changed files with 0 additions and 48 deletions

View File

@ -3,7 +3,6 @@ package kiotviet
const (
apiPathListBranches = "/branches"
apiPathListProductOnHands = "/productOnHands"
apiPathListWebhook = "/webhooks"
apiPathRegisterWebhook = "/webhooks"
apiPathUnregisterWebhook = "/webhooks/%d" // %s -> webhook id

View File

@ -122,34 +122,6 @@ func (c *Client) GetBranches(req ListBranchesReq) (*ListBranchesRes, error) {
return &data, nil
}
func (c *Client) ListWebhooks(req ListWebhookReq) (*ListWebhookRes, error) {
apiURL := c.getURL(apiPathListWebhook)
natsPayload := model.CommunicationRequestHttp{
ResponseImmediately: true,
Payload: model.HttpRequest{
URL: apiURL,
Method: http.MethodGet,
Header: c.getRequestHeader(),
},
LogTarget: logTarget,
}
r, err := c.requestHttpViaNats(natsPayload)
if err != nil {
log.Printf("kiotviet.Client.ListWebhooks - requestHttpViaNats: %v, %s\n", err, apiURL)
return nil, err
}
res := r.Response
if res.StatusCode >= http.StatusBadRequest {
return nil, fmt.Errorf("kiotviet.Client.ListWebhooks - requestHttpViaNats bad request %s", res.Body)
}
var data ListWebhookRes
if err = r.ParseResponseData(&data); err != nil {
return nil, fmt.Errorf("kiotviet.Client.ListWebhooks - requestHttpViaNats parse response %v, %s", err, res.Body)
}
return &data, nil
}
func (c *Client) RegisterWebhook(req RegisterWebhookReq) (*RegisterWebhookRes, error) {
apiURL := c.getURL(apiPathRegisterWebhook)
natsPayload := model.CommunicationRequestHttp{

View File

@ -23,9 +23,6 @@ type ListBranchesReq struct {
IncludeRemoveIDs string `json:"includeRemoveIds,omitempty"` // true/ false
}
type ListWebhookReq struct {
}
type WebhookReq struct {
Type string `json:"Type"`
Url string `json:"Url"`

View File

@ -67,19 +67,3 @@ type RError struct {
ErrorCode string `json:"errorCode"`
Message string `json:"message"`
}
type Webhook struct {
Id int `json:"id"`
Type string `json:"type"`
Url string `json:"url"`
IsActive bool `json:"isActive"`
RetailerId int `json:"retailerId"`
ModifiedDate time.Time `json:"modifiedDate"`
}
type ListWebhookRes struct {
Total int `json:"total"`
PageSize int `json:"pageSize"`
Data []Webhook `json:"data"`
Timestamp time.Time `json:"timestamp"`
}