retailcrm

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MIT Imports: 1 Imported by: 0

README

Build Status GitHub release GoLang version

retailCRM API Go client

This is golang retailCRM API client.

Install

go get -x github.com/retailcrm/api-client-go

Usage

package main

import (
	"fmt"
	"net/http"

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

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

	data, status, err := client.Orders(v5.OrdersRequest{
		Filter: v5.OrdersFilter{},
		Limit: 20,
		Page: 1,
	})
	if err.ErrorMsg != "" {
		fmt.Printf("%v", err.ErrorMsg)
	}

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

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

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

	idata, status, err := c.InventoriesUpload(
        []InventoryUpload{
            {
                XMLID: "pTKIKAeghYzX21HTdzFCe1",
                Stores: []InventoryUploadStore{
                    {Code: "test-store-v5", Available: 10, PurchasePrice: 1500},
                    {Code: "test-store-v4", Available: 20, PurchasePrice: 1530},
                    {Code: "test-store", Available: 30, PurchasePrice: 1510},
                },
            },
            {
                XMLID: "JQIvcrCtiSpOV3AAfMiQB3",
                Stores: []InventoryUploadStore{
                    {Code: "test-store-v5", Available: 45, PurchasePrice: 1500},
                    {Code: "test-store-v4", Available: 32, PurchasePrice: 1530},
                    {Code: "test-store", Available: 46, PurchasePrice: 1510},
                },
            },
        },
    )
    if err.ErrorMsg != "" {
        fmt.Printf("%v", err.ErrorMsg)
    }

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

    fmt.Println(idata.processedOffersCount)
}

Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version5

func Version5(url string, key string) *v5.Client

Version5 API client for v5

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL