retailcrm

package module
v2.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 18 Imported by: 5

README

Build Status Covarage GitHub release Go Report Card GoLang version pkg.go.dev

RetailCRM API Go client

This is golang RetailCRM API client.

Installation

go get -u github.com/retailcrm/api-client-go/v2

Usage

Example:

package main

import (
	"log"

	"github.com/retailcrm/api-client-go/v2"
)

func main() {
	var client = retailcrm.New("https://demo.retailcrm.pro", "09jIJ09j0JKhgyfvyuUIKhiugF")

	data, status, err := client.Orders(retailcrm.OrdersRequest{
		Filter: retailcrm.OrdersFilter{},
		Limit: 20,
		Page: 1,
	})
	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
        }

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	for _, value := range data.Orders {
		log.Printf("%v\n", value.Email)
	}

	log.Println(data.Orders[1].FirstName)

	inventories, status, err := client.InventoriesUpload([]retailcrm.InventoryUpload{
			{
				XMLID: "pTKIKAeghYzX21HTdzFCe1",
				Stores: []retailcrm.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: []retailcrm.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 != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	log.Println(inventories.ProcessedOffersCount)
}

You can use different error types and retailcrm.AsAPIError to process client errors. Example:

package retailcrm

import (
	"errors"
	"log"
	"os"
	"strings"

	"github.com/retailcrm/api-client-go/v2"
)

func main() {
	var client = retailcrm.New("https://demo.retailcrm.pro", "09jIJ09j0JKhgyfvyuUIKhiugF")

	resp, status, err := client.APICredentials()
	if err != nil {
		apiErr, ok := retailcrm.AsAPIError(err)
		if !ok {
			log.Fatalf("http status: %d, error: %s", status, err)
		}

		switch {
		case errors.Is(apiErr, retailcrm.ErrMissingCredentials):
			log.Fatalln("No API key provided.")
		case errors.Is(apiErr, retailcrm.ErrInvalidCredentials):
			log.Fatalln("Invalid API key.")
		case errors.Is(apiErr, retailcrm.ErrAccessDenied):
			log.Fatalln("Access denied. Please check that the provided key has access to the credentials info.")
		case errors.Is(apiErr, retailcrm.ErrAccountDoesNotExist):
			log.Fatalln("There is no RetailCRM at the provided URL.")
		case errors.Is(apiErr, retailcrm.ErrMissingParameter):
			// retailcrm.APIError in this case will always contain "Name" key in the errors list with the parameter name.
			log.Fatalln("This parameter should be present:", apiErr.Errors()["Name"])
		case errors.Is(apiErr, retailcrm.ErrValidation):
			log.Println("Validation errors from the API:")

			for name, value := range apiErr.Errors() {
				log.Printf(" - %s: %s\n", name, value)
			}

			os.Exit(1)
		case errors.Is(apiErr, retailcrm.ErrGeneric):
			log.Fatalf("failure from the API. %s", apiErr.String())
		}
	}

	log.Println("Available scopes:", strings.Join(resp.Scopes, ", "))
}

Upgrading

Please check the UPGRADING.md to learn how to upgrade to the new version.

Documentation

Index

Constants

View Source
const (
	// TemplateItemTypeText is a type for text chunk in template.
	TemplateItemTypeText uint8 = iota
	// TemplateItemTypeVar is a type for variable in template.
	TemplateItemTypeVar
	QuickReply  ButtonType = "QUICK_REPLY"
	PhoneNumber ButtonType = "PHONE_NUMBER"
	URL         ButtonType = "URL"
)
View Source
const (
	// TemplateVarCustom is a custom variable type.
	TemplateVarCustom = "custom"
	// TemplateVarName is a name variable type.
	TemplateVarName = "name"
	// TemplateVarFirstName is a first name variable type.
	TemplateVarFirstName = "first_name"
	// TemplateVarLastName is a last name variable type.
	TemplateVarLastName = "last_name"
)
View Source
const ByExternalID = "externalId"

ByExternalId is "externalId" constant to use as `by` property in methods.

View Source
const ByID = "id"

ByID is "id" constant to use as `by` property in methods.

View Source
const HTTPStatusUnknown = 460

HTTPStatusUnknown can return for the method `/api/v5/customers/upload`, `/api/v5/customers-corporate/upload`, `/api/v5/orders/upload`.

Variables

View Source
var (
	// ErrMissingCredentials will be returned if no API key was provided to the API.
	ErrMissingCredentials = NewAPIError(`apiKey is missing`)
	// ErrInvalidCredentials will be returned if provided API key is invalid.
	ErrInvalidCredentials = NewAPIError(`wrong "apiKey" value`)
	// ErrAccessDenied will be returned in case of "Access denied" error.
	ErrAccessDenied = NewAPIError("access denied")
	// ErrAccountDoesNotExist will be returned if target system does not exist.
	ErrAccountDoesNotExist = NewAPIError("account does not exist")
	// ErrValidation will be returned in case of validation errors.
	ErrValidation = NewAPIError("validation error")
	// ErrMissingParameter will be returned if parameter is missing.
	// Underlying error messages list will contain parameter name in the "Name" key.
	ErrMissingParameter = NewAPIError("missing parameter")
	// ErrGeneric will be returned if error cannot be classified as one of the errors above.
	ErrGeneric = NewAPIError("API error")
)

Functions

func CreateAPIError

func CreateAPIError(dataResponse []byte) error

CreateAPIError from the provided response data. Different error types will be returned depending on the response, all of them can be matched using errors.Is. APi errors will always implement APIError interface.

Types

type APIError

type APIError interface {
	error
	fmt.Stringer

	Unwrap() error
	Errors() APIErrorsList
	// contains filtered or unexported methods
}

APIError returns when an API error was occurred.

func AsAPIError

func AsAPIError(err error) (APIError, bool)

AsAPIError returns APIError and true if provided error is an APIError or contains wrapped APIError. Returns (nil, false) otherwise.

func CreateGenericAPIError

func CreateGenericAPIError(message string) APIError

CreateGenericAPIError for the situations when API response cannot be processed, but response was actually received.

func NewAPIError

func NewAPIError(message string) APIError

NewAPIError returns API error with the provided message.

type APIErrorsList

type APIErrorsList map[string]string

APIErrorsList struct.

func (*APIErrorsList) UnmarshalJSON

func (a *APIErrorsList) UnmarshalJSON(data []byte) error

type APIKey

type APIKey struct {
	Current bool `json:"current,omitempty"`
}

APIKey type.

type AbstractDiscount added in v2.1.2

type AbstractDiscount struct {
	Type   string  `json:"type"`
	Amount float32 `json:"amount"`
}

type AccountBonusOperationsFilter added in v2.1.0

type AccountBonusOperationsFilter struct {
	CreatedAtFrom string `url:"createdAtFrom,omitempty"`
	CreatedAtTo   string `url:"createdAtTo,omitempty"`
}

type AccountBonusOperationsRequest added in v2.1.0

type AccountBonusOperationsRequest struct {
	Filter AccountBonusOperationsFilter `url:"filter,omitempty"`
	Limit  int                          `url:"limit,omitempty"`
	Page   int                          `url:"page,omitempty"`
}

AccountBonusOperationsRequest type.

type AccountBonusOperationsResponse added in v2.1.0

type AccountBonusOperationsResponse struct {
	Success         bool             `json:"success"`
	Pagination      *Pagination      `json:"pagination,omitempty"`
	BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
}

AccountBonusOperationsResponse type.

type Action

type Action struct {
	Code       string   `json:"code,omitempty"`
	URL        string   `json:"url,omitempty"`
	CallPoints []string `json:"callPoints,omitempty"`
}

Action type.

type ActionProductsGroupResponse added in v2.1.2

type ActionProductsGroupResponse struct {
	SuccessfulResponse
	ID int `json:"id"`
}

type Activity

type Activity struct {
	Active bool `json:"active"`
	Freeze bool `json:"freeze"`
}

Activity struct.

type AdditionalCode

type AdditionalCode struct {
	Code   string `json:"code,omitempty"`
	UserID string `json:"userId,omitempty"`
}

AdditionalCode type.

type Address

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"`
	Floor      int    `json:"floor,omitempty"`
	Block      int    `json:"block,omitempty"`
	House      string `json:"house,omitempty"`
	Housing    string `json:"housing,omitempty"`
	Metro      string `json:"metro,omitempty"`
	Notes      string `json:"notes,omitempty"`
	Text       string `json:"text,omitempty"`
}

Address type.

type Attachment

type Attachment struct {
	Customer *Customer `json:"customer,omitempty"`
	Order    *Order    `json:"order,omitempty"`
}

Attachment type.

type BaseProduct added in v2.1.2

type BaseProduct struct {
	Name         string      `json:"name,omitempty"`
	Type         ProductType `json:"type,omitempty"`
	URL          string      `json:"url,omitempty"`
	Article      string      `json:"article,omitempty"`
	ExternalID   string      `json:"externalId,omitempty"`
	Manufacturer string      `json:"manufacturer,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"`
	Markable     bool        `json:"markable,omitempty"`
}

BaseProduct type.

type BasicLogger

type BasicLogger interface {
	Printf(string, ...interface{})
}

BasicLogger provides basic functionality for logging.

func DebugLoggerAdapter

func DebugLoggerAdapter(logger DebugLogger) BasicLogger

DebugLoggerAdapter returns BasicLogger that calls underlying DebugLogger.Debugf.

type BillingInfo added in v2.0.4

type BillingInfo struct {
	Price             float64              `json:"price,omitempty"`
	PriceWithDiscount float64              `json:"priceWithDiscount,omitempty"`
	BillingType       string               `json:"billingType,omitempty"`
	Currency          *BillingInfoCurrency `json:"currency,omitempty"`
}

type BillingInfoCurrency added in v2.0.4

type BillingInfoCurrency struct {
	Name      string `json:"name,omitempty"`
	ShortName string `json:"shortName,omitempty"`
	Code      string `json:"code,omitempty"`
}

type BonusDetail added in v2.1.2

type BonusDetail struct {
	Date   string  `json:"date"`
	Amount float32 `json:"amount"`
}

type BonusOperation added in v2.1.0

type BonusOperation struct {
	Type           string                  `json:"type,omitempty"`
	CreatedAt      string                  `json:"createdAt,omitempty"`
	Amount         float32                 `json:"amount,omitempty"`
	Order          OperationOrder          `json:"order"`
	Bonus          OperationBonus          `json:"bonus"`
	Event          OperationEvent          `json:"event"`
	LoyaltyAccount OperationLoyaltyAccount `json:"loyaltyAccount"`
	Loyalty        OperationLoyalty        `json:"loyalty"`
}

BonusOperation struct.

type BonusOperationsFilter added in v2.1.0

type BonusOperationsFilter struct {
	Loyalties []int `url:"loyalties,omitempty,brackets"`
}

BonusOperationsFilter type.

type BonusOperationsRequest added in v2.1.0

type BonusOperationsRequest struct {
	Filter BonusOperationsFilter `url:"filter,omitempty"`
	Limit  int                   `url:"limit,omitempty"`
	Cursor string                `url:"cursor,omitempty"`
}

BonusOperationsRequest type.

type BonusOperationsResponse added in v2.1.0

type BonusOperationsResponse struct {
	Success         bool              `json:"success"`
	Pagination      *CursorPagination `json:"pagination,omitempty"`
	BonusOperations []BonusOperation  `json:"bonusOperations,omitempty"`
}

BonusOperationsResponse type.

type Button added in v2.1.7

type Button struct {
	Type        ButtonType `json:"type"`
	URL         string     `json:"url,omitempty"`
	Text        string     `json:"text,omitempty"`
	PhoneNumber string     `json:"phoneNumber,omitempty"`
	Example     []string   `json:"example,omitempty"`
}

type ButtonType added in v2.1.7

type ButtonType string

type ChannelSetting added in v2.1.10

type ChannelSetting struct {
	Site        string `json:"site"`
	OrderType   string `json:"order_type"`
	OrderMethod string `json:"order_method"`
}

type Client

type Client struct {
	URL   string
	Key   string
	Debug bool
	// contains filtered or unexported fields
}

Client type.

func New

func New(url string, key string) *Client

New initialize client.

func (*Client) APICredentials

func (c *Client) APICredentials() (CredentialResponse, int, error)

APICredentials get all available API methods for exact account

For more information see https://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-credentials

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.APICredentials()

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Scopes {
	log.Printf("%v\n", value)
}

func (*Client) APISystemInfo added in v2.0.5

func (c *Client) APISystemInfo() (SystemInfoResponse, int, error)

APISystemInfo get info about system

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-system-info

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.APISystemInfo()

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

log.Printf("%v\n", data)

func (*Client) APIVersions

func (c *Client) APIVersions() (VersionResponse, int, error)

APIVersions get all available API versions for exact account

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-api-versions

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.APIVersions()

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.versions {
	log.Printf("%v\n", value)
}

func (*Client) AccountBonusOperations added in v2.1.0

func (c *Client) AccountBonusOperations(id int, parameters AccountBonusOperationsRequest) (BonusOperationsResponse, int, error)

AccountBonusOperations returns history of the bonus account for a specific participation

For more information see https://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-account-id-bonus-operations

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.AccountBonusOperations(retailcrm.AccountBonusOperationsRequest{
	Filter: AccountBonusOperationsFilter{
		CreatedAtFrom: "2012-12-12",
		CreatedAtTo: "2012-12-13",
	},
	Limit: 20,
	Page: 3,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.BonusOperations {
	log.Printf("%v\n", value)
}

func (*Client) BonusOperations added in v2.1.0

func (c *Client) BonusOperations(parameters BonusOperationsRequest) (BonusOperationsResponse, int, error)

BonusOperations returns history of the bonus account for all participations

For more information see https://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-bonus-operations

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.BonusOperations(retailcrm.BonusOperationsRequest{
	Filter: BonusOperationsFilter{
		LoyaltyId: []int{123, 456},
	},
	Limit: 20,
	Cursor: "123456",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.BonusOperations {
	log.Printf("%v\n", value)
}

func (*Client) ClientIdsUpload added in v2.1.11

func (c *Client) ClientIdsUpload(clientIds []ClientID) (ClientIDResponse, int, error)

ClientIdsUpload uploading of web analytics clientId

For more information see https://docs.simla.com/Developers/API/APIVersions/APIv5#post--api-v5-web-analytics-client-ids-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.ClientIdsUpload([]retailcrm.ClientID{
	{
		Value:    "value",
		Order:    LinkedOrder{ID: 10, ExternalID: "externalID", Number: "number"},
		Customer: SerializedEntityCustomer{ID: 10, ExternalID: "externalID"},
		Site: "site",
	},
	{
		Value:    "value",
		Order:    LinkedOrder{ID: 12, ExternalID: "externalID2", Number: "number2"},
		Customer: SerializedEntityCustomer{ID: 12, ExternalID: "externalID2"},
		Site: "site2",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Println("Upload is successful")
}

func (*Client) CorporateCustomer

func (c *Client) CorporateCustomer(id, by, site string) (CorporateCustomerResponse, int, error)

CorporateCustomer returns information about corporate customer

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate-externalId

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomer(12, retailcrm.ByExternalID, "")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.CorporateCustomer)
}

func (*Client) CorporateCustomerAddresses

func (c *Client) CorporateCustomerAddresses(
	id string, parameters CorporateCustomerAddressesRequest,
) (CorporateCustomersAddressesResponse, int, error)

CorporateCustomerAddresses returns information about corporate customer addresses

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate-externalId-addresses

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerAddresses("ext-id", retailcrm.CorporateCustomerAddressesRequest{
	Filter: v5,CorporateCustomerAddressesFilter{
		Name: "Main Address",
	},
	By:    retailcrm.ByExternalID,
	Site:  "site",
	Limit: 20,
	Page:  1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Addresses)
}

func (*Client) CorporateCustomerAddressesCreate

func (c *Client) CorporateCustomerAddressesCreate(
	id string, by string, address CorporateCustomerAddress, site ...string,
) (CreateResponse, int, error)

CorporateCustomerAddressesCreate creates corporate customer address

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-addresses-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerAddressesCreate("ext-id", retailcrm.ByExternalID, retailcrm.CorporateCustomerAddress{
	Text: "this is new address",
	Name: "New Address",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	fmt.Printf("%v", data.ID)
}

func (*Client) CorporateCustomerAddressesEdit

func (c *Client) CorporateCustomerAddressesEdit(
	customerID, customerBy, entityBy string, address CorporateCustomerAddress, site ...string,
) (CreateResponse, int, error)

CorporateCustomerAddressesEdit edit exact corporate customer address

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-addresses-entityExternalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerAddressesEdit(
	"customer-ext-id",
	retailcrm.ByExternalID,
	retailcrm.ByExternalID,
	CorporateCustomerAddress{
		ExternalID: "addr-ext-id",
		Name:       "Main Address 2",
	},
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Customer)
}

func (*Client) CorporateCustomerCompanies

func (c *Client) CorporateCustomerCompanies(
	id string, parameters IdentifiersPairRequest,
) (CorporateCustomerCompaniesResponse, int, error)

CorporateCustomerCompanies returns information about corporate customer companies

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate-externalId-companies

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerCompanies("ext-id", retailcrm.IdentifiersPairRequest{
	Filter: v5,IdentifiersPairFilter{
		Ids: []string{"1"},
	},
	By:    retailcrm.ByExternalID,
	Site:  "site",
	Limit: 20,
	Page:  1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Companies)
}

func (*Client) CorporateCustomerCompaniesCreate

func (c *Client) CorporateCustomerCompaniesCreate(
	id string, by string, company Company, site ...string,
) (CreateResponse, int, error)

CorporateCustomerCompaniesCreate creates corporate customer company

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-companies-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerCompaniesCreate("ext-id", retailcrm.ByExternalID, retailcrm.Company{
	Name: "Company name",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	fmt.Printf("%v", data.ID)
}

func (*Client) CorporateCustomerCompaniesEdit

func (c *Client) CorporateCustomerCompaniesEdit(
	customerID, customerBy, entityBy string, company Company, site ...string,
) (CreateResponse, int, error)

CorporateCustomerCompaniesEdit edit exact corporate customer company

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-companies-entityExternalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerCompaniesEdit(
	"customer-ext-id",
	retailcrm.ByExternalID,
	retailcrm.ByExternalID,
	Company{
		ExternalID: "company-ext-id",
		Name:       "New Company Name",
	},
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) CorporateCustomerContacts

func (c *Client) CorporateCustomerContacts(
	id string, parameters IdentifiersPairRequest,
) (CorporateCustomerContactsResponse, int, error)

CorporateCustomerContacts returns information about corporate customer contacts

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate-externalId-contacts

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerContacts("ext-id", retailcrm.IdentifiersPairRequest{
	Filter: retailcrm.IdentifiersPairFilter{
		Ids: []string{"1"},
	},
	By:    retailcrm.ByExternalID,
	Site:  "site",
	Limit: 20,
	Page:  1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Contacts)
}

func (*Client) CorporateCustomerContactsCreate

func (c *Client) CorporateCustomerContactsCreate(
	id string, by string, contact CorporateCustomerContact, site ...string,
) (CreateResponse, int, error)

CorporateCustomerContactsCreate creates corporate customer contact

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-contacts-create

Example (customer with specified id or externalId should exist in specified site):

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerContactsCreate("ext-id", retailcrm.ByExternalID, retailcrm.CorporateCustomerContact{
	IsMain: false,
	Customer: retailcrm.CorporateCustomerContactCustomer{
		ExternalID: "external_id",
		Site:       "site",
	},
	Companies: []IdentifiersPair{},
}, "site")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	fmt.Printf("%v", data.ID)
}

func (*Client) CorporateCustomerContactsEdit

func (c *Client) CorporateCustomerContactsEdit(
	customerID, customerBy, entityBy string, contact CorporateCustomerContact, site ...string,
) (CreateResponse, int, error)

CorporateCustomerContactsEdit edit exact corporate customer contact

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-contacts-entityExternalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := c.CorporateCustomerContactsEdit("ext-id", retailcrm.ByExternalID, retailcrm.ByID, retailcrm.CorporateCustomerContact{
	IsMain: false,
	Customer: retailcrm.CorporateCustomerContactCustomer{
		ID: 2350,
	},
}, "site")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) CorporateCustomerCreate

func (c *Client) CorporateCustomerCreate(customer CorporateCustomer, site ...string) (
	CorporateCustomerChangeResponse, int, error,
)

CorporateCustomerCreate creates corporate customer

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerCreate(retailcrm.CorporateCustomer{
	Nickname:  "Company",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	fmt.Printf("%v", data.ID)
}

func (*Client) CorporateCustomerEdit

func (c *Client) CorporateCustomerEdit(customer CorporateCustomer, by string, site ...string) (
	CustomerChangeResponse, int, error,
)

CorporateCustomerEdit edit exact corporate customer

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-externalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerEdit(
	retailcrm.CorporateCustomer{
		FirstName:  "Ivan",
		LastName:   "Ivanov",
		Patronymic: "Ivanovich",
		ID: 		1,
		Email:      "ivanov@example.com",
	},
	retailcrm.ByID,
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Customer)
}

func (*Client) CorporateCustomerNoteCreate

func (c *Client) CorporateCustomerNoteCreate(note CorporateCustomerNote, site ...string) (CreateResponse, int, error)

CorporateCustomerNoteCreate creates corporate customer note

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-notes-create

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

	data, status, err := client.CorporateCustomerNoteCreate(retailcrm.CorporateCustomerNote{
		Text:  "text",
     Customer: &retailcrm.IdentifiersPair{
			ID: 1,
		}
	})

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	if data.Success == true {
		fmt.Printf("%v", data.ID)
	}

func (*Client) CorporateCustomerNoteDelete

func (c *Client) CorporateCustomerNoteDelete(id int) (SuccessfulResponse, int, error)

CorporateCustomerNoteDelete removes note from corporate customer

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-notes-id-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomerNoteDelete(12)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CorporateCustomers

func (c *Client) CorporateCustomers(parameters CorporateCustomersRequest) (CorporateCustomersResponse, int, error)

CorporateCustomers returns list of corporate customers matched the specified filter

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomers(retailcrm.CorporateCustomersRequest{
	Filter: CorporateCustomersFilter{
		City: "Moscow",
	},
	Page: 3,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.CustomersCorporate {
	log.Printf("%v\n", value)
}

func (*Client) CorporateCustomersFixExternalIds

func (c *Client) CorporateCustomersFixExternalIds(customers []IdentifiersPair) (SuccessfulResponse, int, error)

CorporateCustomersFixExternalIds will fix corporate customers external ID's

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-fix-external-ids

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomersFixExternalIds([]retailcrm.IdentifiersPair{{
	ID:         1,
	ExternalID: 12,
}})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CorporateCustomersHistory

func (c *Client) CorporateCustomersHistory(parameters CorporateCustomersHistoryRequest) (
	CorporateCustomersHistoryResponse, int, error,
)

CorporateCustomersHistory returns corporate customer's history

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-fix-external-ids

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomersHistory(retailcrm.CorporateCustomersHistoryRequest{
	Filter: retailcrm.CorporateCustomersHistoryFilter{
		SinceID: 20,
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.History {
	log.Printf("%v\n", value)
}

func (*Client) CorporateCustomersNotes

func (c *Client) CorporateCustomersNotes(parameters CorporateCustomersNotesRequest) (
	CorporateCustomersNotesResponse, int, error,
)

CorporateCustomersNotes returns list of corporate customers notes matched the specified filter

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-customers-corporate-notes

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomersNotes(retailcrm.CorporateCustomersNotesRequest{
	Filter: CorporateCustomersNotesFilter{
		Text: "text",
	},
	Page: 3,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Notes {
	log.Printf("%v\n", value)
}

func (*Client) CorporateCustomersUpload

func (c *Client) CorporateCustomersUpload(
	customers []CorporateCustomer, site ...string,
) (CorporateCustomersUploadResponse, int, error)

CorporateCustomersUpload corporate customers batch upload

This method can return response together with error if http status is equal 460

For more information see http://help.retailcrm.pro/Developers/ApiVersion5#post--api-v5-customers-corporate-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CorporateCustomersUpload([]retailcrm.CorporateCustomer{
	{
		Nickname:  "Company",
		ExternalID: 1,
	},
	{
		Nickname:  "Company 2",
		ExternalID: 2,
	},
}}

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.UploadedCustomers)
}

func (*Client) Cost

func (c *Client) Cost(id int) (CostResponse, int, error)

Cost returns information about specified cost

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-costs-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Cost(1)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.Cost)
}

func (*Client) CostCreate

func (c *Client) CostCreate(cost CostRecord, site ...string) (CreateResponse, int, error)

CostCreate create the cost

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-costs-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostCreate(
	retailcrm.CostRecord{
		DateFrom:  "2012-12-12",
		DateTo:    "2012-12-12",
		Summ:      12,
		CostItem:  "calculation-of-costs",
		Order: Order{
			Number: "1"
		},
		Sites:    []string{"store"},
	},
	"store"
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.ID)
}

func (*Client) CostDelete

func (c *Client) CostDelete(id int) (SuccessfulResponse, int, error)

CostDelete removes cost

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-costs-id-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostDelete(1)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CostEdit

func (c *Client) CostEdit(id int, cost CostRecord, site ...string) (CreateResponse, int, error)

CostEdit edit a cost

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-costs-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostEdit(1, retailcrm.Cost{
	DateFrom:  "2012-12-12",
	DateTo:    "2018-12-13",
	Summ:      321,
	CostItem:  "seo",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.ID)
}

func (*Client) CostGroupEdit

func (c *Client) CostGroupEdit(costGroup CostGroup) (SuccessfulResponse, int, error)

CostGroupEdit edit costs groups

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-cost-groups-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostGroupEdit(retailcrm.CostGroup{
	Code:   "group-1",
	Color:  "#da5c98",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CostGroups

func (c *Client) CostGroups() (CostGroupsResponse, int, error)

CostGroups returns costs groups list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-cost-groups

func (*Client) CostItemEdit

func (c *Client) CostItemEdit(costItem CostItem) (SuccessfulResponse, int, error)

CostItemEdit edit costs items

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-cost-items-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostItemEdit(retailcrm.CostItem{
	Code:            "seo",
	Active:          false,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CostItems

func (c *Client) CostItems() (CostItemsResponse, int, error)

CostItems returns costs items list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-cost-items

func (*Client) Costs

func (c *Client) Costs(costs CostsRequest) (CostsResponse, int, error)

Costs returns costs list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-costs

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Costs(CostsRequest{
	Filter: CostsFilter{
		Ids: []string{"1","2","3"},
		MinSumm: "1000"
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Costs {
	log.Printf("%v\n", value.Summ)
}

func (*Client) CostsDelete

func (c *Client) CostsDelete(ids []int) (CostsDeleteResponse, int, error)

CostsDelete removes a cost

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-costs-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.client.CostsDelete([]int{1, 2, 3, 48, 49, 50})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("Not removed costs: %v", data.NotRemovedIds)
}

func (*Client) CostsUpload

func (c *Client) CostsUpload(cost []CostRecord) (CostsUploadResponse, int, error)

CostsUpload batch costs upload

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-costs-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostCreate([]retailcrm.CostRecord{
	{
		DateFrom:  "2012-12-12",
		DateTo:    "2012-12-12",
		Summ:      12,
		CostItem:  "calculation-of-costs",
		Order: Order{
			Number: "1"
		},
		Sites:    []string{"store"},
	},
	{
		DateFrom:  "2012-12-13",
		DateTo:    "2012-12-13",
		Summ:      13,
		CostItem:  "seo",
	}
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("Uploaded costs: %v", data.UploadedCosts)
}

func (*Client) Countries

func (c *Client) Countries() (CountriesResponse, int, error)

Countries returns list of available country codes

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-countries

func (*Client) CourierCreate

func (c *Client) CourierCreate(courier Courier) (CreateResponse, int, error)

CourierCreate creates a courier

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-couriers

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostItemEdit(retailcrm.Courier{
	Active:    true,
	Email:     "courier1@example.com",
	FirstName: "Ivan",
	LastName:  "Ivanov",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", data.ID)
}

func (*Client) CourierEdit

func (c *Client) CourierEdit(courier Courier) (SuccessfulResponse, int, error)

CourierEdit edit a courier

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-couriers-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CostItemEdit(retailcrm.Courier{
	ID:    	  1,
	Patronymic: "Ivanovich",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) Couriers

func (c *Client) Couriers() (CouriersResponse, int, error)

Couriers returns list of couriers

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-couriers

func (*Client) CreateProductsGroup added in v2.1.2

func (c *Client) CreateProductsGroup(group ProductGroup) (ActionProductsGroupResponse, int, error)

CreateProductsGroup adds a product group

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-store-product-groups-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

group := ProductGroup{
	ParentID:    125,
	Name:        "Фрукты",
	Site:        "main",
	Active:      true,
	ExternalID:  "abc22",
}

data, status, err := client.CreateProductsGroup(group)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", res.ID)
}

func (*Client) Currencies added in v2.1.11

func (c *Client) Currencies() (CurrencyResponse, int, error)

Currencies returns a list of currencies

For more information see https://docs.simla.com/Developers/API/APIVersions/APIv5#get--api-v5-reference-currencies

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Currencies()

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Currencies {
	log.Printf("%v\n", value)
}

func (*Client) CurrenciesCreate added in v2.1.11

func (c *Client) CurrenciesCreate(currency Currency) (CurrencyCreateResponse, int, error)

CurrenciesCreate create currency

For more information see https://docs.simla.com/Developers/API/APIVersions/APIv5#post--api-v5-reference-currencies-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CurrenciesCreate(retailcrm.Currency{
	Code:                    "RUB",
	IsBase:                  true,
	IsAutoConvert:           true,
	AutoConvertExtraPercent: 1,
	ManualConvertNominal:    1,
	ManualConvertValue:      1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Println("Create currency")
}

func (*Client) CurrenciesEdit added in v2.1.11

func (c *Client) CurrenciesEdit(currency Currency) (SuccessfulResponse, int, error)

CurrenciesEdit edit an currency

For more information see https://docs.simla.com/Developers/API/APIVersions/APIv5#post--api-v5-reference-currencies-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CurrenciesEdit(
	retailcrm.Currency{
		ID:                      10,
		Code:                    "RUB",
		IsBase:                  true,
		IsAutoConvert:           true,
		AutoConvertExtraPercent: 1,
		ManualConvertNominal:    1,
		ManualConvertValue:      1,
	},
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}
if data.Success == true {
	log.Println("Currency was edit")
}

func (*Client) CustomDictionaries

func (c *Client) CustomDictionaries(customDictionaries CustomDictionariesRequest) (
	CustomDictionariesResponse, int, error,
)

CustomDictionaries returns list of custom directory

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-custom-fields-dictionaries

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomDictionaries(retailcrm.CustomDictionariesRequest{
	Filter: retailcrm.CustomDictionariesFilter{
		Name: "Dictionary-1",
	},
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

for _, value := range data.CustomDictionaries {
	fmt.Printf("%v\n", value.Elements)
}

func (*Client) CustomDictionariesCreate

func (c *Client) CustomDictionariesCreate(customDictionary CustomDictionary) (CustomResponse, int, error)

CustomDictionariesCreate creates a custom dictionary

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-custom-fields-dictionaries-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomDictionariesCreate(retailcrm.CustomDictionary{
	Name: "Courier profiles",
	Code: "courier-profiles",
	Elements: []Element{
		{
			Name: "Name",
			Code: "name",
		},
		{
			Name: "Lastname",
			Code: "lastname",
		}
	},
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

If data.Success == true {
	fmt.Printf("%v", data.Code)
}

func (*Client) CustomDictionary

func (c *Client) CustomDictionary(code string) (CustomDictionaryResponse, int, error)

CustomDictionary returns information about dictionary

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-custom-fields-entity-code

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomDictionary("courier-profiles")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.CustomDictionary.Name)
}

func (*Client) CustomDictionaryEdit

func (c *Client) CustomDictionaryEdit(customDictionary CustomDictionary) (CustomResponse, int, error)

CustomDictionaryEdit edit custom dictionary

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-custom-fields-dictionaries-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomDictionaryEdit(retailcrm.CustomDictionary{
Name: "Courier profiles",
	Code: "courier-profiles",
	Elements: []Element{
		{
			Name: "Name",
			Code: "name",
		},
		{
			Name: "Lastname",
			Code: "lastname",
		}
	},
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

If data.Success == true {
	fmt.Printf("%v", data.Code)
}

func (*Client) CustomField

func (c *Client) CustomField(entity, code string) (CustomFieldResponse, int, error)

CustomField returns information about custom fields

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-custom-fields-entity-code

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomField("order", "first-order")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.CustomField)
}

func (*Client) CustomFieldEdit

func (c *Client) CustomFieldEdit(customFields CustomFields) (CustomResponse, int, error)

CustomFieldEdit list method

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-custom-fields-entity-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomFieldEdit(CustomFields{
	Code:        "first-order",
	Entity:      "order",
	DisplayArea: "delivery",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.Code)
}

func (*Client) CustomFields

func (c *Client) CustomFields(customFields CustomFieldsRequest) (CustomFieldsResponse, int, error)

CustomFields returns list of custom fields

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-custom-fields

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomFields(retailcrm.CustomFieldsRequest{
	Type: "string",
	Entity: "customer",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.CustomFields {
	fmt.Printf("%v\n", value)
}

func (*Client) CustomFieldsCreate

func (c *Client) CustomFieldsCreate(customFields CustomFields) (CustomResponse, int, error)

CustomFieldsCreate creates custom field

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-custom-fields-entity-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomFieldsCreate(CustomFields{
	Name:        "First order",
	Code:        "first-order",
	Type:        "bool",
	Entity:      "order",
	DisplayArea: "customer",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

If data.Success == true {
	log.Printf("%v", data.Code)
}

func (*Client) Customer

func (c *Client) Customer(id, by, site string) (CustomerResponse, int, error)

Customer returns information about customer

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-customers-externalId

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Customer(12, retailcrm.ByExternalID, "")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Customer)
}

func (*Client) CustomerCreate

func (c *Client) CustomerCreate(customer Customer, site ...string) (CustomerChangeResponse, int, error)

CustomerCreate creates customer

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomersCombine(retailcrm.Customer{
	FirstName:  "Ivan",
	LastName:   "Ivanov",
	Patronymic: "Ivanovich",
	ExternalID: 1,
	Email:      "ivanov@example.com",
	Address: &retailcrm.Address{
		City:     "Moscow",
		Street:   "Kutuzovsky",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	fmt.Printf("%v", data.ID)
}

func (*Client) CustomerEdit

func (c *Client) CustomerEdit(customer Customer, by string, site ...string) (CustomerChangeResponse, int, error)

CustomerEdit edit exact customer

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-externalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomerEdit(
	retailcrm.Customer{
		FirstName:  "Ivan",
		LastName:   "Ivanov",
		Patronymic: "Ivanovich",
		ID: 		1,
		Email:      "ivanov@example.com",
	},
	retailcrm.ByID,
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Customer)
}

func (*Client) CustomerNoteCreate

func (c *Client) CustomerNoteCreate(note Note, site ...string) (CreateResponse, int, error)

CustomerNoteCreate note creation

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-notes-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomerNoteCreate(retailcrm.Note{
	Text:      "some text",
	ManagerID: 12,
	Customer: &retailcrm.Customer{
		ID: 1,
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) CustomerNoteDelete

func (c *Client) CustomerNoteDelete(id int) (SuccessfulResponse, int, error)

CustomerNoteDelete remove customer related note

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-notes-id-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomerNoteDelete(12)
if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CustomerNotes

func (c *Client) CustomerNotes(parameters NotesRequest) (NotesResponse, int, error)

CustomerNotes returns customer related notes

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-customers-notes

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomerNotes(retailcrm.NotesRequest{
	Filter: retailcrm.NotesFilter{
		CustomerIds: []int{1,2,3}
	},
	Page: 1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Notes {
	log.Printf("%v\n", value)
}

func (*Client) Customers

func (c *Client) Customers(parameters CustomersRequest) (CustomersResponse, int, error)

Customers returns list of customers matched the specified filter

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-customers

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Customers(retailcrm.CustomersRequest{
	Filter: CustomersFilter{
		City: "Moscow",
	},
	Page: 3,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Customers {
	log.Printf("%v\n", value)
}

func (*Client) CustomersCombine

func (c *Client) CustomersCombine(customers []Customer, resultCustomer Customer) (SuccessfulResponse, int, error)

CustomersCombine combine given customers

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-combine

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomersCombine([]retailcrm.Customer{{ID: 1}, {ID: 2}}, Customer{ID: 3})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CustomersFixExternalIds

func (c *Client) CustomersFixExternalIds(customers []IdentifiersPair) (SuccessfulResponse, int, error)

CustomersFixExternalIds customers external ID

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-fix-external-ids

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomersFixExternalIds([]retailcrm.IdentifiersPair{{
	ID:         1,
	ExternalID: 12,
}})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) CustomersHistory

func (c *Client) CustomersHistory(parameters CustomersHistoryRequest) (CustomersHistoryResponse, int, error)

CustomersHistory returns customer's history

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-customers-history

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomersHistory(retailcrm.CustomersHistoryRequest{
	Filter: retailcrm.CustomersHistoryFilter{
		SinceID: 20,
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.History {
	log.Printf("%v\n", value)
}

func (*Client) CustomersUpload

func (c *Client) CustomersUpload(customers []Customer, site ...string) (CustomersUploadResponse, int, error)

CustomersUpload customers batch upload

This method can return response together with error if http status is equal 460

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-customers-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.CustomersUpload([]retailcrm.Customer{
	{
		FirstName:  "Ivan",
		LastName:   "Ivanov",
		Patronymic: "Ivanovich",
		ExternalID: 1,
		Email:      "ivanov@example.com",
	},
	{
		FirstName:  "Petr",
		LastName:   "Petrov",
		Patronymic: "Petrovich",
		ExternalID: 2,
		Email:      "petrov@example.com",
	},
}}

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.UploadedCustomers)
}

func (*Client) DeliveryServiceEdit

func (c *Client) DeliveryServiceEdit(deliveryService DeliveryService) (SuccessfulResponse, int, error)

DeliveryServiceEdit delivery service create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-delivery-services-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryServiceEdit(retailcrm.DeliveryService{
	Active: false,
	Code:   "delivery-1",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) DeliveryServices

func (c *Client) DeliveryServices() (DeliveryServiceResponse, int, error)

DeliveryServices returns list of delivery services

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-delivery-services

func (*Client) DeliveryShipment

func (c *Client) DeliveryShipment(id int) (DeliveryShipmentResponse, int, error)

DeliveryShipment get information about shipment

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-delivery-shipments-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryShipment(12)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.DeliveryShipment)
}

func (*Client) DeliveryShipmentCreate

func (c *Client) DeliveryShipmentCreate(
	shipment DeliveryShipment, deliveryType string, site ...string,
) (DeliveryShipmentUpdateResponse, int, error)

DeliveryShipmentCreate creates shipment

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-delivery-shipments-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryShipmentCreate(
	retailcrm.DeliveryShipment{
		Date: "2012-12-12",
		Time: retailcrm.DeliveryTime{
			From: "18:00",
			To: "20:00",
		},
		Orders: []retailcrm.Order{{Number: "12"}},
	},
	"sdek",
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) DeliveryShipmentEdit

func (c *Client) DeliveryShipmentEdit(shipment DeliveryShipment, site ...string) (
	DeliveryShipmentUpdateResponse, int, error,
)

DeliveryShipmentEdit shipment editing

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-delivery-shipments-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryShipmentEdit(retailcrm.DeliveryShipment{
	ID: "12",
	Time: retailcrm.DeliveryTime{
		From: "14:00",
		To: "18:00",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) DeliveryShipments

func (c *Client) DeliveryShipments(parameters DeliveryShipmentsRequest) (DeliveryShipmentsResponse, int, error)

DeliveryShipments returns list of shipments

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-delivery-shipments

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryShipments(retailcrm.DeliveryShipmentsRequest{
	Limit: 12,
	Filter: retailcrm.ShipmentFilter{
		DateFrom: "2012-12-12",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.DeliveryShipments {
	log.Printf("%v\n", value)
}

func (*Client) DeliveryTracking

func (c *Client) DeliveryTracking(parameters []DeliveryTrackingRequest, subcode string) (
	SuccessfulResponse, int, error,
)

DeliveryTracking updates tracking data

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-delivery-generic-subcode-tracking

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")
 t, _ := time.Parse("2006-01-02 15:04:05", "2012-12-12 12:12:12")

	data, status, err := client.DeliveryTracking(
		[]retailcrm.DeliveryTrackingRequest{{
			DeliveryID: "1",
			TrackNumber: "123",
			History: []retailcrm.DeliveryHistoryRecord{
				{
					Code: "cancel",
					UpdatedAt: t.Format(time.RFC3339),
				},
			},
		}},
		"delivery-1",
	)

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

func (*Client) DeliveryTypeEdit

func (c *Client) DeliveryTypeEdit(deliveryType DeliveryType) (SuccessfulResponse, int, error)

DeliveryTypeEdit delivery type create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-delivery-types-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.DeliveryTypeEdit(retailcrm.DeliveryType{
	Active:        false,
	Code:          "type-1",
	DefaultCost:   300,
	DefaultForCrm: false,
}

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) DeliveryTypes

func (c *Client) DeliveryTypes() (DeliveryTypesResponse, int, error)

DeliveryTypes returns list of delivery types

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-delivery-types

func (*Client) EditMGChannelTemplate added in v2.1.7

func (c *Client) EditMGChannelTemplate(req EditMGChannelTemplateRequest) (int, error)

func (*Client) EditProductsGroup added in v2.1.2

func (c *Client) EditProductsGroup(by, id, site string, group ProductGroup) (ActionProductsGroupResponse, int, error)

EditProductsGroup edits a product group

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-store-product-groups-externalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

group := ProductGroup{
	Name:        "Овощи",
	Active:      true,
	ExternalID:  "abc22",
}

data, status, err := client.EditProductsGroup("id", "125", "main", group)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", res.ID)
}

func (*Client) File

func (c *Client) File(id int) (FileResponse, int, error)

File returns a file info

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.File(112)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.File)
}

func (*Client) FileDelete

func (c *Client) FileDelete(id int) (SuccessfulResponse, int, error)

FileDelete removes file from RetailCRM

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 data, status, err := client.FileDelete(123)

 if err.Error() != "" {
	    fmt.Printf("%v", err.Error())
 }

 if status >= http.StatusBadRequest {
	    fmt.Printf("%v", err.Error())
 }

func (*Client) FileDownload

func (c *Client) FileDownload(id int) (io.ReadCloser, int, error)

FileDownload downloads file from RetailCRM

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 fileData, status, err := client.FileDownload(123)

 if err.Error() != "" {
	    fmt.Printf("%v", err.Error())
 }

 if status >= http.StatusBadRequest {
	    fmt.Printf("%v", err.Error())
 }

func (*Client) FileEdit

func (c *Client) FileEdit(id int, file File) (FileResponse, int, error)

FileEdit edits file name and relations with orders and customers in RetailCRM

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 data, status, err := client.FileEdit(123, File{Filename: "image2.jpg"})

 if err.Error() != "" {
	    fmt.Printf("%v", err.Error())
 }

 if status >= http.StatusBadRequest {
	    fmt.Printf("%v", err.Error())
 }

func (*Client) FileUpload

func (c *Client) FileUpload(reader io.Reader) (FileUploadResponse, int, error)

FileUpload uploads file to RetailCRM

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 file, err := os.Open("file.jpg")
 if err != nil {
	    fmt.Print(err)
 }

 data, status, err := client.FileUpload(file)

 if err.Error() != "" {
	    fmt.Printf("%v", err.Error())
 }

 if status >= http.StatusBadRequest {
	    fmt.Printf("%v", err.Error())
 }

func (*Client) Files

func (c *Client) Files(files FilesRequest) (FilesResponse, int, error)

Files returns files list

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-files

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Files(FilesRequest{
	Filter: FilesFilter{
		Filename: "image.jpeg",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) GetLoyalties added in v2.1.2

func (c *Client) GetLoyalties(req LoyaltiesRequest) (LoyaltiesResponse, int, error)

GetLoyalties returns list of loyalty programs

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-loyalties

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := LoyaltiesRequest{
	Filter: LoyaltyAPIFilter{
		Active: active,
		Ids:    []int{2},
		Sites:  []string{"main"},
	},
}

data, status, err := client.GetLoyalties(req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	for _, l := range data.Loyalties {
		log.Printf("%v", l.ID)
		log.Printf("%v", l.Active)
	}
}

func (*Client) GetLoyaltyByID added in v2.1.2

func (c *Client) GetLoyaltyByID(id int) (LoyaltyResponse, int, error)

GetLoyaltyByID return program of loyalty by id

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-loyalties-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.GetLoyaltyByID(2)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", res.Loyalty.ID)
	log.Printf("%v", res.Loyalty.Active)
}

func (*Client) GetOrderPlate added in v2.1.2

func (c *Client) GetOrderPlate(by, orderID, site string, plateID int) (io.ReadCloser, int, error)

GetOrderPlate receives a print form file for the order

Body of response is already closed

For more information see https://help.retailcrm.ru/api_v5_ru.html#get--api-v5-orders-externalId-plates-plateId-print

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.GetOrderPlate("id", "107", "main", 1)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data != nil {
	fileData, err := io.ReadAll(data)
	if err != nil {
		return
	}

	log.Printf("%s", fileData)
}

func (*Client) GetRequest

func (c *Client) GetRequest(urlWithParameters string, versioned ...bool) ([]byte, int, error)

GetRequest implements GET Request.

func (*Client) IntegrationModule

func (c *Client) IntegrationModule(code string) (IntegrationModuleResponse, int, error)

IntegrationModule returns integration module

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-integration-modules-code

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.IntegrationModule("moysklad3")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.IntegrationModule)
}

func (*Client) IntegrationModuleEdit

func (c *Client) IntegrationModuleEdit(integrationModule IntegrationModule) (
	IntegrationModuleEditResponse, int, error,
)

IntegrationModuleEdit integration module create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-integration-modules-code

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

name := "MS"
code := "moysklad3"

data, status, err := client.IntegrationModuleEdit(retailcrm.IntegrationModule{
	Code:            code,
	IntegrationCode: code,
	Active:          false,
	Name:            fmt.Sprintf("Integration module %s", name),
	AccountURL:      fmt.Sprintf("http://example.com/%s/account", name),
	BaseURL:         fmt.Sprintf("http://example.com/%s", name),
	ClientID:        "123",
	Logo:            "https://cdn.worldvectorlogo.com/logos/github-icon.svg",
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

if data.Success == true {
	fmt.Printf("%v\n", data.Info)
}

func (*Client) Inventories

func (c *Client) Inventories(parameters InventoriesRequest) (InventoriesResponse, int, error)

Inventories returns leftover stocks and purchasing prices

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-store-inventories

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Inventories(retailcrm.InventoriesRequest{Filter: retailcrm.InventoriesFilter{Details: 1, ProductActive: 1}, Page: 1})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Offers {
	log.Printf("%v\n", value)
}

func (*Client) InventoriesUpload

func (c *Client) InventoriesUpload(inventories []InventoryUpload, site ...string) (StoreUploadResponse, int, error)

InventoriesUpload updates the leftover stocks and purchasing prices

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-store-inventories-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.InventoriesUpload(
   []retailcrm.InventoryUpload{
	   {
		   XMLID: "pT22K9YzX21HTdzFCe1",
		   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: "JQICtiSpOV3AAfMiQB3",
		   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.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

fmt.Printf("%v\n", data.NotFoundOffers)

func (*Client) LegalEntities

func (c *Client) LegalEntities() (LegalEntitiesResponse, int, error)

LegalEntities returns list of legal entities

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-legal-entities

func (*Client) LegalEntityEdit

func (c *Client) LegalEntityEdit(legalEntity LegalEntity) (SuccessfulResponse, int, error)

LegalEntityEdit change information about legal entity

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-legal-entities-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.LegalEntityEdit(retailcrm.LegalEntity{
	Code:          "legal-entity-1",
	CertificateDate:   "2012-12-12",
}

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) LinksCreate added in v2.1.11

func (c *Client) LinksCreate(link SerializedOrderLink, site ...string) (SuccessfulResponse, int, error)

LinksCreate creates a link

For more information see https://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-links-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.LinksCreate(retailcrm.SerializedOrderLink{
	Comment:  "comment for link",
	Orders: []retailcrm.LinkedOrder{{ID: 10}, {ID: 12}},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Println("Creating a link")
}

func (*Client) ListMGChannelTemplates added in v2.1.7

func (c *Client) ListMGChannelTemplates(channelID, page, limit int) (MGChannelTemplatesResponse, int, error)

func (*Client) LoyaltyAccount added in v2.1.2

func (c *Client) LoyaltyAccount(id int) (LoyaltyAccountResponse, int, error)

LoyaltyAccount return information about client in the loyalty program

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-account-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.LoyaltyAccount(13)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", data.LoyaltyAccount.PhoneNumber)
}

func (*Client) LoyaltyAccountActivate added in v2.1.2

func (c *Client) LoyaltyAccountActivate(id int) (LoyaltyAccountActivateResponse, int, error)

LoyaltyAccountActivate activate participation in the loyalty program for client

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-loyalty-account-id-activate

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.LoyaltyAccountActivate(13)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", data.LoyaltyAccount.Active)
}

func (*Client) LoyaltyAccountCreate added in v2.1.2

func (c *Client) LoyaltyAccountCreate(site string, loyaltyAccount SerializedCreateLoyaltyAccount) (CreateLoyaltyAccountResponse, int, error)

LoyaltyAccountCreate аdd a client to the loyalty program

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-loyalty-account-create

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")
 	acc := SerializedCreateLoyaltyAccount{
		SerializedBaseLoyaltyAccount: SerializedBaseLoyaltyAccount{
			PhoneNumber:  "89151005004",
			CustomFields: []string{"dog"},
		},
		Customer: SerializedEntityCustomer{
			ID: 123,
		},
	}

	data, status, err := client.LoyaltyAccountCreate("site", acc)

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	if data.Success == true {
		log.Printf("%v", data.LoyaltyAccount.ID)
	}

func (*Client) LoyaltyAccountEdit added in v2.1.2

func (c *Client) LoyaltyAccountEdit(id int, loyaltyAccount SerializedEditLoyaltyAccount) (EditLoyaltyAccountResponse, int, error)

LoyaltyAccountEdit edit a client in the loyalty program

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-loyalty-account-id-edit

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")
 	acc := SerializedEditLoyaltyAccount{
		SerializedBaseLoyaltyAccount: SerializedBaseLoyaltyAccount{
			PhoneNumber:  "89151005004",
			CustomFields: []string{"dog"},
		},
	}

	data, status, err := client.LoyaltyAccountEdit(13, acc)

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	if data.Success == true {
		log.Printf("%v", data.LoyaltyAccount.PhoneNumber)
	}

func (*Client) LoyaltyAccounts added in v2.1.2

func (c *Client) LoyaltyAccounts(req LoyaltyAccountsRequest) (LoyaltyAccountsResponse, int, error)

LoyaltyAccounts return list of participations in the loyalty program

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-accounts

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := LoyaltyAccountsRequest{
	Filter: LoyaltyAccountAPIFilter{
		Status:      "activated",
		PhoneNumber: "89185556363",
		Ids:         []int{14},
		Level:       5,
		Loyalties:   []int{2},
		CustomerID:  "109",
	},
}

data, status, err := client.LoyaltyAccounts(req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	for _, account := range data.LoyaltyAccounts {
		log.Printf("%v", account.Status)
	}
}

func (*Client) LoyaltyBonusCredit added in v2.1.2

func (c *Client) LoyaltyBonusCredit(id int, req LoyaltyBonusCreditRequest) (LoyaltyBonusCreditResponse, int, error)

LoyaltyBonusCredit accrue bonus participation in the program of loyalty

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-loyalty-account-id-bonus-credit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := LoyaltyBonusCreditRequest{
	Amount:      120,
	ExpiredDate: "2023-11-24 12:39:37",
	Comment:     "Test",
}

data, status, err := client.LoyaltyBonusCredit(13, req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", data.LoyaltyBonus.ActivationDate)
}

func (*Client) LoyaltyBonusStatusDetails added in v2.1.2

func (c *Client) LoyaltyBonusStatusDetails(
	id int, statusType string, request LoyaltyBonusStatusDetailsRequest,
) (LoyaltyBonusDetailsResponse, int, error)

LoyaltyBonusStatusDetails get details on the bonus account

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#get--api-v5-loyalty-account-id-bonus-status-details

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := LoyaltyBonusStatusDetailsRequest{
	Limit: 20,
	Page:  3,
}

data, status, err := client.LoyaltyBonusStatusDetails(13, "waiting_activation", req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	for _, bonus := range data.Bonuses {
		log.Printf("%v", bonus.Amount)
	}
}

func (*Client) LoyaltyCalculate added in v2.1.2

func (c *Client) LoyaltyCalculate(req LoyaltyCalculateRequest) (LoyaltyCalculateResponse, int, error)

LoyaltyCalculate calculations of the maximum discount

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-loyalty-calculate

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := LoyaltyCalculateRequest{
	Site: "main",
	Order: Order{
		PrivilegeType: "loyalty_level",
		Customer: &Customer{
			ID: 123,
		},
		Items: []OrderItem{
			{
				InitialPrice: 10000,
				Quantity:     1,
				Offer:        Offer{ID: 214},
				PriceType:    &PriceType{Code: "base"},
			},
		},
	},
	Bonuses: 10,
}

data, status, err := client.LoyaltyCalculate(req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", data.Order.PrivilegeType)
	log.Printf("%v", data.Order.BonusesCreditTotal)
}

func (*Client) NotificationsSend added in v2.1.3

func (c *Client) NotificationsSend(req NotificationsSendRequest) (int, error)

NotificationsSend send a notification

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-notifications-send

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

req := retailcrm.NotificationsSendRequest{
	UserGroups: []retailcrm.UserGroupType{retailcrm.UserGroupSuperadmins},
	Type:       retailcrm.NotificationTypeInfo,
	Message:    "Hello everyone!",
}

status, err := client.NotificationsSend(req)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) Order

func (c *Client) Order(id, by, site string) (OrderResponse, int, error)

Order returns information about order

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-externalId

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Order(12, retailcrm.ByExternalID, "")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Order)
}

func (*Client) OrderCreate

func (c *Client) OrderCreate(order Order, site ...string) (OrderCreateResponse, int, error)

OrderCreate creates an order

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderCreate(retailcrm.Order{
	FirstName:  "Ivan",
	LastName:   "Ivanov",
	Patronymic: "Ivanovich",
	Email:      "ivanov@example.com",
	Items:      []retailcrm.OrderItem{{Offer: retailcrm.Offer{ID: 12}, Quantity: 5}},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) OrderEdit

func (c *Client) OrderEdit(order Order, by string, site ...string) (CreateResponse, int, error)

OrderEdit edit an order

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-externalId-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderEdit(
	retailcrm.Order{
		ID:    12,
		Items: []retailcrm.OrderItem{{Offer: retailcrm.Offer{ID: 13}, Quantity: 6}},
	},
	retailcrm.ByID,
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrderIntegrationDeliveryCancel added in v2.1.2

func (c *Client) OrderIntegrationDeliveryCancel(by string, force bool, id string) (SuccessfulResponse, int, error)

OrderIntegrationDeliveryCancel cancels of integration delivery

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-orders-externalId-delivery-cancel

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderIntegrationDeliveryCancel("externalId", false, "1001C")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v", res.Success)
}

func (*Client) OrderMethodEdit

func (c *Client) OrderMethodEdit(orderMethod OrderMethod) (SuccessfulResponse, int, error)

OrderMethodEdit order method create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-order-methods-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderMethodEdit(retailcrm.OrderMethod{
	Code:          "method-1",
	Active:        false,
	DefaultForCRM: false,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrderMethods

func (c *Client) OrderMethods() (OrderMethodsResponse, int, error)

OrderMethods returns list of order methods

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-order-methods

func (*Client) OrderPaymentCreate

func (c *Client) OrderPaymentCreate(payment Payment, site ...string) (CreateResponse, int, error)

OrderPaymentCreate creates payment

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-payments-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderPaymentCreate(retailcrm.Payment{
	Order: &retailcrm.Order{
		ID: 12,
	},
	Amount: 300,
	Type:   "cash",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) OrderPaymentDelete

func (c *Client) OrderPaymentDelete(id int) (SuccessfulResponse, int, error)

OrderPaymentDelete payment removing

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-payments-id-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderPaymentDelete(12)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrderPaymentEdit

func (c *Client) OrderPaymentEdit(payment Payment, by string, site ...string) (SuccessfulResponse, int, error)

OrderPaymentEdit edit payment

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-payments-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderPaymentEdit(
	retailcrm.Payment{
		ID:     12,
		Amount: 500,
	},
	retailcrm.ByID,
)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrderTypeEdit

func (c *Client) OrderTypeEdit(orderType OrderType) (SuccessfulResponse, int, error)

OrderTypeEdit create/edit order type

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-order-methods-code-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrderTypeEdit(retailcrm.OrderType{
	Code:          "order-type-1",
	Active:        false,
	DefaultForCRM: false,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrderTypes

func (c *Client) OrderTypes() (OrderTypesResponse, int, error)

OrderTypes return list of order types

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-order-types

func (*Client) Orders

func (c *Client) Orders(parameters OrdersRequest) (OrdersResponse, int, error)

Orders returns list of orders matched the specified filters

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Orders(retailcrm.OrdersRequest{Filter: retailcrm.OrdersFilter{City: "Moscow"}, Page: 1})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Orders {
	log.Printf("%v\n", value)
}

func (*Client) OrdersCombine

func (c *Client) OrdersCombine(technique string, order, resultOrder Order) (OperationResponse, int, error)

OrdersCombine combines given orders

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-combine

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrdersCombine("ours", retailcrm.Order{ID: 1}, retailcrm.Order{ID: 1})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrdersFixExternalIds

func (c *Client) OrdersFixExternalIds(orders []IdentifiersPair) (SuccessfulResponse, int, error)

OrdersFixExternalIds set order external ID

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-fix-external-ids

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrdersFixExternalIds(([]retailcrm.IdentifiersPair{{
	ID:         1,
	ExternalID: 12,
}})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

if data.Success == true {
	fmt.Printf("%v\n", data.ID)
}

func (*Client) OrdersHistory

func (c *Client) OrdersHistory(parameters OrdersHistoryRequest) (OrdersHistoryResponse, int, error)

OrdersHistory returns orders history

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-history

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrdersHistory(retailcrm.OrdersHistoryRequest{Filter: retailcrm.OrdersHistoryFilter{SinceID: 20}})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.History {
	log.Printf("%v\n", value)
}

func (*Client) OrdersStatuses

func (c *Client) OrdersStatuses(request OrdersStatusesRequest) (OrdersStatusesResponse, int, error)

OrdersStatuses returns orders statuses

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-statuses

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrdersStatuses(retailcrm.OrdersStatusesRequest{
	IDs:         []int{1},
	ExternalIDs: []string{"2"},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) OrdersUpload

func (c *Client) OrdersUpload(orders []Order, site ...string) (OrdersUploadResponse, int, error)

OrdersUpload batch orders uploading

This method can return response together with error if http status is equal 460

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.OrdersUpload([]retailcrm.Order{
	{
		FirstName:  "Ivan",
		LastName:   "Ivanov",
		Patronymic: "Ivanovich",
		Email:      "ivanov@example.com",
		Items:      []retailcrm.OrderItem{{Offer: retailcrm.Offer{ID: 12}, Quantity: 5}},
	},
	{
		FirstName:  "Pert",
		LastName:   "Petrov",
		Patronymic: "Petrovich",
		Email:      "petrov@example.com",
		Items:      []retailcrm.OrderItem{{Offer: retailcrm.Offer{ID: 13}, Quantity: 1}},
	}
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.UploadedOrders)
}

func (*Client) Pack

func (c *Client) Pack(id int) (PackResponse, int, error)

Pack returns a pack info

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-packs-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Pack(112)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Pack)
}

func (*Client) PackCreate

func (c *Client) PackCreate(pack Pack) (CreateResponse, int, error)

PackCreate creates a pack

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-packs-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.PackCreate(Pack{
	Store:    "store-1",
	ItemID:   12,
	Quantity: 1,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) PackDelete

func (c *Client) PackDelete(id int) (SuccessfulResponse, int, error)

PackDelete removes a pack

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-packs-id-delete

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.PackDelete(112)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) PackEdit

func (c *Client) PackEdit(pack Pack) (CreateResponse, int, error)

PackEdit edit a pack

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-orders-packs-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.PackEdit(Pack{ID: 12, Quantity: 2})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) Packs

func (c *Client) Packs(parameters PacksRequest) (PacksResponse, int, error)

Packs returns list of packs matched the specified filters

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-packs

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Packs(retailcrm.PacksRequest{Filter: retailcrm.PacksFilter{OrderID: 12}})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Packs {
	log.Printf("%v\n", value)
}

func (*Client) PacksHistory

func (c *Client) PacksHistory(parameters PacksHistoryRequest) (PacksHistoryResponse, int, error)

PacksHistory returns a history of order packing

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-orders-packs-history

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.PacksHistory(retailcrm.PacksHistoryRequest{Filter: retailcrm.OrdersHistoryFilter{SinceID: 5}})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.History {
	log.Printf("%v\n", value)
}

func (*Client) PaymentStatusEdit

func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (SuccessfulResponse, int, error)

PaymentStatusEdit payment status creation/editing

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-payment-statuses-code-edit

func (*Client) PaymentStatuses

func (c *Client) PaymentStatuses() (PaymentStatusesResponse, int, error)

PaymentStatuses returns list of payment statuses

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-payment-statuses

func (*Client) PaymentTypeEdit

func (c *Client) PaymentTypeEdit(paymentType PaymentType) (SuccessfulResponse, int, error)

PaymentTypeEdit payment type create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-payment-types-code-edit

func (*Client) PaymentTypes

func (c *Client) PaymentTypes() (PaymentTypesResponse, int, error)

PaymentTypes returns list of payment types

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-payment-types

func (*Client) PostRequest

func (c *Client) PostRequest(
	uri string,
	postData interface{},
	contType ...string,
) ([]byte, int, error)

PostRequest implements POST Request with generic body data.

func (*Client) PriceTypeEdit

func (c *Client) PriceTypeEdit(priceType PriceType) (SuccessfulResponse, int, error)

PriceTypeEdit price type create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-price-types-code-edit

func (*Client) PriceTypes

func (c *Client) PriceTypes() (PriceTypesResponse, int, error)

PriceTypes returns list of price types

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-price-types

func (*Client) PricesUpload

func (c *Client) PricesUpload(prices []OfferPriceUpload) (StoreUploadResponse, int, error)

PricesUpload updates prices

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-store-prices-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.PricesUpload([]retailcrm.OfferPriceUpload{
	{
		ID         1
		Site       "store-1"
		Prices     []PriceUpload{{Code:  "price-1"}}
	},
	{
		ID         2
		Site       "store-1"
		Prices     []PriceUpload{{Code:  "price-2"}}
	},
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

fmt.Printf("%v\n", data.NotFoundOffers)

func (*Client) ProductStatusEdit

func (c *Client) ProductStatusEdit(productStatus ProductStatus) (SuccessfulResponse, int, error)

ProductStatusEdit order item status create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-product-statuses-code-edit

func (*Client) ProductStatuses

func (c *Client) ProductStatuses() (ProductStatusesResponse, int, error)

ProductStatuses returns list of item statuses in order

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-product-statuses

func (*Client) Products

func (c *Client) Products(parameters ProductsRequest) (ProductsResponse, int, error)

Products returns list of products and SKU

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-store-products

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Products(retailcrm.ProductsRequest{
	Filter: retailcrm.ProductsFilter{
		Active:   1,
		MinPrice: 1000,
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Products {
	log.Printf("%v\n", value)
}

func (*Client) ProductsBatchCreate added in v2.1.2

func (c *Client) ProductsBatchCreate(products []ProductCreate) (ProductsBatchEditResponse, int, error)

ProductsBatchCreate perform adding products batch

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-store-products-batch-create

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 	products := []ProductCreate{{
			CatalogID: 3,
			BaseProduct: BaseProduct{
				Name:         "Product 1",
				URL:          "https://example.com/p/1",
				Article:      "p1",
				ExternalID:   "ext1",
			},
			Groups: []ProductEditGroupInput{{ID: 19}},
	}}

	data, status, err := client.ProductsBatchCreate(products)

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	if data.Success == true {
		log.Printf("%v", data.AddedProducts)
	}

func (*Client) ProductsBatchEdit added in v2.1.2

func (c *Client) ProductsBatchEdit(products []ProductEdit) (ProductsBatchEditResponse, int, error)

ProductsBatchEdit perform editing products batch

For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5#post--api-v5-store-products-batch-edit

Example:

	var client = retailcrm.New("https://demo.url", "09jIJ")

 	products := []ProductEdit{{
			CatalogID: 3,
			BaseProduct: BaseProduct{
				Name:         "Product 1",
				URL:          "https://example.com/p/1",
				Article:      "p1",
				ExternalID:   "ext1",
			},
			ID:     194,
			Site:   "second",
			Groups: []ProductEditGroupInput{{ID: 19}},
	}}

	data, status, err := client.ProductsBatchEdit(products)

	if err != nil {
		if apiErr, ok := retailcrm.AsAPIError(err); ok {
			log.Fatalf("http status: %d, %s", status, apiErr.String())
		}

		log.Fatalf("http status: %d, error: %s", status, err)
	}

	if data.Success == true {
		log.Printf("%v", data.ProcessedProductsCount)
	}

func (*Client) ProductsGroup

func (c *Client) ProductsGroup(parameters ProductsGroupsRequest) (ProductsGroupsResponse, int, error)

ProductsGroup returns list of product groups

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-store-product-groups

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.ProductsGroup(retailcrm.ProductsGroupsRequest{
	Filter: retailcrm.ProductsGroupsFilter{
		Active: 1,
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.ProductGroup {
	log.Printf("%v\n", value)
}

func (*Client) ProductsProperties

func (c *Client) ProductsProperties(parameters ProductsPropertiesRequest) (ProductsPropertiesResponse, int, error)

ProductsProperties returns list of item properties, matching the specified filters

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-store-products-properties

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.ProductsProperties(retailcrm.ProductsPropertiesRequest{
	Filter: retailcrm.ProductsPropertiesFilter{
		Sites: []string["store"],
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Properties {
	log.Printf("%v\n", value)
}

func (*Client) Segments

func (c *Client) Segments(parameters SegmentsRequest) (SegmentsResponse, int, error)

Segments returns segments

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-segments

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Segments(SegmentsRequest{
	Filter: retailcrm.SegmentsFilter{
		Ids: []int{1,2,3}
	}
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

for _, value := range data.Segments {
	fmt.Printf("%v\n", value)
}

func (*Client) Settings

func (c *Client) Settings() (SettingsResponse, int, error)

Settings returns system settings

For more information see https://help.retailcrm.pro/Developers/ApiVersion5#get--api-v5-settings

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Settings()

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

fmt.Printf("%#v\n", data)

func (*Client) SiteEdit

func (c *Client) SiteEdit(site Site) (SuccessfulResponse, int, error)

SiteEdit site create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-sites-code-edit

func (*Client) Sites

func (c *Client) Sites() (SitesResponse, int, error)

Sites returns the sites list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-sites

func (*Client) SourcesUpload added in v2.1.11

func (c *Client) SourcesUpload(sources []Source) (SourcesResponse, int, error)

SourcesUpload uploading of sources

For more information see https://docs.simla.com/Developers/API/APIVersions/APIv5#post--api-v5-web-analytics-sources-upload

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.SourcesUpload([]retailcrm.Source{
	{
		Source:   "source",
		Medium:   "medium",
		Campaign: "campaign",
		Keyword:  "keyword",
		Content:  "content",
		ClientID: "10",
		Order:    LinkedOrder{ID: 10, ExternalID: "externalId", Number: "number"},
		Customer: SerializedEntityCustomer{ID: 10, ExternalID: "externalId"},
		Site:     "site",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Println("Upload is successful!")
}

func (*Client) StaticticsUpdate

func (c *Client) StaticticsUpdate() (SuccessfulResponse, int, error)

StaticticsUpdate updates statistics

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-statistic-update

func (*Client) StatusEdit

func (c *Client) StatusEdit(st Status) (SuccessfulResponse, int, error)

StatusEdit order status create/edit

For more information see www.retailcrm.pro/docs/Developers/ApiVersion5#post--api-v5-reference-sites-code-edit.

func (*Client) StatusGroups

func (c *Client) StatusGroups() (StatusGroupsResponse, int, error)

StatusGroups returns list of order status groups

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-status-groups

func (*Client) Statuses

func (c *Client) Statuses() (StatusesResponse, int, error)

Statuses returns list of order statuses

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-statuses

func (*Client) StoreEdit

func (c *Client) StoreEdit(store Store) (SuccessfulResponse, int, error)

StoreEdit warehouse create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-stores-code-edit

func (*Client) Stores

func (c *Client) Stores() (StoresResponse, int, error)

Stores returns list of warehouses

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-stores

func (*Client) Task

func (c *Client) Task(id int) (TaskResponse, int, error)

Task returns task

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-tasks-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Task(12)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.Task)
}

func (*Client) TaskCreate

func (c *Client) TaskCreate(task Task, site ...string) (CreateResponse, int, error)

TaskCreate create a task

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-tasks-create

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Tasks(retailcrm.Task{
	Text:        "task №1",
	PerformerID: 12,
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.ID)
}

func (*Client) TaskEdit

func (c *Client) TaskEdit(task Task, site ...string) (SuccessfulResponse, int, error)

TaskEdit edit a task

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-tasks-id-edit

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Task(retailcrm.Task{
	ID:   12
	Text: "task №2",
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) Tasks

func (c *Client) Tasks(parameters TasksRequest) (TasksResponse, int, error)

Tasks returns task list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-tasks

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Tasks(retailcrm.TasksRequest{
	Filter: TasksFilter{
		DateFrom: "2012-12-12",
	},
})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Tasks {
	log.Printf("%v\n", value)
}

func (*Client) UnitEdit

func (c *Client) UnitEdit(unit Unit) (SuccessfulResponse, int, error)

UnitEdit unit create/edit

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-reference-units-code-edit

func (*Client) Units

func (c *Client) Units() (UnitsResponse, int, error)

Units returns units list

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-reference-units

func (*Client) UpdateScopes added in v2.0.6

func (c *Client) UpdateScopes(code string, request ScopesRequired) (UpdateScopesResponse, int, error)

UpdateScopes updates permissions for the API key

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-integration-modules-code-update-scopes

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.UpdateScopes("moysklad3", retailcrm.ScopesRequired{
	Scopes: []string{"scope1", "scope2"},
})

if err.Error() != "" {
	fmt.Printf("%v", err.Error())
}

if status >= http.StatusBadRequest {
	fmt.Printf("%v", err.Error())
}

if data.Success == true {
	fmt.Printf("%v\n", data.APIKey)
}

func (*Client) User

func (c *Client) User(id int) (UserResponse, int, error)

User returns information about user

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-users-id

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.User(12)

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

if data.Success == true {
	log.Printf("%v\n", data.User)
}

func (*Client) UserGroups

func (c *Client) UserGroups(parameters UserGroupsRequest) (UserGroupsResponse, int, error)

UserGroups returns list of user groups

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-user-groups

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.UserGroups(retailcrm.UserGroupsRequest{Page: 1})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Groups {
	log.Printf("%v\n", value)
}

func (*Client) UserStatus

func (c *Client) UserStatus(id int, status string) (SuccessfulResponse, int, error)

UserStatus change user status

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-users

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.UserStatus(12, "busy")

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

func (*Client) Users

func (c *Client) Users(parameters UsersRequest) (UsersResponse, int, error)

Users returns list of users matched the specified filters

For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#get--api-v5-users

Example:

var client = retailcrm.New("https://demo.url", "09jIJ")

data, status, err := client.Users(retailcrm.UsersRequest{Filter: retailcrm.UsersFilter{Active: 1}, Page: 1})

if err != nil {
	if apiErr, ok := retailcrm.AsAPIError(err); ok {
		log.Fatalf("http status: %d, %s", status, apiErr.String())
	}

	log.Fatalf("http status: %d, error: %s", status, err)
}

for _, value := range data.Users {
	log.Printf("%v\n", value)
}

func (*Client) WithLogger

func (c *Client) WithLogger(logger BasicLogger) *Client

WithLogger sets the provided logger instance into the Client.

type ClientID added in v2.1.11

type ClientID struct {
	Value    string                   `json:"value"`
	CreateAt string                   `json:"createAt,omitempty"`
	Site     string                   `json:"site,omitempty"`
	Customer SerializedEntityCustomer `json:"customer,omitempty"`
	Order    LinkedOrder              `json:"order,omitempty"`
}

ClientID type.

type ClientIDResponse added in v2.1.11

type ClientIDResponse struct {
	ErrorMsg        string            `json:"errorMsg,omitempty"`
	Errors          map[string]string `json:"errors,omitempty"`
	FailedClientIds []ClientID        `json:"failed_client_ids,omitempty"`
	Success         bool              `json:"success"`
}

ClientIDResponse type.

type CodeValueModel added in v2.1.2

type CodeValueModel struct {
	Code  string `json:"code"`
	Value string `json:"value,omitempty"`
}

type Company

type Company struct {
	ID           int              `json:"id,omitempty"`
	IsMain       bool             `json:"isMain,omitempty"`
	ExternalID   string           `json:"externalId,omitempty"`
	Active       bool             `json:"active,omitempty"`
	Name         string           `json:"name,omitempty"`
	Brand        string           `json:"brand,omitempty"`
	Site         string           `json:"site,omitempty"`
	CreatedAt    string           `json:"createdAt,omitempty"`
	Contragent   *Contragent      `json:"contragent,omitempty"`
	Address      *IdentifiersPair `json:"address,omitempty"`
	CustomFields CustomFieldMap   `json:"customFields,omitempty"`
}

type ConnectRequest added in v2.0.3

type ConnectRequest struct {
	// Token is used to verify the request. Do not use directly; use Verify instead.
	Token string `json:"token"`
	// APIKey that was generated for the module.
	APIKey string `json:"apiKey"`
	// URL of the system. Do not use directly; use SystemURL instead.
	URL string `json:"systemUrl"`
}

ConnectRequest contains information about the system connection that is requested to be created.

func (ConnectRequest) SystemURL added in v2.0.3

func (r ConnectRequest) SystemURL() string

SystemURL returns system URL from the connection request without trailing slash.

func (ConnectRequest) Verify added in v2.0.3

func (r ConnectRequest) Verify(secret string) bool

Verify returns true if connection request is legitimate. Application secret should be provided to this method.

type ConnectResponse added in v2.0.3

type ConnectResponse struct {
	SuccessfulResponse
	AccountURL string `json:"accountUrl"`
}

ConnectResponse should be returned to the one-step connection request in case of successful connection.

func NewConnectResponse added in v2.0.3

func NewConnectResponse(accountURL string) ConnectResponse

NewConnectResponse returns ConnectResponse with the provided account URL.

type ConnectionConfigResponse added in v2.0.3

type ConnectionConfigResponse struct {
	SuccessfulResponse
	Scopes      []string `json:"scopes"`
	RegisterURL string   `json:"registerUrl"`
}

ConnectionConfigResponse contains connection configuration for one-step connection.

type Contragent

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"`
}

Contragent type.

type CorporateCustomer

type CorporateCustomer struct {
	ID                 int                        `json:"id,omitempty"`
	ExternalID         string                     `json:"externalId,omitempty"`
	Nickname           string                     `json:"nickName,omitempty"`
	CreatedAt          string                     `json:"createdAt,omitempty"`
	Vip                bool                       `json:"vip,omitempty"`
	Bad                bool                       `json:"bad,omitempty"`
	CustomFields       CustomFieldMap             `json:"customFields,omitempty"`
	PersonalDiscount   float32                    `json:"personalDiscount,omitempty"`
	DiscountCardNumber string                     `json:"discountCardNumber,omitempty"`
	ManagerID          int                        `json:"managerId,omitempty"`
	Source             *Source                    `json:"source,omitempty"`
	CustomerContacts   []CorporateCustomerContact `json:"customerContacts,omitempty"`
	Companies          []Company                  `json:"companies,omitempty"`
	Addresses          []CorporateCustomerAddress `json:"addresses,omitempty"`
}

CorporateCustomer type.

type CorporateCustomerAddress

type CorporateCustomerAddress struct {
	ID           int    `json:"id,omitempty"`
	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"`
	Housing      string `json:"housing,omitempty"`
	Metro        string `json:"metro,omitempty"`
	Notes        string `json:"notes,omitempty"`
	Text         string `json:"text,omitempty"`
	ExternalID   string `json:"externalId,omitempty"`
	Name         string `json:"name,omitempty"`
}

CorporateCustomerAddress type. Address didn't inherited in order to simplify declaration.

type CorporateCustomerAddressesFilter

type CorporateCustomerAddressesFilter struct {
	Ids    []string `url:"ids,omitempty,brackets"`
	Name   string   `url:"name,omitempty"`
	City   string   `url:"city,omitempty"`
	Region string   `url:"region,omitempty"`
}

CorporateCustomerAddressesFilter type.

type CorporateCustomerAddressesRequest

type CorporateCustomerAddressesRequest struct {
	Filter CorporateCustomerAddressesFilter `url:"filter,omitempty"`
	By     string                           `url:"by,omitempty"`
	Site   string                           `url:"site,omitempty"`
	Limit  int                              `url:"limit,omitempty"`
	Page   int                              `url:"page,omitempty"`
}

CorporateCustomerAddressesRequest type.

type CorporateCustomerChangeResponse

type CorporateCustomerChangeResponse CustomerChangeResponse

CorporateCustomerChangeResponse type.

type CorporateCustomerCompaniesResponse

type CorporateCustomerCompaniesResponse struct {
	Success   bool      `json:"success"`
	Companies []Company `json:"companies"`
}

CorporateCustomerCompaniesResponse type.

type CorporateCustomerContact

type CorporateCustomerContact struct {
	IsMain    bool                             `json:"isMain,omitempty"`
	Customer  CorporateCustomerContactCustomer `json:"customer,omitempty"`
	Companies []IdentifiersPair                `json:"companies,omitempty"`
}

type CorporateCustomerContactCustomer

type CorporateCustomerContactCustomer struct {
	ID         int    `json:"id,omitempty"`
	ExternalID string `json:"externalId,omitempty"`
	BrowserID  string `json:"browserId,omitempty"`
	Site       string `json:"site,omitempty"`
}

type CorporateCustomerContactsResponse

type CorporateCustomerContactsResponse struct {
	Success  bool                       `json:"success"`
	Contacts []CorporateCustomerContact `json:"contacts"`
}

CorporateCustomerContactsResponse type.

type CorporateCustomerHistoryRecord

type CorporateCustomerHistoryRecord 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"`
	OldValue          interface{}        `json:"oldValue,omitempty"`
	NewValue          interface{}        `json:"newValue,omitempty"`
	User              *User              `json:"user,omitempty"`
	APIKey            *APIKey            `json:"apiKey,omitempty"`
	CorporateCustomer *CorporateCustomer `json:"corporateCustomer,omitempty"`
}

CorporateCustomerHistoryRecord type.

type CorporateCustomerNote

type CorporateCustomerNote struct {
	ManagerID int              `json:"managerId,omitempty"`
	Text      string           `json:"text,omitempty"`
	Customer  *IdentifiersPair `json:"customer,omitempty"`
}

CorporateCustomerNote type.

type CorporateCustomerResponse

type CorporateCustomerResponse struct {
	Success           bool               `json:"success"`
	CorporateCustomer *CorporateCustomer `json:"customerCorporate,omitempty"`
}

CorporateCustomerResponse type.

type CorporateCustomersAddressesResponse

type CorporateCustomersAddressesResponse struct {
	Success   bool                       `json:"success"`
	Addresses []CorporateCustomerAddress `json:"addresses"`
}

CorporateCustomersAddressesResponse type.

type CorporateCustomersFilter

type CorporateCustomersFilter struct {
	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"`
	ExternalIds           []string          `url:"externalIds,omitempty,brackets"`
	Name                  string            `url:"name,omitempty"`
	City                  string            `url:"city,omitempty"`
	Region                string            `url:"region,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"`
	ClassSegment          string            `url:"classSegment,omitempty"`
	DiscountCardNumber    string            `url:"discountCardNumber,omitempty"`
	Attachments           int               `url:"attachments,omitempty"`
	MinCostSumm           float32           `url:"minCostSumm,omitempty"`
	MaxCostSumm           float32           `url:"maxCostSumm,omitempty"`
	Vip                   int               `url:"vip,omitempty"`
	Bad                   int               `url:"bad,omitempty"`
	TasksCount            int               `url:"tasksCounts,omitempty"`
	Ids                   []string          `url:"ids,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"`
	FirstOrderFrom        string            `url:"firstOrderFrom,omitempty"`
	FirstOrderTo          string            `url:"firstOrderTo,omitempty"`
	LastOrderFrom         string            `url:"lastOrderFrom,omitempty"`
	LastOrderTo           string            `url:"lastOrderTo,omitempty"`
	CustomFields          map[string]string `url:"customFields,omitempty,brackets"`
}

CorporateCustomersFilter type.

type CorporateCustomersHistoryFilter

type CorporateCustomersHistoryFilter struct {
	CustomerID         int      `url:"customerId,omitempty"`
	SinceID            int      `url:"sinceId,omitempty"`
	CustomerExternalID string   `url:"customerExternalId,omitempty"`
	ContactIds         []string `url:"contactIds,omitempty,brackets"`
	StartDate          string   `url:"startDate,omitempty"`
	EndDate            string   `url:"endDate,omitempty"`
}

CorporateCustomersHistoryFilter type.

type CorporateCustomersHistoryRequest

type CorporateCustomersHistoryRequest struct {
	Filter CorporateCustomersHistoryFilter `url:"filter,omitempty"`
	Limit  int                             `url:"limit,omitempty"`
	Page   int                             `url:"page,omitempty"`
}

CorporateCustomersHistoryRequest type.

type CorporateCustomersHistoryResponse

type CorporateCustomersHistoryResponse struct {
	Success     bool                             `json:"success,omitempty"`
	GeneratedAt string                           `json:"generatedAt,omitempty"`
	History     []CorporateCustomerHistoryRecord `json:"history,omitempty"`
	Pagination  *Pagination                      `json:"pagination,omitempty"`
}

CorporateCustomersHistoryResponse type.

type CorporateCustomersNotesFilter

type CorporateCustomersNotesFilter struct {
	Ids                 []string `url:"ids,omitempty,brackets"`
	CustomerIds         []string `url:"ids,omitempty,brackets"`
	CustomerExternalIds []string `url:"customerExternalIds,omitempty,brackets"`
	ManagerIds          []string `url:"managerIds,omitempty,brackets"`
	Text                string   `url:"text,omitempty"`
	CreatedAtFrom       string   `url:"createdAtFrom,omitempty"`
	CreatedAtTo         string   `url:"createdAtTo,omitempty"`
}

CorporateCustomersNotesFilter type.

type CorporateCustomersNotesRequest

type CorporateCustomersNotesRequest struct {
	Filter CorporateCustomersNotesFilter `url:"filter,omitempty"`
	Limit  int                           `url:"limit,omitempty"`
	Page   int                           `url:"page,omitempty"`
}

CorporateCustomersNotesRequest type.

type CorporateCustomersNotesResponse

type CorporateCustomersNotesResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Notes      []Note      `json:"notes,omitempty"`
}

CorporateCustomersNotesResponse type.

type CorporateCustomersRequest

type CorporateCustomersRequest struct {
	Filter CorporateCustomersFilter `url:"filter,omitempty"`
	Limit  int                      `url:"limit,omitempty"`
	Page   int                      `url:"page,omitempty"`
}

CorporateCustomersRequest type.

type CorporateCustomersResponse

type CorporateCustomersResponse struct {
	Success            bool                `json:"success"`
	Pagination         *Pagination         `json:"pagination,omitempty"`
	CustomersCorporate []CorporateCustomer `json:"customersCorporate,omitempty"`
}

CorporateCustomersResponse type.

type CorporateCustomersUploadResponse

type CorporateCustomersUploadResponse CustomersUploadResponse

CorporateCustomersUploadResponse type.

type Cost

type Cost struct {
	Source    *Source  `json:"source,omitempty"`
	ID        int      `json:"id,omitempty"`
	DateFrom  string   `json:"dateFrom,omitempty"`
	DateTo    string   `json:"dateTo,omitempty"`
	Summ      float32  `json:"summ,omitempty"`
	CostItem  string   `json:"costItem,omitempty"`
	Comment   string   `json:"comment,omitempty"`
	CreatedAt string   `json:"createdAt,omitempty"`
	CreatedBy string   `json:"createdBy,omitempty"`
	Order     *Order   `json:"order,omitempty"`
	UserID    int      `json:"userId,omitempty"`
	Sites     []string `json:"sites,omitempty"`
}

Cost type.

type CostGroup

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"`
}

CostGroup type.

type CostGroupsResponse

type CostGroupsResponse struct {
	Success    bool        `json:"success"`
	CostGroups []CostGroup `json:"costGroups,omitempty"`
}

CostGroupsResponse type.

type CostItem

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"`
}

CostItem type.

type CostItemsResponse

type CostItemsResponse struct {
	Success   bool       `json:"success"`
	CostItems []CostItem `json:"costItems,omitempty"`
}

CostItemsResponse type.

type CostRecord

type CostRecord struct {
	Source   *Source  `json:"source,omitempty"`
	Comment  string   `json:"comment,omitempty"`
	DateFrom string   `json:"dateFrom,omitempty"`
	DateTo   string   `json:"dateTo,omitempty"`
	Summ     float32  `json:"summ,omitempty"`
	CostItem string   `json:"costItem,omitempty"`
	UserID   int      `json:"userId,omitempty"`
	Order    *Order   `json:"order,omitempty"`
	Sites    []string `json:"sites,omitempty"`
}

CostRecord type.

type CostResponse

type CostResponse struct {
	Success bool  `json:"success"`
	Cost    *Cost `json:"cost,omitempty"`
}

CostResponse type.

type CostsDeleteResponse

type CostsDeleteResponse struct {
	Success       bool  `json:"success"`
	Count         int   `json:"count,omitempty"`
	NotRemovedIds []int `json:"notRemovedIds,omitempty"`
}

CostsDeleteResponse type.

type CostsFilter

type CostsFilter struct {
	MinSumm          string   `url:"minSumm,omitempty"`
	MaxSumm          string   `url:"maxSumm,omitempty"`
	OrderNumber      string   `url:"orderNumber,omitempty"`
	Comment          string   `url:"orderNumber,omitempty"`
	Ids              []string `url:"ids,omitempty,brackets"`
	Sites            []string `url:"sites,omitempty,brackets"`
	CreatedBy        []string `url:"createdBy,omitempty,brackets"`
	CostGroups       []string `url:"costGroups,omitempty,brackets"`
	CostItems        []string `url:"costItems,omitempty,brackets"`
	Users            []string `url:"users,omitempty,brackets"`
	DateFrom         string   `url:"dateFrom,omitempty"`
	DateTo           string   `url:"dateTo,omitempty"`
	CreatedAtFrom    string   `url:"createdAtFrom,omitempty"`
	CreatedAtTo      string   `url:"createdAtTo,omitempty"`
	OrderIds         []string `url:"orderIds,omitempty,brackets"`
	OrderExternalIds []string `url:"orderIds,omitempty,brackets"`
}

CostsFilter type.

type CostsRequest

type CostsRequest struct {
	Filter CostsFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

CostsRequest type.

type CostsResponse

type CostsResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Costs      []Cost      `json:"costs,omitempty"`
}

CostsResponse type.

type CostsUploadResponse

type CostsUploadResponse struct {
	Success       bool  `json:"success"`
	UploadedCosts []int `json:"uploadedCosts,omitempty"`
}

CostsUploadResponse type.

type CountriesResponse

type CountriesResponse struct {
	Success      bool     `json:"success"`
	CountriesIso []string `json:"countriesIso,omitempty"`
}

CountriesResponse type.

type Courier

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"`
}

Courier type.

type CouriersResponse

type CouriersResponse struct {
	Success  bool      `json:"success"`
	Couriers []Courier `json:"couriers,omitempty"`
}

CouriersResponse type.

type CreateLoyaltyAccountResponse added in v2.1.2

type CreateLoyaltyAccountResponse struct {
	SuccessfulResponse
	LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
	Warnings       []string       `json:"warnings,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	Success bool `json:"success"`
	ID      int  `json:"id,omitempty"`
}

CreateResponse type.

type CredentialResponse

type CredentialResponse struct {
	Success bool `json:"success,omitempty"`
	// deprecated
	Credentials    []string `json:"credentials,omitempty"`
	Scopes         []string `json:"scopes,omitempty"`
	SiteAccess     string   `json:"siteAccess,omitempty"`
	SitesAvailable []string `json:"sitesAvailable,omitempty"`
}

CredentialResponse return available API methods.

type Currency added in v2.1.11

type Currency struct {
	Code                    string  `json:"code,omitempty"`
	ID                      int     `json:"id,omitempty"`
	ManualConvertNominal    int     `json:"manualConvertNominal,omitempty"`
	AutoConvertExtraPercent int     `json:"autoConvertExtraPercent,omitempty"`
	IsBase                  bool    `json:"isBase,omitempty"`
	IsAutoConvert           bool    `json:"isAutoConvert,omitempty"`
	ManualConvertValue      float32 `json:"manualConvertValue,omitempty"`
}

Currency type.

type CurrencyCreateResponse added in v2.1.11

type CurrencyCreateResponse struct {
	Success bool `json:"success"`
	ID      int  `json:"id,omitempty"`
}

CurrencyCreateResponse type.

type CurrencyResponse added in v2.1.11

type CurrencyResponse struct {
	Currencies []Currency `json:"currencies,omitempty"`
	Success    bool       `json:"success"`
}

CurrencyResponse type.

type CursorPagination added in v2.1.0

type CursorPagination struct {
	NextCursor string `json:"nextCursor,omitempty"`
}

CursorPagination type.

type CustomDictionariesFilter

type CustomDictionariesFilter struct {
	Name string `url:"name,omitempty"`
	Code string `url:"code,omitempty"`
}

CustomDictionariesFilter type.

type CustomDictionariesRequest

type CustomDictionariesRequest struct {
	Filter CustomDictionariesFilter `url:"filter,omitempty"`
	Limit  int                      `url:"limit,omitempty"`
	Page   int                      `url:"page,omitempty"`
}

CustomDictionariesRequest type.

type CustomDictionariesResponse

type CustomDictionariesResponse struct {
	Success            bool                `json:"success"`
	Pagination         *Pagination         `json:"pagination,omitempty"`
	CustomDictionaries *[]CustomDictionary `json:"customDictionaries,omitempty"`
}

CustomDictionariesResponse type.

type CustomDictionary

type CustomDictionary struct {
	Name     string    `json:"name,omitempty"`
	Code     string    `json:"code,omitempty"`
	Elements []Element `json:"elements,omitempty"`
}

CustomDictionary type.

type CustomDictionaryResponse

type CustomDictionaryResponse struct {
	Success          bool              `json:"success"`
	CustomDictionary *CustomDictionary `json:"CustomDictionary,omitempty"`
}

CustomDictionaryResponse type.

type CustomFieldMap added in v2.1.9

type CustomFieldMap map[string]interface{}

func (*CustomFieldMap) UnmarshalJSON added in v2.1.9

func (l *CustomFieldMap) UnmarshalJSON(data []byte) error

type CustomFieldResponse

type CustomFieldResponse struct {
	Success     bool         `json:"success"`
	CustomField CustomFields `json:"customField,omitempty"`
}

CustomFieldResponse type.

type CustomFields

type CustomFields struct {
	Name           string `json:"name,omitempty"`
	Code           string `json:"code,omitempty"`
	Required       bool   `json:"required,omitempty"`
	InFilter       bool   `json:"inFilter,omitempty"`
	InList         bool   `json:"inList,omitempty"`
	InGroupActions bool   `json:"inGroupActions,omitempty"`
	Type           string `json:"type,omitempty"`
	Entity         string `json:"entity,omitempty"`
	// Deprecated: Use DefaultTyped instead.
	Default      string      `json:"default,omitempty"`
	Ordering     int         `json:"ordering,omitempty"`
	DisplayArea  string      `json:"displayArea,omitempty"`
	ViewMode     string      `json:"viewMode,omitempty"`
	Dictionary   string      `json:"dictionary,omitempty"`
	DefaultTyped interface{} `json:"default_typed,omitempty"`
}

CustomFields type.

type CustomFieldsFilter

type CustomFieldsFilter struct {
	Name        string `url:"name,omitempty"`
	Code        string `url:"code,omitempty"`
	Type        string `url:"type,omitempty"`
	Entity      string `url:"entity,omitempty"`
	ViewMode    string `url:"viewMode,omitempty"`
	DisplayArea string `url:"displayArea,omitempty"`
}

CustomFieldsFilter type.

type CustomFieldsRequest

type CustomFieldsRequest struct {
	Filter CustomFieldsFilter `url:"filter,omitempty"`
	Limit  int                `url:"limit,omitempty"`
	Page   int                `url:"page,omitempty"`
}

CustomFieldsRequest type.

type CustomFieldsResponse

type CustomFieldsResponse struct {
	Success      bool           `json:"success"`
	Pagination   *Pagination    `json:"pagination,omitempty"`
	CustomFields []CustomFields `json:"customFields,omitempty"`
}

CustomFieldsResponse type.

type CustomResponse

type CustomResponse struct {
	Success bool   `json:"success"`
	Code    string `json:"code,omitempty"`
}

CustomResponse type.

type Customer

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,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"`
	MgCustomerID                 string         `json:"mgCustomerId,omitempty"`
	PhotoURL                     string         `json:"photoUrl,omitempty"`
	CustomFields                 CustomFieldMap `json:"customFields,omitempty"`
	Tags                         []Tag          `json:"tags,omitempty"`
}

Customer type.

type CustomerAddressWithIsMain added in v2.1.5

type CustomerAddressWithIsMain struct {
	ID         int    `json:"id"`
	ExternalID string `json:"externalId,omitempty"`
	Name       string `json:"name,omitempty"`
	IsMain     bool   `json:"isMain"`
}

type CustomerChangeResponse

type CustomerChangeResponse struct {
	Success bool   `json:"success"`
	ID      int    `json:"id,omitempty"`
	State   string `json:"state,omitempty"`
}

CustomerChangeResponse type.

type CustomerHistoryRecord

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"`
	OldValue  interface{}                `json:"oldValue,omitempty"`
	NewValue  interface{}                `json:"newValue,omitempty"`
	User      *User                      `json:"user,omitempty"`
	APIKey    *APIKey                    `json:"apiKey,omitempty"`
	Customer  *Customer                  `json:"customer,omitempty"`
	Address   *CustomerAddressWithIsMain `json:"address,omitempty"`
}

CustomerHistoryRecord type.

type CustomerRequest

type CustomerRequest struct {
	By   string `url:"by,omitempty"`
	Site string `url:"site,omitempty"`
}

CustomerRequest type.

type CustomerResponse

type CustomerResponse struct {
	Success  bool      `json:"success"`
	Customer *Customer `json:"customer,omitempty"`
}

CustomerResponse type.

type CustomersFilter

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"`
	MgCustomerID               string            `url:"mgCustomerId,omitempty"`
	CustomFields               map[string]string `url:"customFields,omitempty,brackets"`
}

CustomersFilter type.

type CustomersHistoryFilter

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"`
}

CustomersHistoryFilter type.

type CustomersHistoryRequest

type CustomersHistoryRequest struct {
	Filter CustomersHistoryFilter `url:"filter,omitempty"`
	Limit  int                    `url:"limit,omitempty"`
	Page   int                    `url:"page,omitempty"`
}

CustomersHistoryRequest type.

type CustomersHistoryResponse

type CustomersHistoryResponse struct {
	Success     bool                    `json:"success,omitempty"`
	GeneratedAt string                  `json:"generatedAt,omitempty"`
	History     []CustomerHistoryRecord `json:"history,omitempty"`
	Pagination  *Pagination             `json:"pagination,omitempty"`
}

CustomersHistoryResponse type.

type CustomersRequest

type CustomersRequest struct {
	Filter CustomersFilter `url:"filter,omitempty"`
	Limit  int             `url:"limit,omitempty"`
	Page   int             `url:"page,omitempty"`
}

CustomersRequest type.

type CustomersResponse

type CustomersResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Customers  []Customer  `json:"customers,omitempty"`
}

CustomersResponse type.

type CustomersUploadRequest

type CustomersUploadRequest struct {
	Customers []Customer `url:"customers,omitempty,brackets"`
	Site      string     `url:"site,omitempty"`
}

CustomersUploadRequest type.

type CustomersUploadResponse

type CustomersUploadResponse struct {
	Success           bool              `json:"success"`
	UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty"`
	FailedCustomers   []ExternalID      `json:"failedCustomers,omitempty"`
}

CustomersUploadResponse type.

type DebugLogger

type DebugLogger interface {
	Debugf(string, ...interface{})
}

DebugLogger can be used to easily wrap any logger with Debugf method into the BasicLogger instance.

type Delivery

type Delivery struct {
	Description           string              `json:"description,omitempty"`
	Actions               StringMap           `json:"actions,omitempty"`
	PayerType             []string            `json:"payerType,omitempty"`
	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"`
}

Delivery type.

type DeliveryDataField

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"`
}

DeliveryDataField type.

type DeliveryHistoryRecord

type DeliveryHistoryRecord struct {
	Code      string `json:"code,omitempty"`
	UpdatedAt string `json:"updatedAt,omitempty"`
	Comment   string `json:"comment,omitempty"`
}

DeliveryHistoryRecord type.

type DeliveryPaymentType added in v2.1.2

type DeliveryPaymentType struct {
	Code string `json:"code"`
	Cod  bool   `json:"cod,omitempty"`
}

type DeliveryService

type DeliveryService struct {
	Name   string `json:"name,omitempty"`
	Code   string `json:"code,omitempty"`
	Active bool   `json:"active,omitempty"`
}

DeliveryService type.

type DeliveryServiceResponse

type DeliveryServiceResponse struct {
	Success          bool                       `json:"success"`
	DeliveryServices map[string]DeliveryService `json:"deliveryServices,omitempty"`
}

DeliveryServiceResponse type.

type DeliveryShipment

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"`
	ExtraData       StringMap     `json:"extraData,omitempty"`
}

DeliveryShipment type.

type DeliveryShipmentResponse

type DeliveryShipmentResponse struct {
	Success          bool              `json:"success"`
	DeliveryShipment *DeliveryShipment `json:"deliveryShipment,omitempty"`
}

DeliveryShipmentResponse type.

type DeliveryShipmentUpdateResponse

type DeliveryShipmentUpdateResponse struct {
	Success bool   `json:"success"`
	ID      int    `json:"id,omitempty"`
	Status  string `json:"status,omitempty"`
}

DeliveryShipmentUpdateResponse type.

type DeliveryShipmentsRequest

type DeliveryShipmentsRequest struct {
	Filter ShipmentFilter `url:"filter,omitempty"`
	Limit  int            `url:"limit,omitempty"`
	Page   int            `url:"page,omitempty"`
}

DeliveryShipmentsRequest type.

type DeliveryShipmentsResponse

type DeliveryShipmentsResponse struct {
	Success           bool               `json:"success"`
	Pagination        *Pagination        `json:"pagination,omitempty"`
	DeliveryShipments []DeliveryShipment `json:"deliveryShipments,omitempty"`
}

DeliveryShipmentsResponse type.

type DeliveryStatus

type DeliveryStatus struct {
	Code            string `json:"code,omitempty"`
	Name            string `json:"name,omitempty"`
	IsEditable      bool   `json:"isEditable,omitempty"`
	IsError         bool   `json:"isError,omitempty"`
	IsPreprocessing bool   `json:"isPreprocessing,omitempty"`
}

DeliveryStatus type.

type DeliveryTime

type DeliveryTime struct {
	From   string `json:"from,omitempty"`
	To     string `json:"to,omitempty"`
	Custom string `json:"custom,omitempty"`
}

DeliveryTime type.

type DeliveryTrackingRequest

type DeliveryTrackingRequest struct {
	DeliveryID  string                  `json:"deliveryId,omitempty"`
	TrackNumber string                  `json:"trackNumber,omitempty"`
	History     []DeliveryHistoryRecord `json:"history,omitempty"`
	ExtraData   map[string]string       `json:"extraData,omitempty"`
}

DeliveryTrackingRequest type.

type DeliveryType

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"` // Deprecated, use DeliveryPaymentTypes
	DeliveryPaymentTypes []DeliveryPaymentType `json:"deliveryPaymentTypes,omitempty"`
	Currency             string                `json:"currency,omitempty"`
}

DeliveryType type.

type DeliveryTypeInfo added in v2.1.2

type DeliveryTypeInfo struct {
	ID   int    `json:"id"`
	Code string `json:"code"`
}

DeliveryTypeInfo type.

type DeliveryTypesResponse

type DeliveryTypesResponse struct {
	Success       bool                    `json:"success"`
	DeliveryTypes map[string]DeliveryType `json:"deliveryTypes,omitempty"`
}

DeliveryTypesResponse type.

type EditLoyaltyAccountResponse added in v2.1.2

type EditLoyaltyAccountResponse struct {
	SuccessfulResponse
	LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
}

type EditMGChannelTemplateRequest added in v2.1.7

type EditMGChannelTemplateRequest struct {
	Templates []MGChannelTemplate `json:"templates"`
	Removed   []int               `json:"removed"`
}

type Element

type Element struct {
	Name     string `json:"name,omitempty"`
	Code     string `json:"code,omitempty"`
	Ordering int    `json:"ordering,omitempty"`
}

Element type.

type ErrorResponse added in v2.0.3

type ErrorResponse struct {
	SuccessfulResponse
	ErrorMessage string `json:"errorMsg"`
}

ErrorResponse should be returned to the one-step connection request in case of failure.

type ExternalID added in v2.1.2

type ExternalID struct {
	ExternalID string `json:"externalId,omitempty"`
}

type ExternalPhone

type ExternalPhone struct {
	SiteCode      string `json:"siteCode,omitempty"`
	ExternalPhone string `json:"externalPhone,omitempty"`
}

ExternalPhone type.

type File

type File struct {
	ID         int          `json:"id,omitempty"`
	Filename   string       `json:"filename,omitempty"`
	Type       string       `json:"type,omitempty"`
	CreatedAt  string       `json:"createdAt,omitempty"`
	Size       int          `json:"size,omitempty"`
	Attachment []Attachment `json:"attachment,omitempty"`
}

File type.

type FileResponse

type FileResponse struct {
	Success bool  `json:"success"`
	File    *File `json:"file,omitempty"`
}

FileResponse type.

type FileUploadResponse

type FileUploadResponse struct {
	Success bool  `json:"success"`
	File    *File `json:"file,omitempty"`
}

FileUpload response.

type FilesFilter

type FilesFilter struct {
	Ids                 []int    `url:"ids,omitempty,brackets"`
	OrderIds            []int    `url:"orderIds,omitempty,brackets"`
	OrderExternalIds    []string `url:"orderExternalIds,omitempty,brackets"`
	CustomerIds         []int    `url:"customerIds,omitempty,brackets"`
	CustomerExternalIds []string `url:"customerExternalIds,omitempty,brackets"`
	CreatedAtFrom       string   `url:"createdAtFrom,omitempty"`
	CreatedAtTo         string   `url:"createdAtTo,omitempty"`
	SizeFrom            int      `url:"sizeFrom,omitempty"`
	SizeTo              int      `url:"sizeTo,omitempty"`
	Type                []string `url:"type,omitempty,brackets"`
	Filename            string   `url:"filename,omitempty"`
	IsAttached          string   `url:"isAttached,omitempty"`
	Sites               []string `url:"sites,omitempty,brackets"`
}

FilesFilter type.

type FilesRequest

type FilesRequest struct {
	Filter FilesFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

FilesRequest type.

type FilesResponse

type FilesResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Files      []File      `json:"files,omitempty"`
}

FilesResponse type.

type GeoHierarchyRow

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"`
}

GeoHierarchyRow type.

type Header struct {
	Text     *Text  `json:"text,omitempty"`
	Document *Media `json:"document,omitempty"`
	Image    *Media `json:"image,omitempty"`
	Video    *Media `json:"video,omitempty"`
}

type IdentifiersPair

type IdentifiersPair struct {
	ID         int    `json:"id,omitempty"`
	ExternalID string `json:"externalId,omitempty"`
}

IdentifiersPair type.

type IdentifiersPairFilter

type IdentifiersPairFilter struct {
	Ids         []string `url:"ids,omitempty,brackets"`
	ExternalIds []string `url:"externalIds,omitempty,brackets"`
}

IdentifiersPairFilter type.

type IdentifiersPairRequest

type IdentifiersPairRequest struct {
	Filter IdentifiersPairFilter `url:"filter,omitempty"`
	By     string                `url:"by,omitempty"`
	Site   string                `url:"site,omitempty"`
	Limit  int                   `url:"limit,omitempty"`
	Page   int                   `url:"page,omitempty"`
}

IdentifiersPairRequest type.

type IntegrationModule

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"`
	ClientID           string        `json:"clientId,omitempty"`
	BaseURL            string        `json:"baseUrl,omitempty"`
	AccountURL         string        `json:"accountUrl,omitempty"`
	AvailableCountries []string      `json:"availableCountries,omitempty"`
	Actions            StringMap     `json:"actions,omitempty"`
	Integrations       *Integrations `json:"integrations,omitempty"`
}

IntegrationModule type.

type IntegrationModuleEditResponse

type IntegrationModuleEditResponse struct {
	Success bool         `json:"success"`
	Info    ResponseInfo `json:"info,omitempty"`
}

IntegrationModuleEditResponse type.

type IntegrationModuleResponse

type IntegrationModuleResponse struct {
	Success           bool               `json:"success"`
	IntegrationModule *IntegrationModule `json:"integrationModule,omitempty"`
}

IntegrationModuleResponse type.

type Integrations

type Integrations struct {
	Telephony   *Telephony   `json:"telephony,omitempty"`
	Delivery    *Delivery    `json:"delivery,omitempty"`
	Store       *Warehouse   `json:"store,omitempty"`
	MgTransport *MgTransport `json:"mgTransport,omitempty"`
	MgBot       *MgBot       `json:"mgBot,omitempty"`
}

Integrations type.

type InventoriesFilter

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"`
}

InventoriesFilter type.

type InventoriesRequest

type InventoriesRequest struct {
	Filter InventoriesFilter `url:"filter,omitempty"`
	Limit  int               `url:"limit,omitempty"`
	Page   int               `url:"page,omitempty"`
}

InventoriesRequest type.

type InventoriesResponse

type InventoriesResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Offers     []Offer     `json:"offers,omitempty"`
}

InventoriesResponse type.

type Inventory

type Inventory struct {
	PurchasePrice float32 `json:"purchasePrice,omitempty"`
	Quantity      float32 `json:"quantity,omitempty"`
	Store         string  `json:"store,omitempty"`
}

Inventory type.

type InventoryUpload

type InventoryUpload struct {
	ID         int                    `json:"id,omitempty"`
	ExternalID string                 `json:"externalId,omitempty"`
	XMLID      string                 `json:"xmlId,omitempty"`
	Stores     []InventoryUploadStore `json:"stores,omitempty"`
}

InventoryUpload type.

type InventoryUploadStore

type InventoryUploadStore struct {
	PurchasePrice float32 `json:"purchasePrice,omitempty"`
	Available     float32 `json:"available,omitempty"`
	Code          string  `json:"code,omitempty"`
}

InventoryUploadStore type.

type LegalEntitiesResponse

type LegalEntitiesResponse struct {
	Success       bool          `json:"success"`
	LegalEntities []LegalEntity `json:"legalEntities,omitempty"`
}

LegalEntitiesResponse type.

type LegalEntity

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"`
}

LegalEntity type.

type LinkedOrder added in v2.1.11

type LinkedOrder struct {
	Number     string `json:"number,omitempty"`
	ExternalID string `json:"externalID,omitempty"`
	ID         int    `json:"id,omitempty"`
}

LinkedOrder type.

type LoyaltiesRequest added in v2.1.2

type LoyaltiesRequest struct {
	Limit  int              `url:"limit,omitempty"`
	Page   int              `url:"page,omitempty"`
	Filter LoyaltyAPIFilter `url:"filter,omitempty"`
}

type LoyaltiesResponse added in v2.1.2

type LoyaltiesResponse struct {
	SuccessfulResponse
	Pagination *Pagination `json:"pagination"`
	Loyalties  []Loyalty   `json:"loyalties,omitempty"`
}

type Loyalty added in v2.1.2

type Loyalty struct {
	ID                     int            `json:"id"`
	LoyaltyLevels          []LoyaltyLevel `json:"levels,omitempty"`
	Active                 bool           `json:"active,omitempty"`
	Blocked                bool           `json:"blocked,omitempty"`
	Name                   string         `json:"name,omitempty"`
	ConfirmSmsCharge       bool           `json:"confirmSmsCharge,omitempty"`
	ConfirmSmsRegistration bool           `json:"confirmSmsRegistration,omitempty"`
	CreatedAt              string         `json:"createdAt,omitempty"`
	ActivatedAt            string         `json:"activatedAt,omitempty"`
	DeactivatedAt          string         `json:"deactivatedAt,omitempty"`
	BlockedAt              string         `json:"blockedAt,omitempty"`
	Currency               string         `json:"currency,omitempty"`
}

Loyalty type.

type LoyaltyAPIFilter added in v2.1.2

type LoyaltyAPIFilter struct {
	Active  *int     `url:"active,omitempty"`
	Blocked *int     `url:"blocked,omitempty"`
	Ids     []int    `url:"ids,omitempty,brackets"`
	Sites   []string `url:"sites,omitempty,brackets"`
}

type LoyaltyAccount added in v2.1.2

type LoyaltyAccount struct {
	Active           bool           `json:"active"`
	ID               int            `json:"id"`
	PhoneNumber      string         `json:"phoneNumber,omitempty"`
	CardNumber       string         `json:"cardNumber,omitempty"`
	Amount           float64        `json:"amount,omitempty"`
	LoyaltyLevel     LoyaltyLevel   `json:"level,omitempty"`
	CreatedAt        string         `json:"createdAt,omitempty"`
	ActivatedAt      string         `json:"activatedAt,omitempty"`
	ConfirmedPhoneAt string         `json:"confirmedPhoneAt,omitempty"`
	LastCheckID      int            `json:"lastCheckId,omitempty"`
	CustomFields     CustomFieldMap `json:"customFields,omitempty"`
	Loyalty          Loyalty        `json:"loyalty,omitempty"`
	Customer         Customer       `json:"customer,omitempty"`
	Status           string         `json:"status,omitempty"`
	OrderSum         float64        `json:"orderSum,omitempty"`
	NextLevelSum     float64        `json:"nextLevelSum,omitempty"`
}

LoyaltyAccount type.

type LoyaltyAccountAPIFilter added in v2.1.2

type LoyaltyAccountAPIFilter struct {
	ID                 string   `url:"id,omitempty"`
	Status             string   `url:"status,,omitempty"`
	Customer           string   `url:"customer,omitempty"`
	MinOrderSum        string   `url:"minOrdersSum,omitempty"`
	MaxOrderSum        string   `url:"maxOrdersSum,omitempty"`
	MinAmount          string   `url:"minAmount,omitempty"`
	MaxAmount          string   `url:"maxAmount,omitempty"`
	PhoneNumber        string   `url:"phoneNumber,omitempty"`
	CardNumber         string   `url:"cardNumber,omitempty"`
	Ids                []int    `url:"ids,omitempty,brackets"`
	Loyalties          []int    `url:"loyalties,omitempty,brackets"`
	Sites              []string `url:"sites,omitempty,brackets"`
	Level              int      `url:"level,omitempty"`
	CreatedAtFrom      string   `url:"createdAtFrom,omitempty"`
	CreatedAtTo        string   `url:"createdAtTo,omitempty"`
	BurnDateFrom       string   `url:"burnDateFrom,omitempty"`
	BurnDateTo         string   `url:"burnDateTo,omitempty"`
	CustomFields       []string `url:"customFields,omitempty,brackets"`
	CustomerID         string   `url:"customerId,omitempty"`
	CustomerExternalID string   `url:"customerExternalId,omitempty"`
}

type LoyaltyAccountActivateResponse added in v2.1.2

type LoyaltyAccountActivateResponse struct {
	SuccessfulResponse
	LoyaltyAccount `json:"loyaltyAccount"`
	Verification   SmsVerification `json:"verification,omitempty"`
}

type LoyaltyAccountResponse added in v2.1.2

type LoyaltyAccountResponse struct {
	SuccessfulResponse
	LoyaltyAccount `json:"loyaltyAccount"`
}

type LoyaltyAccountsRequest added in v2.1.2

type LoyaltyAccountsRequest struct {
	Limit  int                     `url:"limit,omitempty"`
	Page   int                     `url:"limit,omitempty"`
	Filter LoyaltyAccountAPIFilter `url:"filter,omitempty"`
}

type LoyaltyAccountsResponse added in v2.1.2

type LoyaltyAccountsResponse struct {
	SuccessfulResponse
	Pagination      *Pagination      `json:"pagination"`
	LoyaltyAccounts []LoyaltyAccount `json:"loyaltyAccounts,omitempty"`
}

type LoyaltyBonus added in v2.1.2

type LoyaltyBonus struct {
	Amount         float32 `json:"amount"`
	ActivationDate string  `json:"activationDate"`
	ExpiredDate    string  `json:"expiredDate,omitempty"`
}

type LoyaltyBonusAPIFilterType added in v2.1.2

type LoyaltyBonusAPIFilterType struct {
	Date string `url:"date,omitempty"`
}

type LoyaltyBonusCreditRequest added in v2.1.2

type LoyaltyBonusCreditRequest struct {
	Amount         float64 `url:"amount"`
	ActivationDate string  `url:"activationDate,omitempty"`
	ExpiredDate    string  `url:"expiredDate,omitempty"`
	Comment        string  `url:"comment,omitempty"`
}

type LoyaltyBonusCreditResponse added in v2.1.2

type LoyaltyBonusCreditResponse struct {
	SuccessfulResponse
	LoyaltyBonus LoyaltyBonus `json:"loyaltyBonus"`
}

type LoyaltyBonusDetailsResponse added in v2.1.2

type LoyaltyBonusDetailsResponse struct {
	SuccessfulResponse
	Pagination `json:"pagination"`
	Statistic  LoyaltyBonusStatisticResponse `json:"statistic"`
	Bonuses    []BonusDetail                 `json:"bonuses,omitempty"`
}

type LoyaltyBonusStatisticResponse added in v2.1.2

type LoyaltyBonusStatisticResponse struct {
	TotalAmount float64 `json:"totalAmount"`
}

type LoyaltyBonusStatusDetailsRequest added in v2.1.2

type LoyaltyBonusStatusDetailsRequest struct {
	Limit  int                       `url:"limit,omitempty"`
	Page   int                       `url:"page,omitempty"`
	Filter LoyaltyBonusAPIFilterType `url:"filter,omitempty"`
}

type LoyaltyCalculateRequest added in v2.1.2

type LoyaltyCalculateRequest struct {
	Site    string
	Order   Order
	Bonuses float32
}

type LoyaltyCalculateResponse added in v2.1.2

type LoyaltyCalculateResponse struct {
	SuccessfulResponse
	Order        SerializedLoyaltyOrder `json:"order,omitempty"`
	Calculations []LoyaltyCalculation   `json:"calculations,omitempty"`
	Loyalty      SerializedLoyalty      `json:"loyalty,omitempty"`
}

type LoyaltyCalculation added in v2.1.2

type LoyaltyCalculation struct {
	PrivilegeType        string               `json:"privilegeType"`
	Discount             float32              `json:"discount"`
	CreditBonuses        float32              `json:"creditBonuses"`
	LoyaltyEventDiscount LoyaltyEventDiscount `json:"loyaltyEventDiscount,omitempty"`
	MaxChargeBonuses     float32              `json:"maxChargeBonuses,omitempty"`
	Maximum              *bool                `json:"maximum,omitempty"`
	Loyalty              SerializedLoyalty    `json:"loyalty,omitempty"`
}

type LoyaltyEventDiscount added in v2.1.2

type LoyaltyEventDiscount struct {
	ID int `json:"id"`
}

type LoyaltyItems added in v2.1.2

type LoyaltyItems struct {
	BonusesChargeTotal float32                 `json:"bonusesChargeTotal,omitempty"`
	BonusesCreditTotal float32                 `json:"bonusesCreditTotal,omitempty"`
	ID                 int                     `json:"id,omitempty"`
	ExternalIds        []CodeValueModel        `json:"externalIds,omitempty"`
	PriceType          PriceType               `json:"priceType,omitempty"`
	InitialPrice       float32                 `json:"initialPrice,omitempty"`
	Discounts          []AbstractDiscount      `json:"discounts,omitempty"`
	Prices             []OrderProductPriceItem `json:"prices,omitempty"`
	VatRate            string                  `json:"vatRate,omitempty"`
	CreatedAt          string                  `json:"createdAt"`
	Quantity           float32                 `json:"quantity"`
	Offer              Offer                   `json:"offer,omitempty"`
}

type LoyaltyLevel added in v2.1.2

type LoyaltyLevel struct {
	ID                 int     `json:"id"`
	Name               string  `json:"name"`
	Type               string  `json:"type,omitempty"`
	Sum                float64 `json:"sum,omitempty"`
	PrivilegeSize      float64 `json:"privilegeSize,omitempty"`
	PrivilegeSizePromo float64 `json:"privilegeSizePromo,omitempty"`
}

LoyaltyLevel type.

type LoyaltyResponse added in v2.1.2

type LoyaltyResponse struct {
	SuccessfulResponse
	Loyalty Loyalty `json:"loyalty"`
}

type MGChannel added in v2.1.7

type MGChannel struct {
	Type               string `json:"type"`
	Name               string `json:"name"`
	ID                 int    `json:"id"`
	ExternalID         int    `json:"externalId"`
	AllowedSendByPhone bool   `json:"allowedSendByPhone"`
	Active             bool   `json:"active"`
}

type MGChannelTemplate added in v2.1.7

type MGChannelTemplate struct {
	Channel             *MGChannel       `json:"channel,omitempty"`
	Header              *Header          `json:"header"`
	Lang                string           `json:"lang"`
	Category            string           `json:"category"`
	Code                string           `json:"code,omitempty"`
	Name                string           `json:"name"`
	Namespace           string           `json:"namespace,omitempty"`
	Footer              string           `json:"footer,omitempty"`
	VerificationStatus  string           `json:"verificationStatus,omitempty"`
	BodyTemplate        TemplateItemList `json:"template"`
	Buttons             []Button         `json:"buttons,omitempty"`
	BodyTemplateExample []string         `json:"templateExample"`
	ID                  int              `json:"id,omitempty"`
	ExternalID          int              `json:"externalId,omitempty"`
	MGChannelID         int              `json:"mgChannelId"`
	Active              bool             `json:"active"`
}

type MGChannelTemplatesResponse added in v2.1.7

type MGChannelTemplatesResponse struct {
	Pagination *Pagination         `json:"pagination"`
	Templates  []MGChannelTemplate `json:"templates"`
	SuccessfulResponse
}

type Media added in v2.1.7

type Media struct {
	Example string `json:"example,omitempty"`
}

type MgBot

type MgBot struct{}

MgBot type.

type MgInfo

type MgInfo struct {
	EndpointURL string `json:"endpointUrl"`
	Token       string `json:"token"`
}

MgInfo type.

type MgOrderCreationSettings added in v2.1.10

type MgOrderCreationSettings struct {
	Channels map[int]ChannelSetting `json:"channels"`
	Default  ChannelSetting         `json:"default"`
}

type MgSettings added in v2.1.10

type MgSettings struct {
	OrderCreation MgOrderCreationSettings `json:"order_creation"`
}

type MgTransport

type MgTransport struct {
	WebhookURL string `json:"webhookUrl,omitempty"`
}

MgTransport type.

type NonWorkingDays added in v2.1.4

type NonWorkingDays struct {
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
}

NonWorkingDays type.

type Note

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"`
}

Note type.

type NotesFilter

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"`
}

NotesFilter type.

type NotesRequest

type NotesRequest struct {
	Filter NotesFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

NotesRequest type.

type NotesResponse

type NotesResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Notes      []Note      `json:"notes,omitempty"`
}

NotesResponse type.

type NotificationType added in v2.1.3

type NotificationType string
var (
	NotificationTypeError NotificationType = "api.error"
	NotificationTypeInfo  NotificationType = "api.info"
)

type NotificationsSendRequest added in v2.1.3

type NotificationsSendRequest struct {
	UserGroups []UserGroupType  `json:"userGroups,omitempty"`
	Type       NotificationType `json:"type"`
	Message    string           `json:"message"`
	UserIDs    []string         `json:"userIds,omitempty"`
}

type Offer

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"`
	Properties    StringMap    `json:"properties,omitempty"`
	Prices        []OfferPrice `json:"prices,omitempty"`
	Images        []string     `json:"images,omitempty"`
	Unit          *Unit        `json:"unit,omitempty"`
}

Offer type.

type OfferPrice

type OfferPrice struct {
	Price     float32 `json:"price,omitempty"`
	Ordering  int     `json:"ordering,omitempty"`
	PriceType string  `json:"priceType,omitempty"`
	Currency  string  `json:"currency,omitempty"`
}

OfferPrice type.

type OfferPriceUpload

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"`
}

OfferPriceUpload type.

type OperationBonus added in v2.1.0

type OperationBonus struct {
	ActivationDate string `json:"activationDate,omitempty"`
}

OperationBonus struct.

type OperationEvent added in v2.1.0

type OperationEvent struct {
	ID   int    `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

OperationEvent struct.

type OperationLoyalty added in v2.1.0

type OperationLoyalty struct {
	ID int `json:"id,omitempty"`
}

OperationLoyalty struct.

type OperationLoyaltyAccount added in v2.1.0

type OperationLoyaltyAccount struct {
	ID int `json:"id,omitempty"`
}

OperationLoyaltyAccount struct.

type OperationOrder added in v2.1.0

type OperationOrder struct {
	ID         int    `json:"id,omitempty"`
	ExternalID string `json:"externalId,omitempty"`
}

OperationOrder struct.

type OperationResponse

type OperationResponse struct {
	Success bool              `json:"success"`
	Errors  map[string]string `json:"ErrorsList,omitempty"`
}

OperationResponse type.

type Order

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"`
	CustomFields                  CustomFieldMap    `json:"customFields,omitempty"`
	Payments                      OrderPayments     `json:"payments,omitempty"`
	ApplyRound                    *bool             `json:"applyRound,omitempty"`
	PrivilegeType                 string            `json:"privilegeType,omitempty"`
	DialogID                      int               `json:"dialogId,omitempty"`
	Links                         []OrderLink       `json:"links,omitempty"`
	Currency                      string            `json:"currency,omitempty"`
}

Order type.

type OrderCreateResponse

type OrderCreateResponse struct {
	CreateResponse
	Order Order `json:"order,omitempty"`
}

OrderCreateResponse type.

type OrderDelivery

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"`
}

OrderDelivery type.

type OrderDeliveryData

type OrderDeliveryData struct {
	OrderDeliveryDataBasic
	AdditionalFields map[string]interface{}
}

OrderDeliveryData type.

func (OrderDeliveryData) MarshalJSON

func (v OrderDeliveryData) MarshalJSON() ([]byte, error)

MarshalJSON method.

func (*OrderDeliveryData) UnmarshalJSON

func (v *OrderDeliveryData) UnmarshalJSON(b []byte) error

UnmarshalJSON method.

type OrderDeliveryDataBasic

type OrderDeliveryDataBasic struct {
	TrackNumber        string `json:"trackNumber,omitempty"`
	Status             string `json:"status,omitempty"`
	PickuppointAddress string `json:"pickuppointAddress,omitempty"`
	PayerType          string `json:"payerType,omitempty"`
}

OrderDeliveryDataBasic type.

type OrderDeliveryService

type OrderDeliveryService struct {
	Name   string `json:"name,omitempty"`
	Code   string `json:"code,omitempty"`
	Active bool   `json:"active,omitempty"`
}

OrderDeliveryService type.

type OrderDeliveryTime

type OrderDeliveryTime struct {
	From   string `json:"from,omitempty"`
	To     string `json:"to,omitempty"`
	Custom string `json:"custom,omitempty"`
}

OrderDeliveryTime type.

type OrderItem

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            Properties `json:"properties,omitempty"`
	PriceType             *PriceType `json:"priceType,omitempty"`
}

OrderItem type.

type OrderLink struct {
	Comment   string      `json:"comment,omitempty"`
	CreatedAt string      `json:"createdAt,omitempty"`
	Order     LinkedOrder `json:"order,omitempty"`
}

OrderLink type.

type OrderMarketplace

type OrderMarketplace struct {
	Code    string `json:"code,omitempty"`
	OrderID string `json:"orderId,omitempty"`
}

OrderMarketplace type.

type OrderMethod

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"`
}

OrderMethod type.

type OrderMethodsResponse

type OrderMethodsResponse struct {
	Success      bool                   `json:"success"`
	OrderMethods map[string]OrderMethod `json:"orderMethods,omitempty"`
}

OrderMethodsResponse type.

type OrderPayment

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"`
}

OrderPayment type.

type OrderPayments

type OrderPayments map[string]OrderPayment

func (*OrderPayments) UnmarshalJSON

func (p *OrderPayments) UnmarshalJSON(data []byte) error

type OrderProductPriceItem added in v2.1.2

type OrderProductPriceItem struct {
	Price    float64 `json:"price"`
	Quantity float32 `json:"quantity"`
}

type OrderRequest

type OrderRequest struct {
	By   string `url:"by,omitempty"`
	Site string `url:"site,omitempty"`
}

OrderRequest type.

type OrderResponse

type OrderResponse struct {
	Success bool   `json:"success"`
	Order   *Order `json:"order,omitempty"`
}

OrderResponse type.

type OrderType

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"`
}

OrderType type.

type OrderTypesResponse

type OrderTypesResponse struct {
	Success    bool                 `json:"success"`
	OrderTypes map[string]OrderType `json:"orderTypes,omitempty"`
}

OrderTypesResponse type.

type OrdersFilter

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"`
	DeliveryServices               []string          `url:"deliveryServices,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"`
	PaidAtFrom                     string            `url:"paidAtFrom,omitempty"`
	PaidAtTo                       string            `url:"paidAtTo,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"`
}

OrdersFilter type.

type OrdersHistoryFilter

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"`
}

OrdersHistoryFilter type.

type OrdersHistoryRecord

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"`
	OldValue   interface{} `json:"oldValue,omitempty"`
	NewValue   interface{} `json:"newValue,omitempty"`
	User       *User       `json:"user,omitempty"`
	APIKey     *APIKey     `json:"apiKey,omitempty"`
	Order      *Order      `json:"order,omitempty"`
	Ancestor   *Order      `json:"ancestor,omitempty"`
	Item       *OrderItem  `json:"item,omitempty"`
	Payment    *Payment    `json:"payment"`
	CombinedTo *Order      `json:"combinedTo,omitempty"`
}

OrdersHistoryRecord type.

type OrdersHistoryRequest

type OrdersHistoryRequest struct {
	Filter OrdersHistoryFilter `url:"filter,omitempty"`
	Limit  int                 `url:"limit,omitempty"`
	Page   int                 `url:"page,omitempty"`
}

OrdersHistoryRequest type.

type OrdersHistoryResponse

type OrdersHistoryResponse struct {
	Success     bool                  `json:"success,omitempty"`
	GeneratedAt string                `json:"generatedAt,omitempty"`
	History     []OrdersHistoryRecord `json:"history,omitempty"`
	Pagination  *Pagination           `json:"pagination,omitempty"`
}

OrdersHistoryResponse type.

type OrdersRequest

type OrdersRequest struct {
	Filter OrdersFilter `url:"filter,omitempty"`
	Limit  int          `url:"limit,omitempty"`
	Page   int          `url:"page,omitempty"`
}

OrdersRequest type.

type OrdersResponse

type OrdersResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Orders     []Order     `json:"orders,omitempty"`
}

OrdersResponse type.

type OrdersStatus

type OrdersStatus struct {
	ID         int    `json:"id"`
	ExternalID string `json:"externalId,omitempty"`
	Status     string `json:"status"`
	Group      string `json:"group"`
}

OrdersStatus type.

type OrdersStatusesRequest

type OrdersStatusesRequest struct {
	IDs         []int    `url:"ids,omitempty,brackets"`
	ExternalIDs []string `url:"externalIds,omitempty,brackets"`
}

OrdersStatusesRequest type.

type OrdersStatusesResponse

type OrdersStatusesResponse struct {
	Success bool           `json:"success"`
	Orders  []OrdersStatus `json:"orders"`
}

OrdersStatusesResponse type.

type OrdersUploadRequest

type OrdersUploadRequest struct {
	Orders []Order `url:"orders,omitempty,brackets"`
	Site   string  `url:"site,omitempty"`
}

OrdersUploadRequest type.

type OrdersUploadResponse

type OrdersUploadResponse struct {
	Success        bool              `json:"success"`
	UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty"`
	FailedOrders   []ExternalID      `json:"failedOrders,omitempty"`
}

OrdersUploadResponse type.

type Pack

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"`
	Unit               *Unit     `json:"unit,omitempty"`
}

Pack type.

type PackItem

type PackItem struct {
	ID    int    `json:"id,omitempty"`
	Order *Order `json:"order,omitempty"`
	Offer *Offer `json:"offer,omitempty"`
}

PackItem type.

type PackResponse

type PackResponse struct {
	Success bool  `json:"success"`
	Pack    *Pack `json:"pack,omitempty"`
}

PackResponse type.

type PacksFilter

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"`
}

PacksFilter type.

type PacksHistoryRecord

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"`
	OldValue  interface{} `json:"oldValue,omitempty"`
	NewValue  interface{} `json:"newValue,omitempty"`
	User      *User       `json:"user,omitempty"`
	Pack      *Pack       `json:"pack,omitempty"`
}

PacksHistoryRecord type.

type PacksHistoryRequest

type PacksHistoryRequest struct {
	Filter OrdersHistoryFilter `url:"filter,omitempty"`
	Limit  int                 `url:"limit,omitempty"`
	Page   int                 `url:"page,omitempty"`
}

PacksHistoryRequest type.

type PacksHistoryResponse

type PacksHistoryResponse struct {
	Success     bool                 `json:"success,omitempty"`
	GeneratedAt string               `json:"generatedAt,omitempty"`
	History     []PacksHistoryRecord `json:"history,omitempty"`
	Pagination  *Pagination          `json:"pagination,omitempty"`
}

PacksHistoryResponse type.

type PacksRequest

type PacksRequest struct {
	Filter PacksFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

PacksRequest type.

type PacksResponse

type PacksResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Packs      []Pack      `json:"packs,omitempty"`
}

PacksResponse type.

type Pagination

type Pagination struct {
	Limit          int `json:"limit,omitempty"`
	TotalCount     int `json:"totalCount,omitempty"`
	CurrentPage    int `json:"currentPage,omitempty"`
	TotalPageCount int `json:"totalPageCount,omitempty"`
}

Pagination type.

type Payment

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"`
}

Payment type.

type PaymentStatus

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"`
}

PaymentStatus type.

type PaymentStatusesResponse

type PaymentStatusesResponse struct {
	Success         bool                     `json:"success"`
	PaymentStatuses map[string]PaymentStatus `json:"paymentStatuses,omitempty"`
}

PaymentStatusesResponse type.

type PaymentType

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"`
	PaymentStatuses []string `json:"PaymentStatuses,omitempty"`
}

PaymentType type.

type PaymentTypesResponse

type PaymentTypesResponse struct {
	Success      bool                   `json:"success"`
	PaymentTypes map[string]PaymentType `json:"paymentTypes,omitempty"`
}

PaymentTypesResponse type.

type Phone

type Phone struct {
	Number string `json:"number,omitempty"`
}

Phone type.

type Plate

type Plate struct {
	Code  string `json:"code,omitempty"`
	Label string `json:"label,omitempty"`
}

Plate type.

type PriceType

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"`
	Geo              []GeoHierarchyRow `json:"geo,omitempty"`
	Currency         string            `json:"currency,omitempty"`
}

PriceType type.

type PriceTypesResponse

type PriceTypesResponse struct {
	Success    bool        `json:"success"`
	PriceTypes []PriceType `json:"priceTypes,omitempty"`
}

PriceTypesResponse type.

type PriceUpload

type PriceUpload struct {
	Code  string  `json:"code,omitempty"`
	Price float32 `json:"price,omitempty"`
}

PriceUpload type.

type Product

type Product struct {
	BaseProduct
	ID         int            `json:"id,omitempty"`
	Type       ProductType    `json:"type"`
	MaxPrice   float32        `json:"maxPrice,omitempty"`
	MinPrice   float32        `json:"minPrice,omitempty"`
	ImageURL   string         `json:"imageUrl,omitempty"`
	Quantity   float32        `json:"quantity,omitempty"`
	Offers     []Offer        `json:"offers,omitempty"`
	Properties StringMap      `json:"properties,omitempty"`
	Groups     []ProductGroup `json:"groups,omitempty"`
}

Product type.

type ProductCreate added in v2.1.2

type ProductCreate struct {
	BaseProduct
	Groups    []ProductEditGroupInput `json:"groups,omitempty"`
	CatalogID int                     `json:"catalogId,omitempty"`
}

ProductCreate type.

type ProductEdit added in v2.1.2

type ProductEdit struct {
	BaseProduct
	ID        int                     `json:"id,omitempty"`
	CatalogID int                     `json:"catalogId,omitempty"`
	Site      string                  `json:"site,omitempty"`
	Groups    []ProductEditGroupInput `json:"groups,omitempty"`
}

ProductEdit type.

type ProductEditGroupInput added in v2.1.2

type ProductEditGroupInput struct {
	ID         int `json:"id"`
	ExternalID int `json:"externalId,omitempty"`
}

ProductEditGroupInput type.

type ProductEditNotFoundResponse added in v2.1.2

type ProductEditNotFoundResponse struct {
	ID         string `json:"id"`
	ExternalID string `json:"externalId,omitempty"`
}

type ProductGroup

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"`
	Description      string `json:"description,omitempty"`
	ExternalID       string `json:"externalId,omitempty"`
	ParentExternalID string `json:"parentExternalId,omitempty"`
}

ProductGroup type.

type ProductStatus

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"`
}

ProductStatus type.

type ProductStatusesResponse

type ProductStatusesResponse struct {
	Success         bool                     `json:"success"`
	ProductStatuses map[string]ProductStatus `json:"productStatuses,omitempty"`
}

ProductStatusesResponse type.

type ProductType added in v2.1.12

type ProductType string
const (
	RegularProduct ProductType = "product"
	ServiceProduct ProductType = "service"
)

type ProductsBatchCreateResponse added in v2.1.2

type ProductsBatchCreateResponse struct {
	SuccessfulResponse
	ProcessedProductsCount int   `json:"processedProductsCount,omitempty"`
	AddedProducts          []int `json:"addedProducts,omitempty"`
}

type ProductsBatchEditResponse added in v2.1.2

type ProductsBatchEditResponse struct {
	SuccessfulResponse
	ProcessedProductsCount int                           `json:"processedProductsCount,omitempty"`
	NotFoundProducts       []ProductEditNotFoundResponse `json:"notFoundProducts,omitempty"`
}

type ProductsFilter

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"`
}

ProductsFilter type.

type ProductsGroupsFilter

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"`
}

ProductsGroupsFilter type.

type ProductsGroupsRequest

type ProductsGroupsRequest struct {
	Filter ProductsGroupsFilter `url:"filter,omitempty"`
	Limit  int                  `url:"limit,omitempty"`
	Page   int                  `url:"page,omitempty"`
}

ProductsGroupsRequest type.

type ProductsGroupsResponse

type ProductsGroupsResponse struct {
	Success      bool           `json:"success"`
	Pagination   *Pagination    `json:"pagination,omitempty"`
	ProductGroup []ProductGroup `json:"productGroup,omitempty"`
}

ProductsGroupsResponse type.

type ProductsPropertiesFilter

type ProductsPropertiesFilter struct {
	Code  string   `url:"code,omitempty"`
	Name  string   `url:"name,omitempty"`
	Sites []string `url:"sites,omitempty,brackets"`
}

ProductsPropertiesFilter type.

type ProductsPropertiesRequest

type ProductsPropertiesRequest struct {
	Filter ProductsPropertiesFilter `url:"filter,omitempty"`
	Limit  int                      `url:"limit,omitempty"`
	Page   int                      `url:"page,omitempty"`
}

ProductsPropertiesRequest type.

type ProductsPropertiesResponse

type ProductsPropertiesResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Properties []Property  `json:"properties,omitempty"`
}

ProductsPropertiesResponse type.

type ProductsRequest

type ProductsRequest struct {
	Filter ProductsFilter `url:"filter,omitempty"`
	Limit  int            `url:"limit,omitempty"`
	Page   int            `url:"page,omitempty"`
}

ProductsRequest type.

type ProductsResponse

type ProductsResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Products   []Product   `json:"products,omitempty"`
}

ProductsResponse type.

type Properties added in v2.0.2

type Properties map[string]Property

func (*Properties) UnmarshalJSON added in v2.0.2

func (p *Properties) UnmarshalJSON(data []byte) error

type Property

type Property struct {
	Code  string   `json:"code,omitempty"`
	Name  string   `json:"name,omitempty"`
	Value string   `json:"value,omitempty"`
	Sites []string `json:"Sites,omitempty"`
}

Property type.

type ResponseInfo

type ResponseInfo struct {
	MgTransportInfo  MgInfo           `json:"mgTransport,omitempty"`
	MgBotInfo        MgInfo           `json:"mgBot,omitempty"`
	BillingInfo      *BillingInfo     `json:"billingInfo,omitempty"`
	DeliveryTypeInfo DeliveryTypeInfo `json:"deliveryType,omitempty"`
}

ResponseInfo type.

type ScopesRequired added in v2.0.6

type ScopesRequired struct {
	Scopes []string `json:"scopes"`
}

type Segment

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"`
}

Segment type.

type SegmentsFilter

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"`
}

SegmentsFilter type.

type SegmentsRequest

type SegmentsRequest struct {
	Filter SegmentsFilter `url:"filter,omitempty"`
	Limit  int            `url:"limit,omitempty"`
	Page   int            `url:"page,omitempty"`
}

SegmentsRequest type.

type SegmentsResponse

type SegmentsResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Segments   []Segment   `json:"segments,omitempty"`
}

SegmentsResponse type.

type SerializedBaseLoyaltyAccount added in v2.1.2

type SerializedBaseLoyaltyAccount struct {
	PhoneNumber  string        `json:"phoneNumber,omitempty"`
	CardNumber   string        `json:"cardNumber,omitempty"`
	CustomFields []interface{} `json:"customFields,omitempty"`
}

type SerializedCreateLoyaltyAccount added in v2.1.2

type SerializedCreateLoyaltyAccount struct {
	SerializedBaseLoyaltyAccount
	Customer SerializedEntityCustomer `json:"customer"`
}

type SerializedEditLoyaltyAccount added in v2.1.2

type SerializedEditLoyaltyAccount struct {
	SerializedBaseLoyaltyAccount
}

type SerializedEntityCustomer added in v2.1.2

type SerializedEntityCustomer struct {
	ID         int    `json:"id,omitempty"`
	ExternalID string `json:"externalId,omitempty"`
}

type SerializedLoyalty added in v2.1.2

type SerializedLoyalty struct {
	Name       string  `json:"name"`
	ChargeRate float32 `json:"chargeRate"`
}

type SerializedLoyaltyOrder added in v2.1.2

type SerializedLoyaltyOrder struct {
	BonusesCreditTotal      float32              `json:"bonusesCreditTotal,omitempty"`
	BonusesChargeTotal      float32              `json:"bonusesChargeTotal,omitempty"`
	PrivilegeType           string               `json:"privilegeType,omitempty"`
	TotalSumm               float64              `json:"totalSumm,omitempty"`
	PersonalDiscountPercent float32              `json:"personalDiscountPercent,omitempty"`
	LoyaltyAccount          LoyaltyAccount       `json:"loyaltyAccount"`
	LoyaltyEventDiscount    LoyaltyEventDiscount `json:"loyaltyEventDiscount,omitempty"`
	Customer                Customer             `json:"customer"`
	Delivery                Delivery             `json:"delivery,omitempty"`
	Site                    string               `json:"site,omitempty"`
	Items                   []LoyaltyItems       `json:"items,omitempty"`
	Currency                string               `json:"currency,omitempty"`
}
type SerializedOrderLink struct {
	Comment   string        `json:"comment,omitempty"`
	CreatedAt string        `json:"createdAt,omitempty"`
	Orders    []LinkedOrder `json:"orders,omitempty"`
}

SerializedOrderLink type.

type Settings

type Settings struct {
	DefaultCurrency SettingsNode     `json:"default_currency"`
	SystemLanguage  SettingsNode     `json:"system_language"`
	Timezone        SettingsNode     `json:"timezone"`
	MgSettings      MgSettings       `json:"mg"`
	WorkTimes       []WorkTime       `json:"work_times"`
	NonWorkingDays  []NonWorkingDays `json:"non_working_days"`
}

Settings type. Contains retailCRM configuration.

type SettingsNode

type SettingsNode struct {
	Value     string `json:"value"`
	UpdatedAt string `json:"updated_at"`
}

SettingsNode represents an item in settings. All settings nodes contains only string value and update time for now.

type SettingsResponse

type SettingsResponse struct {
	Success  bool     `json:"success"`
	Settings Settings `json:"settings,omitempty"`
}

SettingsResponse type.

type ShipmentFilter

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"`
}

ShipmentFilter type.

type Site

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"`
	DefaultForCRM     bool         `json:"defaultForCrm,omitempty"`
	Ordering          int          `json:"ordering,omitempty"`
	IsDemo            bool         `json:"isDemo,omitempty"`
	CatalogID         string       `json:"catalogId,omitempty"`
	IsCatalogMainSite bool         `json:"isCatalogMainSite,omitempty"`
	Currency          string       `json:"currency,omitempty"`
}

Site type.

type SitesResponse

type SitesResponse struct {
	Success bool            `json:"success"`
	Sites   map[string]Site `json:"sites,omitempty"`
}

SitesResponse type.

type SmsVerification added in v2.1.2

type SmsVerification struct {
	CreatedAt  string `json:"createdAt"`
	ExpiredAt  string `json:"expiredAt"`
	VerifiedAt string `json:"verifiedAt"`
	CheckID    string `json:"checkId"`
	ActionType string `json:"actionType"`
}

type Source

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"`
	ClientID string                   `json:"client_id,omitempty"`
	Site     string                   `json:"site,omitempty"`
	Order    LinkedOrder              `json:"order,omitempty"`
	Customer SerializedEntityCustomer `json:"customer,omitempty"`
}

Source type.

type SourcesResponse added in v2.1.11

type SourcesResponse struct {
	ErrorMsg      string            `json:"errorMsg,omitempty"`
	Errors        map[string]string `json:"errors,omitempty"`
	FailedSources []Source          `json:"failed_sources,omitempty"`
	Success       bool              `json:"success"`
}

SourcesResponse type.

type Status

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"`
}

Status type.

type StatusGroup

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"`
}

StatusGroup type.

type StatusGroupsResponse

type StatusGroupsResponse struct {
	Success      bool                   `json:"success"`
	StatusGroups map[string]StatusGroup `json:"statusGroups,omitempty"`
}

StatusGroupsResponse type.

type StatusesResponse

type StatusesResponse struct {
	Success  bool              `json:"success"`
	Statuses map[string]Status `json:"statuses,omitempty"`
}

StatusesResponse type.

type Store

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"`
}

Store type.

type StoreUploadResponse

type StoreUploadResponse struct {
	Success              bool    `json:"success"`
	ProcessedOffersCount int     `json:"processedOffersCount,omitempty"`
	NotFoundOffers       []Offer `json:"notFoundOffers,omitempty"`
}

StoreUploadResponse type.

type StoresResponse

type StoresResponse struct {
	Success bool    `json:"success"`
	Stores  []Store `json:"stores,omitempty"`
}

StoresResponse type.

type StringMap added in v2.0.1

type StringMap map[string]string

func (*StringMap) UnmarshalJSON added in v2.0.1

func (l *StringMap) UnmarshalJSON(data []byte) error

type SuccessfulResponse

type SuccessfulResponse struct {
	Success bool `json:"success"`
}

SuccessfulResponse type.

type SystemInfoResponse added in v2.0.5

type SystemInfoResponse struct {
	Success       bool   `json:"success,omitempty"`
	SystemVersion string `json:"systemVersion,omitempty"`
	PublicURL     string `json:"publicUrl,omitempty"`
	TechnicalURL  string `json:"technicalUrl,omitempty"`
}

SystemInfoResponse return system info.

type Tag

type Tag struct {
	Name     string `json:"name,omitempty"`
	Color    string `json:"color,omitempty"`
	Attached bool   `json:"attached,omitempty"`
}

Tag struct.

func (Tag) MarshalJSON

func (t Tag) MarshalJSON() ([]byte, error)

type Task

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"`
}

Task type.

type TaskResponse

type TaskResponse struct {
	Success bool  `json:"success"`
	Task    *Task `json:"task,omitempty"`
}

TaskResponse type.

type TasksFilter

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"`
}

TasksFilter type.

type TasksRequest

type TasksRequest struct {
	Filter TasksFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

TasksRequest type.

type TasksResponse

type TasksResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Tasks      []Task      `json:"tasks,omitempty"`
}

TasksResponse type.

type Telephony

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"`
	ExternalPhones       []ExternalPhone  `json:"externalPhones,omitempty"`
}

Telephony type.

type TemplateItemList added in v2.1.7

type TemplateItemList []TextTemplateItem

type Text added in v2.1.7

type Text struct {
	Parts   []TextTemplateItem `json:"parts"`
	Example []string           `json:"example,omitempty"`
}

type TextTemplateItem added in v2.1.7

type TextTemplateItem struct {
	Text    string
	VarType string
	Type    uint8
}

TextTemplateItem is a part of template.

func (TextTemplateItem) MarshalJSON added in v2.1.7

func (t TextTemplateItem) MarshalJSON() ([]byte, error)

MarshalJSON controls how TextTemplateItem will be marshaled into JSON.

func (*TextTemplateItem) UnmarshalJSON added in v2.1.7

func (t *TextTemplateItem) UnmarshalJSON(b []byte) error

UnmarshalJSON will correctly unmarshal TextTemplateItem.

type Unit

type Unit struct {
	Code    string `json:"code"`
	Name    string `json:"name"`
	Sym     string `json:"sym"`
	Default bool   `json:"default,omitempty"`
	Active  bool   `json:"active,omitempty"`
}

Unit type.

type UnitsResponse

type UnitsResponse struct {
	Success bool    `json:"success"`
	Units   *[]Unit `json:"units,omitempty"`
}

UnitsResponse type.

type UpdateScopesResponse added in v2.0.6

type UpdateScopesResponse struct {
	ErrorResponse
	APIKey string `json:"apiKey"`
}

UpdateScopesResponse update scopes response.

type User

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"`
	Position   string      `json:"position,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"`
	MGUserID   uint64      `json:"mgUserId,omitempty"`
}

User type.

type UserGroup

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"`
	BreakdownOrderTypes   []string `json:"breakdownOrderTypes,omitempty"`
	BreakdownSites        []string `json:"breakdownSites,omitempty"`
	BreakdownOrderMethods []string `json:"breakdownOrderMethods,omitempty"`
	GrantedOrderTypes     []string `json:"grantedOrderTypes,omitempty"`
	GrantedSites          []string `json:"grantedSites,omitempty"`
}

UserGroup type.

type UserGroupType added in v2.1.3

type UserGroupType string
var UserGroupSuperadmins UserGroupType = "superadmins"

type UserGroupsRequest

type UserGroupsRequest struct {
	Limit int `url:"limit,omitempty"`
	Page  int `url:"page,omitempty"`
}

UserGroupsRequest type.

type UserGroupsResponse

type UserGroupsResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Groups     []UserGroup `json:"groups,omitempty"`
}

UserGroupsResponse type.

type UserResponse

type UserResponse struct {
	Success bool  `json:"success"`
	User    *User `json:"user,omitempty"`
}

UserResponse type.

type UsersFilter

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"`
}

UsersFilter type.

type UsersRequest

type UsersRequest struct {
	Filter UsersFilter `url:"filter,omitempty"`
	Limit  int         `url:"limit,omitempty"`
	Page   int         `url:"page,omitempty"`
}

UsersRequest type.

type UsersResponse

type UsersResponse struct {
	Success    bool        `json:"success"`
	Pagination *Pagination `json:"pagination,omitempty"`
	Users      []User      `json:"users,omitempty"`
}

UsersResponse type.

type VersionResponse

type VersionResponse struct {
	Success  bool     `json:"success,omitempty"`
	Versions []string `json:"versions,omitempty"`
}

VersionResponse return available API versions.

type Warehouse

type Warehouse struct {
	Actions []Action `json:"actions,omitempty"`
}

Warehouse type.

type WorkTime added in v2.0.12

type WorkTime struct {
	DayType        string `json:"day_type"`
	StartTime      string `json:"start_time"`
	EndTime        string `json:"end_time"`
	LunchStartTime string `json:"lunch_start_time"`
	LunchEndTime   string `json:"lunch_end_time"`
}

WorkTime type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL