Merge pull request #20 from gwinn/master

Debug mode
This commit is contained in:
Alex Lushpai 2018-09-28 13:47:26 +03:00 committed by GitHub
commit 15efacb4f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 342 additions and 305 deletions

1
.gitignore vendored
View File

@ -25,5 +25,6 @@ _testmain.go
# IDE's files # IDE's files
.idea .idea
*.iml *.iml
.env
# Project ignores # Project ignores

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
@ -17,16 +18,16 @@ import (
// New initalize client // New initalize client
func New(url string, key string) *Client { func New(url string, key string) *Client {
return &Client{ return &Client{
url, URL: url,
key, Key: key,
&http.Client{Timeout: 20 * time.Second}, httpClient: &http.Client{Timeout: 20 * time.Second},
} }
} }
// GetRequest implements GET Request // GetRequest implements GET Request
func (c *Client) GetRequest(urlWithParameters string, versioned ...bool) ([]byte, int, errs.Failure) { func (c *Client) GetRequest(urlWithParameters string, versioned ...bool) ([]byte, int, errs.Failure) {
var res []byte var res []byte
var cerr errs.Failure var failure errs.Failure
var prefix = "/api/v5" var prefix = "/api/v5"
if len(versioned) > 0 { if len(versioned) > 0 {
@ -39,64 +40,80 @@ func (c *Client) GetRequest(urlWithParameters string, versioned ...bool) ([]byte
req, err := http.NewRequest("GET", fmt.Sprintf("%s%s%s", c.URL, prefix, urlWithParameters), nil) req, err := http.NewRequest("GET", fmt.Sprintf("%s%s%s", c.URL, prefix, urlWithParameters), nil)
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
return res, 0, cerr return res, 0, failure
} }
req.Header.Set("X-API-KEY", c.Key) req.Header.Set("X-API-KEY", c.Key)
if c.Debug {
log.Printf("API Request: %s %s", fmt.Sprintf("%s%s%s", c.URL, prefix, urlWithParameters), c.Key)
}
resp, err := c.httpClient.Do(req) resp, err := c.httpClient.Do(req)
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
return res, 0, cerr return res, 0, failure
} }
if resp.StatusCode >= http.StatusInternalServerError { if resp.StatusCode >= http.StatusInternalServerError {
cerr.ApiErr = fmt.Sprintf("HTTP request error. Status code: %d.\n", resp.StatusCode) failure.ApiErr = fmt.Sprintf("HTTP request error. Status code: %d.\n", resp.StatusCode)
return res, resp.StatusCode, cerr return res, resp.StatusCode, failure
} }
res, err = buildRawResponse(resp) res, err = buildRawResponse(resp)
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
} }
return res, resp.StatusCode, cerr if c.Debug {
log.Printf("API Response: %s", res)
}
return res, resp.StatusCode, failure
} }
// PostRequest implements POST Request // PostRequest implements POST Request
func (c *Client) PostRequest(url string, postParams url.Values) ([]byte, int, errs.Failure) { func (c *Client) PostRequest(url string, postParams url.Values) ([]byte, int, errs.Failure) {
var res []byte var res []byte
var cerr errs.Failure var failure errs.Failure
var prefix = "/api/v5" var prefix = "/api/v5"
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s%s", c.URL, prefix, url), strings.NewReader(postParams.Encode())) req, err := http.NewRequest("POST", fmt.Sprintf("%s%s%s", c.URL, prefix, url), strings.NewReader(postParams.Encode()))
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
return res, 0, cerr return res, 0, failure
} }
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("X-API-KEY", c.Key) req.Header.Set("X-API-KEY", c.Key)
if c.Debug {
log.Printf("API Request: %s %s %s", url, c.Key, postParams.Encode())
}
resp, err := c.httpClient.Do(req) resp, err := c.httpClient.Do(req)
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
return res, 0, cerr return res, 0, failure
} }
if resp.StatusCode >= http.StatusInternalServerError { if resp.StatusCode >= http.StatusInternalServerError {
cerr.ApiErr = fmt.Sprintf("HTTP request error. Status code: %d.\n", resp.StatusCode) failure.ApiErr = fmt.Sprintf("HTTP request error. Status code: %d.\n", resp.StatusCode)
return res, resp.StatusCode, cerr return res, resp.StatusCode, failure
} }
res, err = buildRawResponse(resp) res, err = buildRawResponse(resp)
if err != nil { if err != nil {
cerr.RuntimeErr = err failure.RuntimeErr = err
return res, 0, cerr return res, 0, failure
} }
return res, resp.StatusCode, cerr if c.Debug {
log.Printf("API Response: %s", res)
}
return res, resp.StatusCode, failure
} }
func buildRawResponse(resp *http.Response) ([]byte, error) { func buildRawResponse(resp *http.Response) ([]byte, error) {
@ -113,12 +130,12 @@ func buildRawResponse(resp *http.Response) ([]byte, error) {
func buildErr(data []byte) errs.Failure { func buildErr(data []byte) errs.Failure {
var err = errs.Failure{} var err = errs.Failure{}
eresp, errr := errs.ErrorResponse(data) resp, e := errs.ErrorResponse(data)
err.RuntimeErr = errr err.RuntimeErr = e
err.ApiErr = eresp.ErrorMsg err.ApiErr = resp.ErrorMsg
if eresp.Errors != nil { if resp.Errors != nil {
err.ApiErrs = eresp.Errors err.ApiErrs = resp.Errors
} }
return err return err
@ -222,7 +239,7 @@ func (c *Client) APICredentials() (CredentialResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the list of customers matched the specified filter // Customers returns list of customers matched the specified filter
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers
// //
@ -267,7 +284,7 @@ func (c *Client) Customers(parameters CustomersRequest) (CustomersResponse, int,
return resp, status, err return resp, status, err
} }
// Combining of customers // CustomersCombine combine given customers
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-combine // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-combine
// //
@ -309,7 +326,7 @@ func (c *Client) CustomersCombine(customers []Customer, resultCustomer Customer)
return resp, status, err return resp, status, err
} }
// Customer creation // CustomerCreate creates customer
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-create
// //
@ -365,7 +382,7 @@ func (c *Client) CustomerCreate(customer Customer, site ...string) (CustomerChan
return resp, status, err return resp, status, err
} }
// The mass recording of customers external ID // CustomersFixExternalIds customers external ID
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-fix-external-ids // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-fix-external-ids
// //
@ -408,7 +425,7 @@ func (c *Client) CustomersFixExternalIds(customers []IdentifiersPair) (Successfu
return resp, status, err return resp, status, err
} }
// Getting the customer change history // CustomersHistory returns customer's history
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-history // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-history
// //
@ -452,7 +469,7 @@ func (c *Client) CustomersHistory(parameters CustomersHistoryRequest) (Customers
return resp, status, err return resp, status, err
} }
// Getting the notes // CustomerNotes returns customer related notes
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-notes // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-notes
// //
@ -497,7 +514,7 @@ func (c *Client) CustomerNotes(parameters NotesRequest) (NotesResponse, int, err
return resp, status, err return resp, status, err
} }
// Note creation // CustomerNoteCreate note creation
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-notes-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-notes-create
// //
@ -549,7 +566,7 @@ func (c *Client) CustomerNoteCreate(note Note, site ...string) (CreateResponse,
return resp, status, err return resp, status, err
} }
// Note removing // CustomerNoteDelete remove customer related note
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-notes-id-delete // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-notes-id-delete
// //
@ -558,7 +575,6 @@ func (c *Client) CustomerNoteCreate(note Note, site ...string) (CreateResponse,
// var client = v5.New("https://demo.url", "09jIJ") // var client = v5.New("https://demo.url", "09jIJ")
// //
// data, status, err := client.CustomerNoteDelete(12) // data, status, err := client.CustomerNoteDelete(12)
// if err.RuntimeErr != nil { // if err.RuntimeErr != nil {
// fmt.Printf("%v", err.RuntimeErr) // fmt.Printf("%v", err.RuntimeErr)
// } // }
@ -587,7 +603,7 @@ func (c *Client) CustomerNoteDelete(id int) (SuccessfulResponse, int, errs.Failu
return resp, status, err return resp, status, err
} }
// Packet customers uploading // CustomersUpload customers batch upload
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-upload // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-upload
// //
@ -648,7 +664,7 @@ func (c *Client) CustomersUpload(customers []Customer, site ...string) (Customer
return resp, status, err return resp, status, err
} }
// Getting information on customer // Customer returns information about customer
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-externalId // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-customers-externalId
// //
@ -690,7 +706,7 @@ func (c *Client) Customer(id, by, site string) (CustomerResponse, int, errs.Fail
return resp, status, err return resp, status, err
} }
// Customer editing // CustomerEdit edit exact customer
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-externalId-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-customers-externalId-edit
// //
@ -752,7 +768,7 @@ func (c *Client) CustomerEdit(customer Customer, by string, site ...string) (Cus
return resp, status, err return resp, status, err
} }
// Updating of delivery statuses // DeliveryTracking updates tracking data
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-generic-subcode-tracking // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-generic-subcode-tracking
// //
@ -805,7 +821,7 @@ func (c *Client) DeliveryTracking(parameters DeliveryTrackingRequest, subcode st
return resp, status, err return resp, status, err
} }
// Getting the list of shipments to delivery services // DeliveryShipments returns list of shipments
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-delivery-shipments // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-delivery-shipments
// //
@ -850,7 +866,7 @@ func (c *Client) DeliveryShipments(parameters DeliveryShipmentsRequest) (Deliver
return resp, status, err return resp, status, err
} }
// Shipment creation // DeliveryShipmentCreate creates shipment
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-shipments-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-shipments-create
// //
@ -906,7 +922,7 @@ func (c *Client) DeliveryShipmentCreate(shipment DeliveryShipment, deliveryType
return resp, status, err return resp, status, err
} }
// Getting information on shipment // DeliveryShipment get information about shipment
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-delivery-shipments-id // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-delivery-shipments-id
// //
@ -944,7 +960,7 @@ func (c *Client) DeliveryShipment(id int) (DeliveryShipmentResponse, int, errs.F
return resp, status, err return resp, status, err
} }
// Shipment editing // DeliveryShipmentEdit shipment editing
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-shipments-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-delivery-shipments-id-edit
// //
@ -991,7 +1007,7 @@ func (c *Client) DeliveryShipmentEdit(shipment DeliveryShipment, site ...string)
return resp, status, err return resp, status, err
} }
// Getting the integration module // IntegrationModule returns integration module
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-integration-modules-code // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-integration-modules-code
// //
@ -1029,7 +1045,7 @@ func (c *Client) IntegrationModule(code string) (IntegrationModuleResponse, int,
return resp, status, err return resp, status, err
} }
// Integration module creation/editing // IntegrationModuleEdit integration module create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-integration-modules-code // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-integration-modules-code
// //
@ -1082,7 +1098,7 @@ func (c *Client) IntegrationModuleEdit(integrationModule IntegrationModule) (Int
return resp, status, err return resp, status, err
} }
// Getting the list of orders matched the specified filter // Orders returns list of orders matched the specified filters
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders
// //
@ -1122,7 +1138,7 @@ func (c *Client) Orders(parameters OrdersRequest) (OrdersResponse, int, errs.Fai
return resp, status, err return resp, status, err
} }
// Combining of orders // OrdersCombine combines given orders
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-combine // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-combine
// //
@ -1165,7 +1181,7 @@ func (c *Client) OrdersCombine(technique string, order, resultOrder Order) (Oper
return resp, status, err return resp, status, err
} }
// Order creation // OrderCreate creates an order
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-create
// //
@ -1216,7 +1232,7 @@ func (c *Client) OrderCreate(order Order, site ...string) (CreateResponse, int,
return resp, status, err return resp, status, err
} }
// The mass recording of orders external ID // OrdersFixExternalIds set order external ID
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-fix-external-ids // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-fix-external-ids
// //
@ -1263,7 +1279,7 @@ func (c *Client) OrdersFixExternalIds(orders []IdentifiersPair) (SuccessfulRespo
return resp, status, err return resp, status, err
} }
// Getting the order change history // OrdersHistory returns orders history
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-history // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-history
// //
@ -1303,7 +1319,7 @@ func (c *Client) OrdersHistory(parameters OrdersHistoryRequest) (CustomersHistor
return resp, status, err return resp, status, err
} }
// Payment creation // OrderPaymentCreate creates payment
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-create
// //
@ -1355,7 +1371,7 @@ func (c *Client) OrderPaymentCreate(payment Payment, site ...string) (CreateResp
return resp, status, err return resp, status, err
} }
// Payment removing // OrderPaymentDelete payment removing
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-id-delete // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-id-delete
// //
@ -1393,7 +1409,7 @@ func (c *Client) OrderPaymentDelete(id int) (SuccessfulResponse, int, errs.Failu
return resp, status, err return resp, status, err
} }
// Payment editing // OrderPaymentEdit edit payment
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-payments-id-edit
// //
@ -1447,7 +1463,7 @@ func (c *Client) OrderPaymentEdit(payment Payment, by string, site ...string) (S
return resp, status, err return resp, status, err
} }
// Packet orders uploading // OrdersUpload batch orders uploading
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-upload // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-upload
// //
@ -1508,7 +1524,7 @@ func (c *Client) OrdersUpload(orders []Order, site ...string) (OrdersUploadRespo
return resp, status, err return resp, status, err
} }
// Getting information on order // Order returns information about order
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-externalId // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-externalId
// //
@ -1550,7 +1566,7 @@ func (c *Client) Order(id, by, site string) (OrderResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Order editing // OrderEdit edit an order
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-externalId-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-externalId-edit
// //
@ -1605,7 +1621,7 @@ func (c *Client) OrderEdit(order Order, by string, site ...string) (CreateRespon
return resp, status, err return resp, status, err
} }
// Getting the list of packs matched the specified filter // Packs returns list of packs matched the specified filters
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs
// //
@ -1645,7 +1661,7 @@ func (c *Client) Packs(parameters PacksRequest) (PacksResponse, int, errs.Failur
return resp, status, err return resp, status, err
} }
// Pack creation // PackCreate creates a pack
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-create
// //
@ -1692,7 +1708,7 @@ func (c *Client) PackCreate(pack Pack) (CreateResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the history of order packing // PacksHistory returns a history of order packing
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs-history // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs-history
// //
@ -1732,6 +1748,7 @@ func (c *Client) PacksHistory(parameters PacksHistoryRequest) (PacksHistoryRespo
return resp, status, err return resp, status, err
} }
// Pack returns a pack info
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs-id // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-orders-packs-id
// //
@ -1769,7 +1786,7 @@ func (c *Client) Pack(id int) (PackResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Pack removing // PackDelete removes a pack
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-id-delete // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-id-delete
// //
@ -1803,7 +1820,7 @@ func (c *Client) PackDelete(id int) (SuccessfulResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Pack editing // PackEdit edit a pack
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-orders-packs-id-edit
// //
@ -1843,7 +1860,7 @@ func (c *Client) PackEdit(pack Pack) (CreateResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the list of available country codes // Countries returns list of available country codes
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-countries // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-countries
func (c *Client) Countries() (CountriesResponse, int, errs.Failure) { func (c *Client) Countries() (CountriesResponse, int, errs.Failure) {
@ -1863,7 +1880,7 @@ func (c *Client) Countries() (CountriesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting of the costs groups list // CostGroups returns costs groups list
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-cost-groups // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-cost-groups
func (c *Client) CostGroups() (CostGroupsResponse, int, errs.Failure) { func (c *Client) CostGroups() (CostGroupsResponse, int, errs.Failure) {
@ -1883,7 +1900,7 @@ func (c *Client) CostGroups() (CostGroupsResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Editing costs groups // CostGroupEdit edit costs groups
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-cost-groups-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-cost-groups-code-edit
// //
@ -1926,7 +1943,7 @@ func (c *Client) CostGroupEdit(costGroup CostGroup) (SuccessfulResponse, int, er
return resp, status, err return resp, status, err
} }
// Getting of the costs items list // CostItems returns costs items list
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-cost-items // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-cost-items
func (c *Client) CostItems() (CostItemsResponse, int, errs.Failure) { func (c *Client) CostItems() (CostItemsResponse, int, errs.Failure) {
@ -1946,7 +1963,7 @@ func (c *Client) CostItems() (CostItemsResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Editing costs items // CostItemEdit edit costs items
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-cost-items-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-cost-items-code-edit
// //
@ -1989,7 +2006,7 @@ func (c *Client) CostItemEdit(costItem CostItem) (SuccessfulResponse, int, errs.
return resp, status, err return resp, status, err
} }
// Getting the list of couriers // Couriers returns list of couriers
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-couriers // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-couriers
func (c *Client) Couriers() (CouriersResponse, int, errs.Failure) { func (c *Client) Couriers() (CouriersResponse, int, errs.Failure) {
@ -2009,7 +2026,7 @@ func (c *Client) Couriers() (CouriersResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Courier creation // CourierCreate creates a courier
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-couriers // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-couriers
// //
@ -2058,7 +2075,7 @@ func (c *Client) CourierCreate(courier Courier) (CreateResponse, int, errs.Failu
return resp, status, err return resp, status, err
} }
// Courier editing // CourierEdit edit a courier
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-couriers-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-couriers-id-edit
// //
@ -2101,7 +2118,7 @@ func (c *Client) CourierEdit(courier Courier) (SuccessfulResponse, int, errs.Fai
return resp, status, err return resp, status, err
} }
// Getting the list of delivery services // DeliveryServices returns list of delivery services
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-delivery-services // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-delivery-services
func (c *Client) DeliveryServices() (DeliveryServiceResponse, int, errs.Failure) { func (c *Client) DeliveryServices() (DeliveryServiceResponse, int, errs.Failure) {
@ -2121,7 +2138,7 @@ func (c *Client) DeliveryServices() (DeliveryServiceResponse, int, errs.Failure)
return resp, status, err return resp, status, err
} }
// Delivery service creation/editing // DeliveryServiceEdit delivery service create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-delivery-services-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-delivery-services-code-edit
// //
@ -2164,7 +2181,7 @@ func (c *Client) DeliveryServiceEdit(deliveryService DeliveryService) (Successfu
return resp, status, err return resp, status, err
} }
// Getting the list of delivery types // DeliveryTypes returns list of delivery types
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-delivery-types // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-delivery-types
func (c *Client) DeliveryTypes() (DeliveryTypesResponse, int, errs.Failure) { func (c *Client) DeliveryTypes() (DeliveryTypesResponse, int, errs.Failure) {
@ -2184,7 +2201,7 @@ func (c *Client) DeliveryTypes() (DeliveryTypesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Delivery type creation/editing // DeliveryTypeEdit delivery type create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-delivery-types-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-delivery-types-code-edit
// //
@ -2229,7 +2246,7 @@ func (c *Client) DeliveryTypeEdit(deliveryType DeliveryType) (SuccessfulResponse
return resp, status, err return resp, status, err
} }
// Getting the list of legal entities // LegalEntities returns list of legal entities
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-legal-entities // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-legal-entities
func (c *Client) LegalEntities() (LegalEntitiesResponse, int, errs.Failure) { func (c *Client) LegalEntities() (LegalEntitiesResponse, int, errs.Failure) {
@ -2249,7 +2266,7 @@ func (c *Client) LegalEntities() (LegalEntitiesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Editing of information on legal entity // LegalEntityEdit change information about legal entity
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-legal-entities-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-legal-entities-code-edit
// //
@ -2292,7 +2309,7 @@ func (c *Client) LegalEntityEdit(legalEntity LegalEntity) (SuccessfulResponse, i
return resp, status, err return resp, status, err
} }
// Getting the list of order methods // OrderMethods returns list of order methods
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-order-methods // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-order-methods
func (c *Client) OrderMethods() (OrderMethodsResponse, int, errs.Failure) { func (c *Client) OrderMethods() (OrderMethodsResponse, int, errs.Failure) {
@ -2312,7 +2329,7 @@ func (c *Client) OrderMethods() (OrderMethodsResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Order method creation/editing // OrderMethodEdit order method create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-order-methods-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-order-methods-code-edit
// //
@ -2356,7 +2373,7 @@ func (c *Client) OrderMethodEdit(orderMethod OrderMethod) (SuccessfulResponse, i
return resp, status, err return resp, status, err
} }
// Getting the list of order types // OrderTypes return list of order types
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-order-types // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-order-types
func (c *Client) OrderTypes() (OrderTypesResponse, int, errs.Failure) { func (c *Client) OrderTypes() (OrderTypesResponse, int, errs.Failure) {
@ -2376,6 +2393,7 @@ func (c *Client) OrderTypes() (OrderTypesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// OrderTypeEdit create/edit order type
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-order-methods-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-order-methods-code-edit
// //
@ -2419,7 +2437,7 @@ func (c *Client) OrderTypeEdit(orderType OrderType) (SuccessfulResponse, int, er
return resp, status, err return resp, status, err
} }
// Getting the list of payment statuses // PaymentStatuses returns list of payment statuses
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-payment-statuses // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-payment-statuses
func (c *Client) PaymentStatuses() (PaymentStatusesResponse, int, errs.Failure) { func (c *Client) PaymentStatuses() (PaymentStatusesResponse, int, errs.Failure) {
@ -2439,7 +2457,7 @@ func (c *Client) PaymentStatuses() (PaymentStatusesResponse, int, errs.Failure)
return resp, status, err return resp, status, err
} }
// Payment status creation/editing // PaymentStatusEdit payment status creation/editing
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-payment-statuses-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-payment-statuses-code-edit
func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (SuccessfulResponse, int, errs.Failure) { func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (SuccessfulResponse, int, errs.Failure) {
@ -2465,7 +2483,7 @@ func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (SuccessfulRespo
return resp, status, err return resp, status, err
} }
// Getting the list of payment types // PaymentTypes returns list of payment types
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-payment-types // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-payment-types
func (c *Client) PaymentTypes() (PaymentTypesResponse, int, errs.Failure) { func (c *Client) PaymentTypes() (PaymentTypesResponse, int, errs.Failure) {
@ -2485,7 +2503,7 @@ func (c *Client) PaymentTypes() (PaymentTypesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Payment type creation/editing // PaymentTypeEdit payment type create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-payment-types-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-payment-types-code-edit
func (c *Client) PaymentTypeEdit(paymentType PaymentType) (SuccessfulResponse, int, errs.Failure) { func (c *Client) PaymentTypeEdit(paymentType PaymentType) (SuccessfulResponse, int, errs.Failure) {
@ -2511,7 +2529,7 @@ func (c *Client) PaymentTypeEdit(paymentType PaymentType) (SuccessfulResponse, i
return resp, status, err return resp, status, err
} }
// Getting the list of price types // PriceTypes returns list of price types
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-price-types // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-price-types
func (c *Client) PriceTypes() (PriceTypesResponse, int, errs.Failure) { func (c *Client) PriceTypes() (PriceTypesResponse, int, errs.Failure) {
@ -2531,7 +2549,7 @@ func (c *Client) PriceTypes() (PriceTypesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Price type creation/editing // PriceTypeEdit price type create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-price-types-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-price-types-code-edit
func (c *Client) PriceTypeEdit(priceType PriceType) (SuccessfulResponse, int, errs.Failure) { func (c *Client) PriceTypeEdit(priceType PriceType) (SuccessfulResponse, int, errs.Failure) {
@ -2557,7 +2575,7 @@ func (c *Client) PriceTypeEdit(priceType PriceType) (SuccessfulResponse, int, er
return resp, status, err return resp, status, err
} }
// Getting the list of item statuses in order // ProductStatuses returns list of item statuses in order
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-product-statuses // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-product-statuses
func (c *Client) ProductStatuses() (ProductStatusesResponse, int, errs.Failure) { func (c *Client) ProductStatuses() (ProductStatusesResponse, int, errs.Failure) {
@ -2577,7 +2595,7 @@ func (c *Client) ProductStatuses() (ProductStatusesResponse, int, errs.Failure)
return resp, status, err return resp, status, err
} }
// Item status creation/editing // ProductStatusEdit order item status create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-product-statuses-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-product-statuses-code-edit
func (c *Client) ProductStatusEdit(productStatus ProductStatus) (SuccessfulResponse, int, errs.Failure) { func (c *Client) ProductStatusEdit(productStatus ProductStatus) (SuccessfulResponse, int, errs.Failure) {
@ -2603,7 +2621,7 @@ func (c *Client) ProductStatusEdit(productStatus ProductStatus) (SuccessfulRespo
return resp, status, err return resp, status, err
} }
// Getting the stores list // Sites returns the sites list
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-sites // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-sites
func (c *Client) Sites() (SitesResponse, int, errs.Failure) { func (c *Client) Sites() (SitesResponse, int, errs.Failure) {
@ -2623,7 +2641,7 @@ func (c *Client) Sites() (SitesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Store creation/editing // SiteEdit site create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-sites-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-sites-code-edit
func (c *Client) SiteEdit(site Site) (SuccessfulResponse, int, errs.Failure) { func (c *Client) SiteEdit(site Site) (SuccessfulResponse, int, errs.Failure) {
@ -2649,7 +2667,7 @@ func (c *Client) SiteEdit(site Site) (SuccessfulResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the list of order status groups // StatusGroups returns list of order status groups
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-status-groups // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-status-groups
func (c *Client) StatusGroups() (StatusGroupsResponse, int, errs.Failure) { func (c *Client) StatusGroups() (StatusGroupsResponse, int, errs.Failure) {
@ -2669,7 +2687,7 @@ func (c *Client) StatusGroups() (StatusGroupsResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the list of order statuses // Statuses returns list of order statuses
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-statuses // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-statuses
func (c *Client) Statuses() (StatusesResponse, int, errs.Failure) { func (c *Client) Statuses() (StatusesResponse, int, errs.Failure) {
@ -2689,7 +2707,7 @@ func (c *Client) Statuses() (StatusesResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Order status creation/editing // StatusEdit order status create/edit
// //
// For more information see www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-sites-code-edit // For more information see www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-sites-code-edit
func (c *Client) StatusEdit(st Status) (SuccessfulResponse, int, errs.Failure) { func (c *Client) StatusEdit(st Status) (SuccessfulResponse, int, errs.Failure) {
@ -2715,7 +2733,7 @@ func (c *Client) StatusEdit(st Status) (SuccessfulResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting the list of warehouses // Stores returns list of warehouses
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-stores // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-reference-stores
func (c *Client) Stores() (StoresResponse, int, errs.Failure) { func (c *Client) Stores() (StoresResponse, int, errs.Failure) {
@ -2735,7 +2753,7 @@ func (c *Client) Stores() (StoresResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Editing of information on warehouse // StoreEdit warehouse create/edit
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-stores-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-stores-code-edit
func (c *Client) StoreEdit(store Store) (SuccessfulResponse, int, errs.Failure) { func (c *Client) StoreEdit(store Store) (SuccessfulResponse, int, errs.Failure) {
@ -2761,7 +2779,7 @@ func (c *Client) StoreEdit(store Store) (SuccessfulResponse, int, errs.Failure)
return resp, status, err return resp, status, err
} }
// Get segments // Segments returns segments
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-segments // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-segments
// //
@ -2805,7 +2823,7 @@ func (c *Client) Segments(parameters SegmentsRequest) (SegmentsResponse, int, er
return resp, status, err return resp, status, err
} }
// Getting the leftover stocks and purchasing prices // Inventories returns leftover stocks and purchasing prices
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-inventories // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-inventories
// //
@ -2845,7 +2863,7 @@ func (c *Client) Inventories(parameters InventoriesRequest) (InventoriesResponse
return resp, status, err return resp, status, err
} }
// Updating the leftover stocks and purchasing prices // InventoriesUpload updates the leftover stocks and purchasing prices
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-store-inventories-upload // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-store-inventories-upload
// //
@ -2853,10 +2871,10 @@ func (c *Client) Inventories(parameters InventoriesRequest) (InventoriesResponse
// //
// var client = v5.New("https://demo.url", "09jIJ") // var client = v5.New("https://demo.url", "09jIJ")
// //
// data, status, err := clientc.InventoriesUpload( // data, status, err := client.InventoriesUpload(
// []v5.InventoryUpload{ // []v5.InventoryUpload{
// { // {
// XMLID: "pTKIKAeghYzX21HTdzFCe1", // XMLID: "pT22K9YzX21HTdzFCe1",
// Stores: []InventoryUploadStore{ // Stores: []InventoryUploadStore{
// {Code: "test-store-v5", Available: 10, PurchasePrice: 1500}, // {Code: "test-store-v5", Available: 10, PurchasePrice: 1500},
// {Code: "test-store-v4", Available: 20, PurchasePrice: 1530}, // {Code: "test-store-v4", Available: 20, PurchasePrice: 1530},
@ -2864,7 +2882,7 @@ func (c *Client) Inventories(parameters InventoriesRequest) (InventoriesResponse
// }, // },
// }, // },
// { // {
// XMLID: "JQIvcrCtiSpOV3AAfMiQB3", // XMLID: "JQICtiSpOV3AAfMiQB3",
// Stores: []InventoryUploadStore{ // Stores: []InventoryUploadStore{
// {Code: "test-store-v5", Available: 45, PurchasePrice: 1500}, // {Code: "test-store-v5", Available: 45, PurchasePrice: 1500},
// {Code: "test-store-v4", Available: 32, PurchasePrice: 1530}, // {Code: "test-store-v4", Available: 32, PurchasePrice: 1530},
@ -2908,7 +2926,7 @@ func (c *Client) InventoriesUpload(inventories []InventoryUpload, site ...string
return resp, status, err return resp, status, err
} }
// Offers prices updating // PricesUpload updates prices
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-store-prices-upload // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-store-prices-upload
// //
@ -2961,7 +2979,7 @@ func (c *Client) PricesUpload(prices []OfferPriceUpload) (StoreUploadResponse, i
return resp, status, err return resp, status, err
} }
// Getting the list of product groups // ProductsGroup returns list of product groups
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-product-groups // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-product-groups
// //
@ -3005,7 +3023,7 @@ func (c *Client) ProductsGroup(parameters ProductsGroupsRequest) (ProductsGroups
return resp, status, err return resp, status, err
} }
// Getting the list of products and SKU // Products returns list of products and SKU
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-products // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-products
// //
@ -3050,7 +3068,7 @@ func (c *Client) Products(parameters ProductsRequest) (ProductsResponse, int, er
return resp, status, err return resp, status, err
} }
// Getting the list of item properties, matching the specified filter // ProductsProperties returns list of item properties, matching the specified filters
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-products-properties // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-store-products-properties
// //
@ -3094,7 +3112,7 @@ func (c *Client) ProductsProperties(parameters ProductsPropertiesRequest) (Produ
return resp, status, err return resp, status, err
} }
// Getting the task list // Tasks returns task list
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-tasks // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-tasks
// //
@ -3138,7 +3156,7 @@ func (c *Client) Tasks(parameters TasksRequest) (TasksResponse, int, errs.Failur
return resp, status, err return resp, status, err
} }
// Task creation // TaskCreate create a task
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-tasks-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-tasks-create
// //
@ -3186,7 +3204,7 @@ func (c *Client) TaskCreate(task Task, site ...string) (CreateResponse, int, err
return resp, status, err return resp, status, err
} }
// Getting information on task // Task returns task
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-tasks-id // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-tasks-id
// //
@ -3224,7 +3242,7 @@ func (c *Client) Task(id int) (TaskResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Task editing // TaskEdit edit a task
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-tasks-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-tasks-id-edit
// //
@ -3270,7 +3288,7 @@ func (c *Client) TaskEdit(task Task, site ...string) (SuccessfulResponse, int, e
return resp, status, err return resp, status, err
} }
// Getting the list of user groups // UserGroups returns list of user groups
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-user-groups // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-user-groups
// //
@ -3310,7 +3328,7 @@ func (c *Client) UserGroups(parameters UserGroupsRequest) (UserGroupsResponse, i
return resp, status, err return resp, status, err
} }
// Getting the list of users matched the specified filter // Users returns list of users matched the specified filters
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users
// //
@ -3350,7 +3368,7 @@ func (c *Client) Users(parameters UsersRequest) (UsersResponse, int, errs.Failur
return resp, status, err return resp, status, err
} }
// Getting information on user // User returns information about user
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users-id // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users-id
// //
@ -3388,7 +3406,7 @@ func (c *Client) User(id int) (UserResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Change user status // UserStatus change user status
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-users
// //
@ -3426,7 +3444,7 @@ func (c *Client) UserStatus(id int, status string) (SuccessfulResponse, int, err
return resp, st, err return resp, st, err
} }
// Statistics updating // StaticticsUpdate updates statistics
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-statistic-update // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-statistic-update
func (c *Client) StaticticsUpdate() (SuccessfulResponse, int, errs.Failure) { func (c *Client) StaticticsUpdate() (SuccessfulResponse, int, errs.Failure) {
@ -3446,7 +3464,7 @@ func (c *Client) StaticticsUpdate() (SuccessfulResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Getting of the cost list, adequate for the given filter // Costs returns costs list
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-costs // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-costs
// //
@ -3488,7 +3506,7 @@ func (c *Client) Costs(costs CostsRequest) (CostsResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Creation of the cost // CostCreate create an cost
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-create
// //
@ -3542,7 +3560,7 @@ func (c *Client) CostCreate(cost CostRecord, site ...string) (CreateResponse, in
return resp, status, err return resp, status, err
} }
// Cost removing // CostsDelete removes a cost
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-delete // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-delete
// //
@ -3582,7 +3600,7 @@ func (c *Client) CostsDelete(ids []int) (CostsDeleteResponse, int, errs.Failure)
return resp, status, err return resp, status, err
} }
// Batch loading of costs // CostsUpload batch costs upload
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-upload // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-upload
// //
@ -3639,7 +3657,7 @@ func (c *Client) CostsUpload(cost []CostRecord) (CostsUploadResponse, int, errs.
return resp, status, err return resp, status, err
} }
// Getting of cost information // Cost returns information about specified cost
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-costs-id // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-costs-id
// //
@ -3674,7 +3692,7 @@ func (c *Client) Cost(id int) (CostResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Cost removing // CostDelete removes cost
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-id-delete // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-id-delete
// //
@ -3711,7 +3729,7 @@ func (c *Client) CostDelete(id int) (SuccessfulResponse, int, errs.Failure) {
return resp, status, err return resp, status, err
} }
// Cost editing // CostEdit edit a cost
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-id-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-costs-id-edit
// //
@ -3758,7 +3776,7 @@ func (c *Client) CostEdit(id int, cost CostRecord, site ...string) (CreateRespon
return resp, status, err return resp, status, err
} }
// Getting the list of custom fields // CustomFields returns list of custom fields
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields
// //
@ -3798,7 +3816,7 @@ func (c *Client) CustomFields(customFields CustomFieldsRequest) (CustomFieldsRes
return resp, status, err return resp, status, err
} }
// Getting the list of custom directory // CustomDictionaries returns list of custom directory
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-dictionaries // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-dictionaries
// //
@ -3839,7 +3857,7 @@ func (c *Client) CustomDictionaries(customDictionaries CustomDictionariesRequest
return resp, status, err return resp, status, err
} }
// Directory fields creation // CustomDictionariesCreate creates a custom dictionary
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-dictionaries-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-dictionaries-create
// //
@ -3893,7 +3911,7 @@ func (c *Client) CustomDictionariesCreate(customDictionary CustomDictionary) (Cu
return resp, status, err return resp, status, err
} }
// Getting information on directory // CustomDictionary returns information about dictionary
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-entity-code // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-entity-code
// //
@ -3928,7 +3946,7 @@ func (c *Client) CustomDictionary(code string) (CustomDictionaryResponse, int, e
return resp, status, err return resp, status, err
} }
// Directory fields editing // CustomDictionaryEdit edit custom dictionary
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-dictionaries-code-edit // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-dictionaries-code-edit
// //
@ -3981,7 +3999,7 @@ func (c *Client) CustomDictionaryEdit(customDictionary CustomDictionary) (Custom
return resp, status, err return resp, status, err
} }
// Custom fields creation // CustomFieldsCreate creates custom field
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-entity-create // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-custom-fields-entity-create
// //
@ -4028,7 +4046,7 @@ func (c *Client) CustomFieldsCreate(customFields CustomFields) (CustomResponse,
return resp, status, err return resp, status, err
} }
// Getting information on custom fields // CustomField returns information about custom fields
// //
// For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-entity-code // For more information see http://www.retailcrm.pro/docs/Developers/ApiVersion5#get--api-v5-custom-fields-entity-code
// //

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ type CustomFieldsRequest struct {
Page int `url:"page,omitempty"` Page int `url:"page,omitempty"`
} }
// CustomeDictionariesRequest type // CustomDictionariesRequest type
type CustomDictionariesRequest struct { type CustomDictionariesRequest struct {
Filter CustomDictionariesFilter `url:"filter,omitempty"` Filter CustomDictionariesFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"` Limit int `url:"limit,omitempty"`

View File

@ -329,11 +329,13 @@ type IntegrationModuleEditResponse struct {
Info ResponseInfo `json:"info,omitempty,brackets"` Info ResponseInfo `json:"info,omitempty,brackets"`
} }
// ResponseInfo type
type ResponseInfo struct { type ResponseInfo struct {
MgTransportInfo MgInfo `json:"mgTransport,omitempty,brackets"` MgTransportInfo MgInfo `json:"mgTransport,omitempty,brackets"`
MgBotInfo MgInfo `json:"mgBot,omitempty,brackets"` MgBotInfo MgInfo `json:"mgBot,omitempty,brackets"`
} }
// MgInfo type
type MgInfo struct { type MgInfo struct {
EndpointUrl string `json:"endpointUrl"` EndpointUrl string `json:"endpointUrl"`
Token string `json:"token"` Token string `json:"token"`
@ -379,7 +381,7 @@ type CustomDictionariesResponse struct {
CustomDictionaries *[]CustomDictionary `json:"customDictionaries,omitempty,brackets"` CustomDictionaries *[]CustomDictionary `json:"customDictionaries,omitempty,brackets"`
} }
// CustomDictionariesResponse type // CustomResponse type
type CustomResponse struct { type CustomResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`

View File

@ -6,6 +6,7 @@ import "net/http"
type Client struct { type Client struct {
URL string URL string
Key string Key string
Debug bool
httpClient *http.Client httpClient *http.Client
} }
@ -874,6 +875,7 @@ type MgTransport struct {
WebhookUrl string `json:"webhookUrl,omitempty"` WebhookUrl string `json:"webhookUrl,omitempty"`
} }
// MgBot type
type MgBot struct{} type MgBot struct{}
/** /**
@ -927,17 +929,17 @@ type CustomFields struct {
} }
/** /**
CustomeDictionaries related types CustomDictionaries related types
*/ */
// customDictionary type // CustomDictionary type
type CustomDictionary struct { type CustomDictionary struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`
Elements []Element `json:"elements,omitempty,brackets"` Elements []Element `json:"elements,omitempty,brackets"`
} }
// Dictionary Element type // Element type
type Element struct { type Element struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`