Initial set of methods & tests (#1)

This commit is contained in:
Alex Lushpai 2018-02-27 11:37:15 +03:00 committed by GitHub
parent 650f309709
commit 8fcde8980b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 5532 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# IDE's files
.idea
# Project ignores

View File

@ -1,3 +1,88 @@
# retailCRM API Go client
Go client for [retailCRM API](http://www.retailcrm.pro/docs/Developers/ApiVersion5).
## Installation
```bash
go get -x github.com/retailcrm/api-client-go
```
## Usage
```golang
package main
import (
"fmt"
"net/http"
"github.com/retailcrm/api-client-go/v5"
)
func main() {
var client = v5.New("https://demo.retailcrm.pro", "09jIJ09j0JKhgyfvyuUIKhiugF")
data, status, err := client.Orders(v5.OrdersRequest{
Filter: v5.OrdersFilter{},
Limit: 20,
Page: 1,
})
if err.ErrorMsg != "" {
fmt.Printf("%v", err.ErrorMsg)
}
if status >= http.StatusBadRequest {
fmt.Printf("%v", err.ErrorMsg)
}
for _, value := range data.Orders {
fmt.Printf("%v\n", value.Email)
}
fmt.Println(data.Orders[1].FirstName)
idata, status, err := c.InventoriesUpload(
[]InventoryUpload{
{
XmlId: "pTKIKAeghYzX21HTdzFCe1",
Stores: []InventoryUploadStore{
{Code: "test-store-v5", Available: 10, PurchasePrice: 1500},
{Code: "test-store-v4", Available: 20, PurchasePrice: 1530},
{Code: "test-store", Available: 30, PurchasePrice: 1510},
},
},
{
XmlId: "JQIvcrCtiSpOV3AAfMiQB3",
Stores: []InventoryUploadStore{
{Code: "test-store-v5", Available: 45, PurchasePrice: 1500},
{Code: "test-store-v4", Available: 32, PurchasePrice: 1530},
{Code: "test-store", Available: 46, PurchasePrice: 1510},
},
},
},
)
if err.ErrorMsg != "" {
fmt.Printf("%v", err.ErrorMsg)
}
if status >= http.StatusBadRequest {
fmt.Printf("%v", err.ErrorMsg)
}
fmt.Println(idata.processedOffersCount)
}
```
## Testing
```bash
export RETAILCRM_URL="https://demo.retailcrm.pro"
export RETAILCRM_KEY="09jIJ09j0JKhgyfvyuUIKhiugF"
export RETAILCRM_USER="1"
cd $GOPATH/src/github.com/retailcrm/api-client-go
go test -v ./...
```

12
retailcrm.go Normal file
View File

@ -0,0 +1,12 @@
package retailcrm
import (
"github.com/retailcrm/api-client-go/v5"
)
// Version5 API client for v5
func Version5(url string, key string) *v5.Client {
var client = v5.New(url, key)
return client
}

1694
v5/client.go Normal file

File diff suppressed because it is too large Load Diff

2078
v5/client_test.go Normal file

File diff suppressed because it is too large Load Diff

298
v5/filters.go Normal file
View File

@ -0,0 +1,298 @@
package v5
// CustomersFilter type
type CustomersFilter struct {
Ids []string `url:"ids,omitempty,brackets"`
ExternalIds []string `url:"externalIds,omitempty,brackets"`
City string `url:"city,omitempty"`
Region string `url:"region,omitempty"`
Name string `url:"name,omitempty"`
Email string `url:"email,omitempty"`
Notes string `url:"notes,omitempty"`
MinOrdersCount int `url:"minOrdersCount,omitempty"`
MaxOrdersCount int `url:"maxOrdersCount,omitempty"`
MinAverageSumm float32 `url:"minAverageSumm,omitempty"`
MaxAverageSumm float32 `url:"maxAverageSumm,omitempty"`
MinTotalSumm float32 `url:"minTotalSumm,omitempty"`
MaxTotalSumm float32 `url:"maxTotalSumm,omitempty"`
MinCostSumm float32 `url:"minCostSumm,omitempty"`
MaxCostSumm float32 `url:"maxCostSumm,omitempty"`
ClassSegment string `url:"classSegment,omitempty"`
Vip int `url:"vip,omitempty"`
Bad int `url:"bad,omitempty"`
Attachments int `url:"attachments,omitempty"`
Online int `url:"online,omitempty"`
EmailMarketingUnsubscribed int `url:"emailMarketingUnsubscribed,omitempty"`
Sex string `url:"sex,omitempty"`
Segment string `url:"segment,omitempty"`
DiscountCardNumber string `url:"discountCardNumber,omitempty"`
ContragentName string `url:"contragentName,omitempty"`
ContragentInn string `url:"contragentInn,omitempty"`
ContragentKpp string `url:"contragentKpp,omitempty"`
ContragentBik string `url:"contragentBik,omitempty"`
ContragentCorrAccount string `url:"contragentCorrAccount,omitempty"`
ContragentBankAccount string `url:"contragentBankAccount,omitempty"`
ContragentTypes []string `url:"contragentTypes,omitempty,brackets"`
Sites []string `url:"sites,omitempty,brackets"`
Managers []string `url:"managers,omitempty,brackets"`
ManagerGroups []string `url:"managerGroups,omitempty,brackets"`
DateFrom string `url:"dateFrom,omitempty"`
DateTo string `url:"dateTo,omitempty"`
FirstWebVisitFrom string `url:"firstWebVisitFrom,omitempty"`
FirstWebVisitTo string `url:"firstWebVisitTo,omitempty"`
LastWebVisitFrom string `url:"lastWebVisitFrom,omitempty"`
LastWebVisitTo string `url:"lastWebVisitTo,omitempty"`
FirstOrderFrom string `url:"firstOrderFrom,omitempty"`
FirstOrderTo string `url:"firstOrderTo,omitempty"`
LastOrderFrom string `url:"lastOrderFrom,omitempty"`
LastOrderTo string `url:"lastOrderTo,omitempty"`
BrowserId string `url:"browserId,omitempty"`
Commentary string `url:"commentary,omitempty"`
SourceName string `url:"sourceName,omitempty"`
MediumName string `url:"mediumName,omitempty"`
CampaignName string `url:"campaignName,omitempty"`
KeywordName string `url:"keywordName,omitempty"`
AdContentName string `url:"adContentName,omitempty"`
CustomFields map[string]string `url:"customFields,omitempty,brackets"`
}
// CustomersHistoryFilter type
type CustomersHistoryFilter struct {
CustomerId int `url:"customerId,omitempty"`
SinceId int `url:"sinceId,omitempty"`
CustomerExternalId string `url:"customerExternalId,omitempty"`
StartDate string `url:"startDate,omitempty"`
EndDate string `url:"endDate,omitempty"`
}
// OrdersFilter type
type OrdersFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
ExternalIds []string `url:"externalIds,omitempty,brackets"`
Numbers []string `url:"numbers,omitempty,brackets"`
Customer string `url:"customer,omitempty"`
CustomerId string `url:"customerId,omitempty"`
CustomerExternalId string `url:"customerExternalId,omitempty"`
Countries []string `url:"countries,omitempty,brackets"`
City string `url:"city,omitempty"`
Region string `url:"region,omitempty"`
Index string `url:"index,omitempty"`
Metro string `url:"metro,omitempty"`
Email string `url:"email,omitempty"`
DeliveryTimeFrom string `url:"deliveryTimeFrom,omitempty"`
DeliveryTimeTo string `url:"deliveryTimeTo,omitempty"`
MinPrepaySumm string `url:"minPrepaySumm,omitempty"`
MaxPrepaySumm string `url:"maxPrepaySumm,omitempty"`
MinPrice string `url:"minPrice,omitempty"`
MaxPrice string `url:"maxPrice,omitempty"`
Product string `url:"product,omitempty"`
Vip int `url:"vip,omitempty"`
Bad int `url:"bad,omitempty"`
Attachments int `url:"attachments,omitempty"`
Expired int `url:"expired,omitempty"`
Call int `url:"call,omitempty"`
Online int `url:"online,omitempty"`
Shipped int `url:"shipped,omitempty"`
UploadedToExtStoreSys int `url:"uploadedToExtStoreSys,omitempty"`
ReceiptFiscalDocumentAttribute int `url:"receiptFiscalDocumentAttribute,omitempty"`
ReceiptStatus int `url:"receiptStatus,omitempty"`
ReceiptOperation int `url:"receiptOperation,omitempty"`
MinDeliveryCost string `url:"minDeliveryCost,omitempty"`
MaxDeliveryCost string `url:"maxDeliveryCost,omitempty"`
MinDeliveryNetCost string `url:"minDeliveryNetCost,omitempty"`
MaxDeliveryNetCost string `url:"maxDeliveryNetCost,omitempty"`
ManagerComment string `url:"managerComment,omitempty"`
CustomerComment string `url:"customerComment,omitempty"`
MinMarginSumm string `url:"minMarginSumm,omitempty"`
MaxMarginSumm string `url:"maxMarginSumm,omitempty"`
MinPurchaseSumm string `url:"minPurchaseSumm,omitempty"`
MaxPurchaseSumm string `url:"maxPurchaseSumm,omitempty"`
MinCostSumm string `url:"minCostSumm,omitempty"`
MaxCostSumm string `url:"maxCostSumm,omitempty"`
TrackNumber string `url:"trackNumber,omitempty"`
ContragentName string `url:"contragentName,omitempty"`
ContragentInn string `url:"contragentInn,omitempty"`
ContragentKpp string `url:"contragentKpp,omitempty"`
ContragentBik string `url:"contragentBik,omitempty"`
ContragentCorrAccount string `url:"contragentCorrAccount,omitempty"`
ContragentBankAccount string `url:"contragentBankAccount,omitempty"`
ContragentTypes []string `url:"contragentTypes,omitempty,brackets"`
OrderTypes []string `url:"orderTypes,omitempty,brackets"`
PaymentStatuses []string `url:"paymentStatuses,omitempty,brackets"`
PaymentTypes []string `url:"paymentTypes,omitempty,brackets"`
DeliveryTypes []string `url:"deliveryTypes,omitempty,brackets"`
OrderMethods []string `url:"orderMethods,omitempty,brackets"`
ShipmentStores []string `url:"shipmentStores,omitempty,brackets"`
Couriers []string `url:"couriers,omitempty,brackets"`
Managers []string `url:"managers,omitempty,brackets"`
ManagerGroups []string `url:"managerGroups,omitempty,brackets"`
Sites []string `url:"sites,omitempty,brackets"`
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
CreatedAtTo string `url:"createdAtTo,omitempty"`
FullPaidAtFrom string `url:"fullPaidAtFrom,omitempty"`
FullPaidAtTo string `url:"fullPaidAtTo,omitempty"`
DeliveryDateFrom string `url:"deliveryDateFrom,omitempty"`
DeliveryDateTo string `url:"deliveryDateTo,omitempty"`
StatusUpdatedAtFrom string `url:"statusUpdatedAtFrom,omitempty"`
StatusUpdatedAtTo string `url:"statusUpdatedAtTo,omitempty"`
DpdParcelDateFrom string `url:"dpdParcelDateFrom,omitempty"`
DpdParcelDateTo string `url:"dpdParcelDateTo,omitempty"`
FirstWebVisitFrom string `url:"firstWebVisitFrom,omitempty"`
FirstWebVisitTo string `url:"firstWebVisitTo,omitempty"`
LastWebVisitFrom string `url:"lastWebVisitFrom,omitempty"`
LastWebVisitTo string `url:"lastWebVisitTo,omitempty"`
FirstOrderFrom string `url:"firstOrderFrom,omitempty"`
FirstOrderTo string `url:"firstOrderTo,omitempty"`
LastOrderFrom string `url:"lastOrderFrom,omitempty"`
LastOrderTo string `url:"lastOrderTo,omitempty"`
ShipmentDateFrom string `url:"shipmentDateFrom,omitempty"`
ShipmentDateTo string `url:"shipmentDateTo,omitempty"`
ExtendedStatus []string `url:"extendedStatus,omitempty,brackets"`
SourceName string `url:"sourceName,omitempty"`
MediumName string `url:"mediumName,omitempty"`
CampaignName string `url:"campaignName,omitempty"`
KeywordName string `url:"keywordName,omitempty"`
AdContentName string `url:"adContentName,omitempty"`
CustomFields map[string]string `url:"customFields,omitempty,brackets"`
}
// OrdersHistoryFilter type
type OrdersHistoryFilter struct {
OrderId int `url:"orderId,omitempty"`
SinceId int `url:"sinceId,omitempty"`
OrderExternalId string `url:"orderExternalId,omitempty"`
StartDate string `url:"startDate,omitempty"`
EndDate string `url:"endDate,omitempty"`
}
// UsersFilter type
type UsersFilter struct {
Email string `url:"email,omitempty"`
Status string `url:"status,omitempty"`
Online int `url:"online,omitempty"`
Active int `url:"active,omitempty"`
IsManager int `url:"isManager,omitempty"`
IsAdmin int `url:"isAdmin,omitempty"`
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
CreatedAtTo string `url:"createdAtTo,omitempty"`
Groups []string `url:"groups,omitempty,brackets"`
}
// TasksFilter type
type TasksFilter struct {
OrderNumber string `url:"orderNumber,omitempty"`
Status string `url:"status,omitempty"`
Customer string `url:"customer,omitempty"`
Text string `url:"text,omitempty"`
DateFrom string `url:"dateFrom,omitempty"`
DateTo string `url:"dateTo,omitempty"`
Creators []int `url:"creators,omitempty,brackets"`
Performers []int `url:"performers,omitempty,brackets"`
}
// NotesFilter type
type NotesFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
CustomerIds []int `url:"customerIds,omitempty,brackets"`
CustomerExternalIds []string `url:"customerExternalIds,omitempty,brackets"`
ManagerIds []int `url:"managerIds,omitempty,brackets"`
Text string `url:"text,omitempty"`
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
CreatedAtTo string `url:"createdAtTo,omitempty"`
}
// SegmentsFilter type
type SegmentsFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
Active int `url:"active,omitempty"`
Name string `url:"name,omitempty"`
Type string `url:"type,omitempty"`
MinCustomersCount int `url:"minCustomersCount,omitempty"`
MaxCustomersCount int `url:"maxCustomersCount,omitempty"`
DateFrom string `url:"dateFrom,omitempty"`
DateTo string `url:"dateTo,omitempty"`
}
// PacksFilter type
type PacksFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
Stores []string `url:"stores,omitempty"`
ItemId int `url:"itemId,omitempty"`
OfferXmlId string `url:"offerXmlId,omitempty"`
OfferExternalId string `url:"offerExternalId,omitempty"`
OrderId int `url:"orderId,omitempty"`
OrderExternalId string `url:"orderExternalId,omitempty"`
ShipmentDateFrom string `url:"shipmentDateFrom,omitempty"`
ShipmentDateTo string `url:"shipmentDateTo,omitempty"`
InvoiceNumber string `url:"invoiceNumber,omitempty"`
DeliveryNoteNumber string `url:"deliveryNoteNumber,omitempty"`
}
// InventoriesFilter type
type InventoriesFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
ProductExternalId string `url:"productExternalId,omitempty"`
ProductArticle string `url:"productArticle,omitempty"`
OfferExternalId string `url:"offerExternalId,omitempty"`
OfferXmlId string `url:"offerXmlId,omitempty"`
OfferArticle string `url:"offerArticle,omitempty"`
ProductActive int `url:"productActive,omitempty"`
Details int `url:"details,omitempty"`
Sites []string `url:"sites,omitempty,brackets"`
}
// ProductsGroupsFilter type
type ProductsGroupsFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
Sites []string `url:"sites,omitempty,brackets"`
Active int `url:"active,omitempty"`
ParentGroupId string `url:"parentGroupId,omitempty"`
}
// ProductsFilter type
type ProductsFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
OfferIds []int `url:"offerIds,omitempty,brackets"`
Active int `url:"active,omitempty"`
Recommended int `url:"recommended,omitempty"`
Novelty int `url:"novelty,omitempty"`
Stock int `url:"stock,omitempty"`
Popular int `url:"popular,omitempty"`
MaxQuantity float32 `url:"maxQuantity,omitempty"`
MinQuantity float32 `url:"minQuantity,omitempty"`
MaxPurchasePrice float32 `url:"maxPurchasePrice,omitempty"`
MinPurchasePrice float32 `url:"minPurchasePrice,omitempty"`
MaxPrice float32 `url:"maxPrice,omitempty"`
MinPrice float32 `url:"minPrice,omitempty"`
Groups string `url:"groups,omitempty"`
Name string `url:"name,omitempty"`
ClassSegment string `url:"classSegment,omitempty"`
XmlId string `url:"xmlId,omitempty"`
ExternalId string `url:"externalId,omitempty"`
Manufacturer string `url:"manufacturer,omitempty"`
Url string `url:"url,omitempty"`
PriceType string `url:"priceType,omitempty"`
OfferExternalId string `url:"offerExternalId,omitempty"`
Sites []string `url:"sites,omitempty,brackets"`
Properties map[string]string `url:"properties,omitempty,brackets"`
}
// ProductsPropertiesFilter type
type ProductsPropertiesFilter struct {
Code string `url:"code,omitempty"`
Name string `url:"name,omitempty"`
Sites []string `url:"sites,omitempty,brackets"`
}
// ShipmentFilter type
type ShipmentFilter struct {
Ids []int `url:"ids,omitempty,brackets"`
ExternalId string `url:"externalId,omitempty"`
OrderNumber string `url:"orderNumber,omitempty"`
DateFrom string `url:"dateFrom,omitempty"`
DateTo string `url:"dateTo,omitempty"`
Stores []string `url:"stores,omitempty,brackets"`
Managers []string `url:"managers,omitempty,brackets"`
DeliveryTypes []string `url:"deliveryTypes,omitempty,brackets"`
Statuses []string `url:"statuses,omitempty,brackets"`
}

144
v5/request.go Normal file
View File

@ -0,0 +1,144 @@
package v5
// CustomerRequest type
type CustomerRequest struct {
By string `url:"by,omitempty"`
Site string `url:"site,omitempty"`
}
// CustomersRequest type
type CustomersRequest struct {
Filter CustomersFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// CustomersUploadRequest type
type CustomersUploadRequest struct {
Customers []Customer `url:"customers,omitempty,brackets"`
Site string `url:"site,omitempty"`
}
// CustomersHistoryRequest type
type CustomersHistoryRequest struct {
Filter CustomersHistoryFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// OrderRequest type
type OrderRequest struct {
By string `url:"by,omitempty"`
Site string `url:"site,omitempty"`
}
// OrdersRequest type
type OrdersRequest struct {
Filter OrdersFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// OrdersUploadRequest type
type OrdersUploadRequest struct {
Orders []Order `url:"orders,omitempty,brackets"`
Site string `url:"site,omitempty"`
}
// OrdersHistoryRequest type
type OrdersHistoryRequest struct {
Filter OrdersHistoryFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// PacksRequest type
type PacksRequest struct {
Filter PacksFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// PacksHistoryRequest type
type PacksHistoryRequest struct {
Filter OrdersHistoryFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// UsersRequest type
type UsersRequest struct {
Filter UsersFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// UserGroupsRequest type
type UserGroupsRequest struct {
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// TasksRequest type
type TasksRequest struct {
Filter TasksFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// NotesRequest type
type NotesRequest struct {
Filter TasksFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// SegmentsRequest type
type SegmentsRequest struct {
Filter SegmentsFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// InventoriesRequest type
type InventoriesRequest struct {
Filter InventoriesFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// ProductsGroupsRequest type
type ProductsGroupsRequest struct {
Filter ProductsGroupsFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// ProductsRequest type
type ProductsRequest struct {
Filter ProductsFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// ProductsPropertiesRequest type
type ProductsPropertiesRequest struct {
Filter ProductsPropertiesFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}
// DeliveryTrackingRequest type
type DeliveryTrackingRequest struct {
DeliveryId string `url:"deliveryId,omitempty"`
TrackNumber string `url:"trackNumber,omitempty"`
History []DeliveryHistoryRecord `url:"history,omitempty,brackets"`
ExtraData map[string]string `url:"extraData,omitempty,brackets"`
}
// DeliveryShipmentsRequest type
type DeliveryShipmentsRequest struct {
Filter ShipmentFilter `url:"filter,omitempty"`
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
}

346
v5/response.go Normal file
View File

@ -0,0 +1,346 @@
package v5
import "encoding/json"
// ErrorResponse type
type ErrorResponse struct {
ErrorMsg string `json:"errorMsg,omitempty"`
Errors map[string]string `json:"errors,omitempty"`
}
// ErrorResponse method
func (c *Client) ErrorResponse(data []byte) (ErrorResponse, error) {
var resp ErrorResponse
err := json.Unmarshal(data, &resp)
return resp, err
}
// SucessfulResponse type
type SucessfulResponse struct {
Success bool `json:"success,omitempty"`
}
// CreateResponse type
type CreateResponse struct {
Success bool `json:"success"`
Id int `json:"id,omitempty"`
}
// OperationResponse type
type OperationResponse struct {
Success bool `json:"success"`
Errors map[string]string `json:"errors,omitempty,brackets"`
}
// VersionResponse return available API versions
type VersionResponse struct {
Success bool `json:"success,omitempty"`
Versions []string `json:"versions,brackets,omitempty"`
}
// CredentialResponse return available API methods
type CredentialResponse struct {
Success bool `json:"success,omitempty"`
Credentials []string `json:"credentials,brackets,omitempty"`
SiteAccess string `json:"siteAccess,omitempty"`
SitesAvailable []string `json:"sitesAvailable,brackets,omitempty"`
}
// CustomerResponse type
type CustomerResponse struct {
Success bool `json:"success"`
Customer *Customer `json:"customer,omitempty,brackets"`
}
// CustomersResponse type
type CustomersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Customers []Customer `json:"customers,omitempty,brackets"`
}
// CustomerChangeResponse type
type CustomerChangeResponse struct {
Success bool `json:"success"`
Id int `json:"id,omitempty"`
State string `json:"state,omitempty"`
}
// CustomersUploadResponse type
type CustomersUploadResponse struct {
Success bool `json:"success"`
UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty,brackets"`
}
// CustomersHistoryResponse type
type CustomersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []CustomerHistoryRecord `json:"history,omitempty,brackets"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// OrderResponse type
type OrderResponse struct {
Success bool `json:"success"`
Order *Order `json:"order,omitempty,brackets"`
}
// OrdersResponse type
type OrdersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Orders []Order `json:"orders,omitempty,brackets"`
}
// OrdersUploadResponse type
type OrdersUploadResponse struct {
Success bool `json:"success"`
UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty,brackets"`
}
// OrdersHistoryResponse type
type OrdersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []OrdersHistoryRecord `json:"history,omitempty,brackets"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// PackResponse type
type PackResponse struct {
Success bool `json:"success"`
Pack *Pack `json:"pack,omitempty,brackets"`
}
// PacksResponse type
type PacksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Packs []Pack `json:"packs,omitempty,brackets"`
}
// PacksHistoryResponse type
type PacksHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []PacksHistoryRecord `json:"history,omitempty,brackets"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// UserResponse type
type UserResponse struct {
Success bool `json:"success"`
User *User `json:"user,omitempty,brackets"`
}
// UsersResponse type
type UsersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Users []User `json:"users,omitempty,brackets"`
}
// UserGroupsResponse type
type UserGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Groups []UserGroup `json:"groups,omitempty,brackets"`
}
// TaskResponse type
type TaskResponse struct {
Success bool `json:"success"`
Task *Task `json:"task,omitempty,brackets"`
}
// TasksResponse type
type TasksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Tasks []Task `json:"tasks,omitempty,brackets"`
}
// NotesResponse type
type NotesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Notes []Note `json:"notes,omitempty,brackets"`
}
// SegmentsResponse type
type SegmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Segments []Segment `json:"segments,omitempty,brackets"`
}
// CountriesResponse type
type CountriesResponse struct {
Success bool `json:"success"`
CountriesIso []string `json:"countriesIso,omitempty,brackets"`
}
// CostGroupsResponse type
type CostGroupsResponse struct {
Success bool `json:"success"`
CostGroups []CostGroup `json:"costGroups,omitempty,brackets"`
}
// CostItemsResponse type
type CostItemsResponse struct {
Success bool `json:"success"`
CostItems []CostItem `json:"costItems,omitempty,brackets"`
}
// CouriersResponse type
type CouriersResponse struct {
Success bool `json:"success"`
Couriers []Courier `json:"couriers,omitempty,brackets"`
}
// DeliveryServiceResponse type
type DeliveryServiceResponse struct {
Success bool `json:"success"`
DeliveryServices map[string]DeliveryService `json:"deliveryServices,omitempty,brackets"`
}
// DeliveryTypesResponse type
type DeliveryTypesResponse struct {
Success bool `json:"success"`
DeliveryTypes map[string]DeliveryType `json:"deliveryTypes,omitempty,brackets"`
}
// LegalEntitiesResponse type
type LegalEntitiesResponse struct {
Success bool `json:"success"`
LegalEntities []LegalEntity `json:"legalEntities,omitempty,brackets"`
}
// OrderMethodsResponse type
type OrderMethodsResponse struct {
Success bool `json:"success"`
OrderMethods map[string]OrderMethod `json:"orderMethods,omitempty,brackets"`
}
// OrderTypesResponse type
type OrderTypesResponse struct {
Success bool `json:"success"`
OrderTypes map[string]OrderType `json:"orderTypes,omitempty,brackets"`
}
// PaymentStatusesResponse type
type PaymentStatusesResponse struct {
Success bool `json:"success"`
PaymentStatuses map[string]PaymentStatus `json:"paymentStatuses,omitempty,brackets"`
}
// PaymentTypesResponse type
type PaymentTypesResponse struct {
Success bool `json:"success"`
PaymentTypes map[string]PaymentType `json:"paymentTypes,omitempty,brackets"`
}
// PriceTypesResponse type
type PriceTypesResponse struct {
Success bool `json:"success"`
PriceTypes []PriceType `json:"priceTypes,omitempty,brackets"`
}
// ProductStatusesResponse type
type ProductStatusesResponse struct {
Success bool `json:"success"`
ProductStatuses map[string]ProductStatus `json:"productStatuses,omitempty,brackets"`
}
// StatusesResponse type
type StatusesResponse struct {
Success bool `json:"success"`
Statuses map[string]Status `json:"statuses,omitempty,brackets"`
}
// StatusGroupsResponse type
type StatusGroupsResponse struct {
Success bool `json:"success"`
StatusGroups map[string]StatusGroup `json:"statusGroups,omitempty,brackets"`
}
// SitesResponse type
type SitesResponse struct {
Success bool `json:"success"`
Sites map[string]Site `json:"sites,omitempty,brackets"`
}
// StoresResponse type
type StoresResponse struct {
Success bool `json:"success"`
Stores []Store `json:"stores,omitempty,brackets"`
}
// InventoriesResponse type
type InventoriesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Offers []Offer `json:"offers,omitempty"`
}
// StoreUploadResponse type
type StoreUploadResponse struct {
Success bool `json:"success"`
ProcessedOffersCount int `json:"processedOffersCount,omitempty"`
NotFoundOffers []Offer `json:"notFoundOffers,omitempty"`
}
// ProductsGroupsResponse type
type ProductsGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
ProductGroup []ProductGroup `json:"productGroup,omitempty,brackets"`
}
// ProductsResponse type
type ProductsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Products []Product `json:"products,omitempty,brackets"`
}
// ProductsPropertiesResponse type
type ProductsPropertiesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Properties []Property `json:"properties,omitempty,brackets"`
}
// DeliveryShipmentsResponse type
type DeliveryShipmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
DeliveryShipments []DeliveryShipment `json:"deliveryShipments,omitempty,brackets"`
}
// DeliveryShipmentResponse type
type DeliveryShipmentResponse struct {
Success bool `json:"success"`
DeliveryShipment *DeliveryShipment `json:"deliveryShipment,omitempty,brackets"`
}
// DeliveryShipmentUpdateResponse type
type DeliveryShipmentUpdateResponse struct {
Success bool `json:"success"`
Id int `json:"id,omitempty"`
Status string `json:"status,omitempty"`
}
// IntegrationModuleResponse type
type IntegrationModuleResponse struct {
Success bool `json:"success"`
IntegrationModule *IntegrationModule `json:"integrationModule,omitempty"`
}
// IntegrationModuleEditResponse type
type IntegrationModuleEditResponse struct {
Success bool `json:"success"`
Info map[string]string `json:"info,omitempty,brackets"`
}

866
v5/types.go Normal file
View File

@ -0,0 +1,866 @@
package v5
import "net/http"
// Client type
type Client struct {
Url string
Key string
httpClient *http.Client
}
// Pagination type
type Pagination struct {
Limit int `json:"limit,omitempty"`
TotalCount int `json:"totalCount,omitempty"`
CurrentPage int `json:"currentPage,omitempty"`
TotalPageCount int `json:"totalPageCount,omitempty"`
}
// Address type
type Address struct {
Index string `json:"index,omitempty"`
CountryIso string `json:"countryIso,omitempty"`
Region string `json:"region,omitempty"`
RegionId int `json:"regionId,omitempty"`
City string `json:"city,omitempty"`
CityId int `json:"cityId,omitempty"`
CityType string `json:"cityType,omitempty"`
Street string `json:"street,omitempty"`
StreetId int `json:"streetId,omitempty"`
StreetType string `json:"streetType,omitempty"`
Building string `json:"building,omitempty"`
Flat string `json:"flat,omitempty"`
IntercomCode string `json:"intercomCode,omitempty"`
Floor int `json:"floor,omitempty"`
Block int `json:"block,omitempty"`
House string `json:"house,omitempty"`
Metro string `json:"metro,omitempty"`
Notes string `json:"notes,omitempty"`
Text string `json:"text,omitempty"`
}
// GeoHierarchyRow type
type GeoHierarchyRow struct {
Country string `json:"country,omitempty"`
Region string `json:"region,omitempty"`
RegionId int `json:"regionId,omitempty"`
City string `json:"city,omitempty"`
CityId int `json:"cityId,omitempty"`
}
// Source type
type Source struct {
Source string `json:"source,omitempty"`
Medium string `json:"medium,omitempty"`
Campaign string `json:"campaign,omitempty"`
Keyword string `json:"keyword,omitempty"`
Content string `json:"content,omitempty"`
}
// Contragent type
type Contragent struct {
ContragentType string `json:"contragentType,omitempty"`
LegalName string `json:"legalName,omitempty"`
LegalAddress string `json:"legalAddress,omitempty"`
INN string `json:"INN,omitempty"`
OKPO string `json:"OKPO,omitempty"`
KPP string `json:"KPP,omitempty"`
OGRN string `json:"OGRN,omitempty"`
OGRNIP string `json:"OGRNIP,omitempty"`
CertificateNumber string `json:"certificateNumber,omitempty"`
CertificateDate string `json:"certificateDate,omitempty"`
BIK string `json:"BIK,omitempty"`
Bank string `json:"bank,omitempty"`
BankAddress string `json:"bankAddress,omitempty"`
CorrAccount string `json:"corrAccount,omitempty"`
BankAccount string `json:"bankAccount,omitempty"`
}
// ApiKey type
type ApiKey struct {
Current bool `json:"current,omitempty"`
}
// Property type
type Property struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Sites []string `json:"Sites,omitempty,brackets"`
}
// IdentifiersPair type
type IdentifiersPair struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
}
// DeliveryTime type
type DeliveryTime struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Custom string `json:"custom,omitempty"`
}
/**
Customer related types
*/
// Customer type
type Customer struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Patronymic string `json:"patronymic,omitempty"`
Sex string `json:"sex,omitempty"`
Email string `json:"email,omitempty"`
Phones []Phone `json:"phones,brackets,omitempty"`
Address *Address `json:"address,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Birthday string `json:"birthday,omitempty"`
ManagerId int `json:"managerId,omitempty"`
Vip bool `json:"vip,omitempty"`
Bad bool `json:"bad,omitempty"`
Site string `json:"site,omitempty"`
Source *Source `json:"source,omitempty"`
Contragent *Contragent `json:"contragent,omitempty"`
PersonalDiscount float32 `json:"personalDiscount,omitempty"`
CumulativeDiscount float32 `json:"cumulativeDiscount,omitempty"`
DiscountCardNumber string `json:"discountCardNumber,omitempty"`
EmailMarketingUnsubscribedAt string `json:"emailMarketingUnsubscribedAt,omitempty"`
AvgMarginSumm float32 `json:"avgMarginSumm,omitempty"`
MarginSumm float32 `json:"marginSumm,omitempty"`
TotalSumm float32 `json:"totalSumm,omitempty"`
AverageSumm float32 `json:"averageSumm,omitempty"`
OrdersCount int `json:"ordersCount,omitempty"`
CostSumm float32 `json:"costSumm,omitempty"`
MaturationTime int `json:"maturationTime,omitempty"`
FirstClientId string `json:"firstClientId,omitempty"`
LastClientId string `json:"lastClientId,omitempty"`
BrowserId string `json:"browserId,omitempty"`
CustomFields []map[string]string `json:"customFields,omitempty,brackets"`
}
// Phone type
type Phone struct {
Number string `json:"number,omitempty"`
}
// CustomerHistoryRecord type
type CustomerHistoryRecord struct {
Id int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Created bool `json:"created,omitempty"`
Deleted bool `json:"deleted,omitempty"`
Source string `json:"source,omitempty"`
Field string `json:"field,omitempty"`
User *User `json:"user,omitempty,brackets"`
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
Customer *Customer `json:"customer,omitempty,brackets"`
}
/**
Order related types
*/
// Order type
type Order struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
Number string `json:"number,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Patronymic string `json:"patronymic,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
AdditionalPhone string `json:"additionalPhone,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
StatusUpdatedAt string `json:"statusUpdatedAt,omitempty"`
ManagerId int `json:"managerId,omitempty"`
Mark int `json:"mark,omitempty"`
Call bool `json:"call,omitempty"`
Expired bool `json:"expired,omitempty"`
FromApi bool `json:"fromApi,omitempty"`
MarkDatetime string `json:"markDatetime,omitempty"`
CustomerComment string `json:"customerComment,omitempty"`
ManagerComment string `json:"managerComment,omitempty"`
Status string `json:"status,omitempty"`
StatusComment string `json:"statusComment,omitempty"`
FullPaidAt string `json:"fullPaidAt,omitempty"`
Site string `json:"site,omitempty"`
OrderType string `json:"orderType,omitempty"`
OrderMethod string `json:"orderMethod,omitempty"`
CountryIso string `json:"countryIso,omitempty"`
Summ float32 `json:"summ,omitempty"`
TotalSumm float32 `json:"totalSumm,omitempty"`
PrepaySum float32 `json:"prepaySum,omitempty"`
PurchaseSumm float32 `json:"purchaseSumm,omitempty"`
DiscountManualAmount float32 `json:"discountManualAmount,omitempty"`
DiscountManualPercent float32 `json:"discountManualPercent,omitempty"`
Weight float32 `json:"weight,omitempty"`
Length int `json:"length,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
ShipmentStore string `json:"shipmentStore,omitempty"`
ShipmentDate string `json:"shipmentDate,omitempty"`
ClientId string `json:"clientId,omitempty"`
Shipped bool `json:"shipped,omitempty"`
UploadedToExternalStoreSystem bool `json:"uploadedToExternalStoreSystem,omitempty"`
Source *Source `json:"source,omitempty"`
Contragent *Contragent `json:"contragent,omitempty"`
Customer *Customer `json:"customer,omitempty"`
Delivery *OrderDelivery `json:"delivery,omitempty"`
Marketplace *OrderMarketplace `json:"marketplace,omitempty"`
Items []OrderItem `json:"items,omitempty,brackets"`
CustomFields []map[string]string `json:"customFields,omitempty,brackets"`
Payments []OrderPayment `json:"payments,omitempty,brackets"`
}
// OrderDelivery type
type OrderDelivery struct {
Code string `json:"code,omitempty"`
IntegrationCode string `json:"integrationCode,omitempty"`
Cost float32 `json:"cost,omitempty"`
NetCost float32 `json:"netCost,omitempty"`
VatRate string `json:"vatRate,omitempty"`
Date string `json:"date,omitempty"`
Time *OrderDeliveryTime `json:"time,omitempty"`
Address *Address `json:"address,omitempty"`
Service *OrderDeliveryService `json:"service,omitempty"`
Data *OrderDeliveryData `json:"data,omitempty"`
}
// OrderDeliveryTime type
type OrderDeliveryTime struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Custom string `json:"custom,omitempty"`
}
// OrderDeliveryService type
type OrderDeliveryService struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
}
// OrderDeliveryData type
type OrderDeliveryData struct {
TrackNumber string `json:"trackNumber,omitempty"`
Status string `json:"status,omitempty"`
PickuppointAddress string `json:"pickuppointAddress,omitempty"`
PayerType string `json:"payerType,omitempty"`
}
// OrderMarketplace type
type OrderMarketplace struct {
Code string `json:"code,omitempty"`
OrderId string `json:"orderId,omitempty"`
}
// OrderPayment type
type OrderPayment struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
Type string `json:"type,omitempty"`
Status string `json:"status,omitempty"`
PaidAt string `json:"paidAt,omitempty"`
Amount float32 `json:"amount,omitempty"`
Comment string `json:"comment,omitempty"`
}
// OrderItem type
type OrderItem struct {
Id int `json:"id,omitempty"`
InitialPrice float32 `json:"initialPrice,omitempty"`
PurchasePrice float32 `json:"purchasePrice,omitempty"`
DiscountTotal float32 `json:"discountTotal,omitempty"`
DiscountManualAmount float32 `json:"discountManualAmount,omitempty"`
DiscountManualPercent float32 `json:"discountManualPercent,omitempty"`
ProductName string `json:"productName,omitempty"`
VatRate string `json:"vatRate,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Quantity float32 `json:"quantity,omitempty"`
Status string `json:"status,omitempty"`
Comment string `json:"comment,omitempty"`
IsCanceled bool `json:"isCanceled,omitempty"`
Offer Offer `json:"offer,omitempty"`
Properties []Property `json:"properties,omitempty,brackets"`
PriceType *PriceType `json:"priceType,omitempty"`
}
// OrdersHistoryRecord type
type OrdersHistoryRecord struct {
Id int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Created bool `json:"created,omitempty"`
Deleted bool `json:"deleted,omitempty"`
Source string `json:"source,omitempty"`
Field string `json:"field,omitempty"`
User *User `json:"user,omitempty,brackets"`
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
Order *Order `json:"order,omitempty,brackets"`
}
// Pack type
type Pack struct {
Id int `json:"id,omitempty"`
PurchasePrice float32 `json:"purchasePrice,omitempty"`
Quantity float32 `json:"quantity,omitempty"`
Store string `json:"store,omitempty"`
ShipmentDate string `json:"shipmentDate,omitempty"`
InvoiceNumber string `json:"invoiceNumber,omitempty"`
DeliveryNoteNumber string `json:"deliveryNoteNumber,omitempty"`
Item *PackItem `json:"item,omitempty"`
ItemId int `json:"itemId,omitempty"`
}
// PackItem type
type PackItem struct {
Id int `json:"id,omitempty"`
Order *Order `json:"order,omitempty"`
Offer *Offer `json:"offer,omitempty"`
}
// PacksHistoryRecord type
type PacksHistoryRecord struct {
Id int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Created bool `json:"created,omitempty"`
Deleted bool `json:"deleted,omitempty"`
Source string `json:"source,omitempty"`
Field string `json:"field,omitempty"`
User *User `json:"user,omitempty,brackets"`
Pack *Pack `json:"pack,omitempty,brackets"`
}
// Offer type
type Offer struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
Name string `json:"name,omitempty"`
XmlId string `json:"xmlId,omitempty"`
Article string `json:"article,omitempty"`
VatRate string `json:"vatRate,omitempty"`
Price float32 `json:"price,omitempty"`
PurchasePrice float32 `json:"purchasePrice,omitempty"`
Quantity float32 `json:"quantity,omitempty"`
Height float32 `json:"height,omitempty"`
Width float32 `json:"width,omitempty"`
Length float32 `json:"length,omitempty"`
Weight float32 `json:"weight,omitempty"`
Stores []Inventory `json:"stores,omitempty,brackets"`
Properties map[string]string `json:"properties,omitempty,brackets"`
Prices []OfferPrice `json:"prices,omitempty,brackets"`
Images []string `json:"images,omitempty,brackets"`
}
// Inventory type
type Inventory struct {
PurchasePrice float32 `json:"purchasePrice,omitempty"`
Quantity float32 `json:"quantity,omitempty"`
Store string `json:"store,omitempty"`
}
// InventoryUpload type
type InventoryUpload struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
XmlId string `json:"xmlId,omitempty"`
Stores []InventoryUploadStore `json:"stores,omitempty"`
}
// InventoryUploadStore type
type InventoryUploadStore struct {
PurchasePrice float32 `json:"purchasePrice,omitempty"`
Available float32 `json:"available,omitempty"`
Code string `json:"code,omitempty"`
}
// OfferPrice type
type OfferPrice struct {
Price float32 `json:"price,omitempty"`
Ordering int `json:"ordering,omitempty"`
PriceType string `json:"priceType,omitempty"`
}
// OfferPriceUpload type
type OfferPriceUpload struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
XmlId string `json:"xmlId,omitempty"`
Site string `json:"site,omitempty"`
Prices []PriceUpload `json:"prices,omitempty"`
}
// PriceUpload type
type PriceUpload struct {
Code string `json:"code,omitempty"`
Price float32 `json:"price,omitempty"`
}
/**
User related types
*/
// User type
type User struct {
Id int `json:"id,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Patronymic string `json:"patronymic,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Active bool `json:"active,omitempty"`
Online bool `json:"online,omitempty"`
IsAdmin bool `json:"isAdmin,omitempty"`
IsManager bool `json:"isManager,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Status string `json:"status,omitempty"`
Groups []UserGroup `json:"groups,omitempty,brackets"`
}
// UserGroup type
type UserGroup struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
SignatureTemplate string `json:"signatureTemplate,omitempty"`
IsManager bool `json:"isManager,omitempty"`
IsDeliveryMen bool `json:"isDeliveryMen,omitempty"`
DeliveryTypes []string `json:"deliveryTypes,omitempty,brackets"`
BreakdownOrderTypes []string `json:"breakdownOrderTypes,omitempty,brackets"`
BreakdownSites []string `json:"breakdownSites,omitempty,brackets"`
BreakdownOrderMethods []string `json:"breakdownOrderMethods,omitempty,brackets"`
GrantedOrderTypes []string `json:"grantedOrderTypes,omitempty,brackets"`
GrantedSites []string `json:"grantedSites,omitempty,brackets"`
}
/**
Task related types
*/
// Task type
type Task struct {
Id int `json:"id,omitempty"`
PerformerId int `json:"performerId,omitempty"`
Text string `json:"text,omitempty"`
Commentary string `json:"commentary,omitempty"`
Datetime string `json:"datetime,omitempty"`
Complete bool `json:"complete,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Creator int `json:"creator,omitempty"`
Performer int `json:"performer,omitempty"`
Phone string `json:"phone,omitempty"`
PhoneSite string `json:"phoneSite,omitempty"`
Customer *Customer `json:"customer,omitempty"`
Order *Order `json:"order,omitempty"`
}
/*
Notes related types
*/
// Note type
type Note struct {
Id int `json:"id,omitempty"`
ManagerId int `json:"managerId,omitempty"`
Text string `json:"text,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Customer *Customer `json:"customer,omitempty"`
}
/*
Payments related types
*/
// Payment type
type Payment struct {
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
PaidAt string `json:"paidAt,omitempty"`
Amount float32 `json:"amount,omitempty"`
Comment string `json:"comment,omitempty"`
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
Order *Order `json:"order,omitempty"`
}
/*
Segment related types
*/
// Segment type
type Segment struct {
Id int `json:"id,omitempty"`
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
CustomersCount int `json:"customersCount,omitempty"`
IsDynamic bool `json:"isDynamic,omitempty"`
Active bool `json:"active,omitempty"`
}
/**
Reference related types
*/
// CostGroup type
type CostGroup struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Color string `json:"color,omitempty"`
Active bool `json:"active,omitempty"`
Ordering int `json:"ordering,omitempty"`
}
// CostItem type
type CostItem struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Group string `json:"group,omitempty"`
Type string `json:"type,omitempty"`
Active bool `json:"active,omitempty"`
AppliesToOrders bool `json:"appliesToOrders,omitempty"`
AppliesToUsers bool `json:"appliesToUsers,omitempty"`
Ordering int `json:"ordering,omitempty"`
Source *Source `json:"source,omitempty"`
}
// Courier type
type Courier struct {
Id int `json:"id,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Patronymic string `json:"patronymic,omitempty"`
Email string `json:"email,omitempty"`
Description string `json:"description,omitempty"`
Active bool `json:"active,omitempty"`
Phone *Phone `json:"phone,omitempty"`
}
// DeliveryService type
type DeliveryService struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
}
// DeliveryType type
type DeliveryType struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
DefaultCost float32 `json:"defaultCost,omitempty"`
DefaultNetCost float32 `json:"defaultNetCost,omitempty"`
Description string `json:"description,omitempty"`
IntegrationCode string `json:"integrationCode,omitempty"`
VatRate string `json:"vatRate,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DeliveryServices []string `json:"deliveryServices,omitempty"`
PaymentTypes []string `json:"paymentTypes,omitempty"`
}
// LegalEntity type
type LegalEntity struct {
Code string `json:"code,omitempty"`
VatRate string `json:"vatRate,omitempty"`
CountryIso string `json:"countryIso,omitempty"`
ContragentType string `json:"contragentType,omitempty"`
LegalName string `json:"legalName,omitempty"`
LegalAddress string `json:"legalAddress,omitempty"`
INN string `json:"INN,omitempty"`
OKPO string `json:"OKPO,omitempty"`
KPP string `json:"KPP,omitempty"`
OGRN string `json:"OGRN,omitempty"`
OGRNIP string `json:"OGRNIP,omitempty"`
CertificateNumber string `json:"certificateNumber,omitempty"`
CertificateDate string `json:"certificateDate,omitempty"`
BIK string `json:"BIK,omitempty"`
Bank string `json:"bank,omitempty"`
BankAddress string `json:"bankAddress,omitempty"`
CorrAccount string `json:"corrAccount,omitempty"`
BankAccount string `json:"bankAccount,omitempty"`
}
// OrderMethod type
type OrderMethod struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DefaultForApi bool `json:"defaultForApi,omitempty"`
}
// OrderType type
type OrderType struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DefaultForApi bool `json:"defaultForApi,omitempty"`
}
// PaymentStatus type
type PaymentStatus struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DefaultForApi bool `json:"defaultForApi,omitempty"`
PaymentComplete bool `json:"paymentComplete,omitempty"`
Description string `json:"description,omitempty"`
Ordering int `json:"ordering,omitempty"`
PaymentTypes []string `json:"paymentTypes,omitempty,brackets"`
}
// PaymentType type
type PaymentType struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DefaultForApi bool `json:"defaultForApi,omitempty"`
Description string `json:"description,omitempty"`
DeliveryTypes []string `json:"deliveryTypes,omitempty,brackets"`
PaymentStatuses []string `json:"PaymentStatuses,omitempty,brackets"`
}
// PriceType type
type PriceType struct {
Id int `json:"id,omitempty"`
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
Active bool `json:"active,omitempty"`
Default bool `json:"default,omitempty"`
Description string `json:"description,omitempty"`
FilterExpression string `json:"filterExpression,omitempty"`
Ordering int `json:"ordering,omitempty"`
Groups []string `json:"groups,omitempty,brackets"`
Geo []GeoHierarchyRow `json:"geo,omitempty,brackets"`
}
// ProductStatus type
type ProductStatus struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
Ordering int `json:"ordering,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
CancelStatus bool `json:"cancelStatus,omitempty"`
OrderStatusByProductStatus string `json:"orderStatusByProductStatus,omitempty"`
OrderStatusForProductStatus string `json:"orderStatusForProductStatus,omitempty"`
}
// Status type
type Status struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
Ordering int `json:"ordering,omitempty"`
Group string `json:"group,omitempty"`
}
// StatusGroup type
type StatusGroup struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"`
Ordering int `json:"ordering,omitempty"`
Process bool `json:"process,omitempty"`
Statuses []string `json:"statuses,omitempty,brackets"`
}
// Site type
type Site struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Url string `json:"url,omitempty"`
Description string `json:"description,omitempty"`
Phones string `json:"phones,omitempty"`
Zip string `json:"zip,omitempty"`
Address string `json:"address,omitempty"`
CountryIso string `json:"countryIso,omitempty"`
YmlUrl string `json:"ymlUrl,omitempty"`
LoadFromYml bool `json:"loadFromYml,omitempty"`
CatalogUpdatedAt string `json:"catalogUpdatedAt,omitempty"`
CatalogLoadingAt string `json:"catalogLoadingAt,omitempty"`
Contragent *LegalEntity `json:"contragent,omitempty"`
}
// Store type
type Store struct {
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
ExternalId string `json:"externalId,omitempty"`
Description string `json:"description,omitempty"`
XmlId string `json:"xmlId,omitempty"`
Email string `json:"email,omitempty"`
Type string `json:"type,omitempty"`
InventoryType string `json:"inventoryType,omitempty"`
Active bool `json:"active,omitempty"`
Phone *Phone `json:"phone,omitempty"`
Address *Address `json:"address,omitempty"`
}
// ProductGroup type
type ProductGroup struct {
Id int `json:"id,omitempty"`
ParentId int `json:"parentId,omitempty"`
Name string `json:"name,omitempty"`
Site string `json:"site,omitempty"`
Active bool `json:"active,omitempty"`
}
// Product type
type Product struct {
Id int `json:"id,omitempty"`
MaxPrice float32 `json:"maxPrice,omitempty"`
MinPrice float32 `json:"minPrice,omitempty"`
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
Article string `json:"article,omitempty"`
ExternalId string `json:"externalId,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
ImageUrl string `json:"imageUrl,omitempty"`
Description string `json:"description,omitempty"`
Popular bool `json:"popular,omitempty"`
Stock bool `json:"stock,omitempty"`
Novelty bool `json:"novelty,omitempty"`
Recommended bool `json:"recommended,omitempty"`
Active bool `json:"active,omitempty"`
Quantity float32 `json:"quantity,omitempty"`
Offers []Offer `json:"offers,omitempty,brackets"`
Groups []ProductGroup `json:"groups,omitempty,brackets"`
Properties map[string]string `json:"properties,omitempty,brackets"`
}
// DeliveryHistoryRecord type
type DeliveryHistoryRecord struct {
Code string `json:"code,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
Comment string `json:"comment,omitempty"`
}
// DeliveryShipment type
type DeliveryShipment struct {
IntegrationCode string `json:"integrationCode,omitempty"`
Id int `json:"id,omitempty"`
ExternalId string `json:"externalId,omitempty"`
DeliveryType string `json:"deliveryType,omitempty"`
Store string `json:"store,omitempty"`
ManagerId int `json:"managerId,omitempty"`
Status string `json:"status,omitempty"`
Date string `json:"date,omitempty"`
Time *DeliveryTime `json:"time,omitempty"`
LunchTime string `json:"lunchTime,omitempty"`
Comment string `json:"comment,omitempty"`
Orders []Order `json:"orders,omitempty,brackets"`
ExtraData map[string]string `json:"extraData,omitempty,brackets"`
}
// IntegrationModule type
type IntegrationModule struct {
Code string `json:"code,omitempty"`
IntegrationCode string `json:"integrationCode,omitempty"`
Active bool `json:"active,omitempty"`
Freeze bool `json:"freeze,omitempty"`
Native bool `json:"native,omitempty"`
Name string `json:"name,omitempty"`
Logo string `json:"logo,omitempty"`
ClientId string `json:"clientId,omitempty"`
BaseUrl string `json:"baseUrl,omitempty"`
AccountUrl string `json:"accountUrl,omitempty"`
AvailableCountries []string `json:"availableCountries,omitempty"`
Actions []string `json:"actions,omitempty"`
Integrations *Integrations `json:"integrations,omitempty"`
}
// Integrations type
type Integrations struct {
Telephony *Telephony `json:"telephony,omitempty"`
Delivery *Delivery `json:"delivery,omitempty"`
Store *Warehouse `json:"store,omitempty"`
}
// Delivery type
type Delivery struct {
Description string `json:"description,omitempty"`
Actions []Action `json:"actions,omitempty,brackets"`
PayerType []string `json:"payerType,omitempty,brackets"`
PlatePrintLimit int `json:"platePrintLimit,omitempty"`
RateDeliveryCost bool `json:"rateDeliveryCost,omitempty"`
AllowPackages bool `json:"allowPackages,omitempty"`
CodAvailable bool `json:"codAvailable,omitempty"`
SelfShipmentAvailable bool `json:"selfShipmentAvailable,omitempty"`
AllowTrackNumber bool `json:"allowTrackNumber,omitempty"`
AvailableCountries []string `json:"availableCountries,omitempty"`
RequiredFields []string `json:"requiredFields,omitempty"`
StatusList []DeliveryStatus `json:"statusList,omitempty"`
PlateList []Plate `json:"plateList,omitempty"`
DeliveryDataFieldList []DeliveryDataField `json:"deliveryDataFieldList,omitempty"`
ShipmentDataFieldList []DeliveryDataField `json:"shipmentDataFieldList,omitempty"`
}
// DeliveryStatus type
type DeliveryStatus struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
IsEditable bool `json:"isEditable,omitempty"`
}
// Plate type
type Plate struct {
Code string `json:"code,omitempty"`
Label string `json:"label,omitempty"`
}
// DeliveryDataField type
type DeliveryDataField struct {
Code string `json:"code,omitempty"`
Label string `json:"label,omitempty"`
Hint string `json:"hint,omitempty"`
Type string `json:"type,omitempty"`
AutocompleteUrl string `json:"autocompleteUrl,omitempty"`
Multiple bool `json:"multiple,omitempty"`
Required bool `json:"required,omitempty"`
AffectsCost bool `json:"affectsCost,omitempty"`
Editable bool `json:"editable,omitempty"`
}
// Telephony type
type Telephony struct {
MakeCallUrl string `json:"makeCallUrl,omitempty"`
AllowEdit bool `json:"allowEdit,omitempty"`
InputEventSupported bool `json:"inputEventSupported,omitempty"`
OutputEventSupported bool `json:"outputEventSupported,omitempty"`
HangupEventSupported bool `json:"hangupEventSupported,omitempty"`
ChangeUserStatusUrl string `json:"changeUserStatusUrl,omitempty"`
AdditionalCodes []AdditionalCode `json:"additionalCodes,omitempty,brackets"`
ExternalPhones []ExternalPhone `json:"externalPhones,omitempty,brackets"`
}
// AdditionalCode type
type AdditionalCode struct {
Code string `json:"code,omitempty"`
UserId string `json:"userId,omitempty"`
}
// ExternalPhone type
type ExternalPhone struct {
SiteCode string `json:"siteCode,omitempty"`
ExternalPhone string `json:"externalPhone,omitempty"`
}
// Warehouse type
type Warehouse struct {
Actions []Action `json:"actions,omitempty,brackets"`
}
// Action type
type Action struct {
Code string `json:"code,omitempty"`
Url string `json:"url,omitempty"`
CallPoints []string `json:"callPoints,omitempty"`
}