mirror of
https://github.com/retailcrm/api-client-go.git
synced 2025-04-03 13:13:37 +03:00
Minor fixes with pointers & names
This commit is contained in:
parent
c21caef055
commit
f0d7c71d0e
5 changed files with 73 additions and 82 deletions
|
@ -542,8 +542,8 @@ func (c *Client) Tasks(parameters TasksRequest) (*TasksResponse, int, error) {
|
|||
}
|
||||
|
||||
// TaskCreate method
|
||||
func (c *Client) TaskCreate(task Task, site ...string) (*TaskChangeResponse, int, error) {
|
||||
var resp TaskChangeResponse
|
||||
func (c *Client) TaskCreate(task Task, site ...string) (*CreateResponse, int, error) {
|
||||
var resp CreateResponse
|
||||
taskJson, _ := json.Marshal(&task)
|
||||
|
||||
p := url.Values{
|
||||
|
|
|
@ -128,12 +128,6 @@ type TaskResponse struct {
|
|||
Task *Task `json:"task,omitempty,brackets"`
|
||||
}
|
||||
|
||||
// TaskChangeResponse type
|
||||
type TaskChangeResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Id int `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// TasksResponse type
|
||||
type TasksResponse struct {
|
||||
Success bool `json:"success"`
|
||||
|
|
136
v5/types.go
136
v5/types.go
|
@ -100,7 +100,7 @@ type Customer struct {
|
|||
Sex string `json:"sex,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Phones []CustomerPhone `json:"phones,brackets,omitempty"`
|
||||
Address Address `json:"address,omitempty"`
|
||||
Address *Address `json:"address,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Birthday string `json:"birthday,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
|
@ -133,15 +133,15 @@ type CustomerPhone struct {
|
|||
|
||||
// CustomerHistoryRecord type
|
||||
type CustomerHistoryRecord struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User User `json:"user,omitempty,brackets"`
|
||||
ApiKey ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
Customer Customer `json:"customer,omitempty,brackets"`
|
||||
Id int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User *User `json:"user,omitempty,brackets"`
|
||||
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
Customer *Customer `json:"customer,omitempty,brackets"`
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,11 +191,11 @@ type Order struct {
|
|||
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"`
|
||||
Source *Source `json:"source,omitempty"`
|
||||
Contragent *Contragent `json:"contragent,omitempty"`
|
||||
Customer *Customer `json:"customer,omitempty"`
|
||||
Delivery *OrderDelivery `json:"delivery,omitempty"`
|
||||
Marketplace *OrderMarketplace `json:"marketplace,omitempty"`
|
||||
Items []OrderItem `json:"items,omitempty,brackets"`
|
||||
CustomFields []map[string]string `json:"customFields,omitempty,brackets"`
|
||||
// Payments []OrderPayment `json:"payments,omitempty,brackets"`
|
||||
|
@ -203,16 +203,16 @@ type Order struct {
|
|||
|
||||
// OrderDelivery type
|
||||
type OrderDelivery struct {
|
||||
Code string `json:"code,omitempty"`
|
||||
IntegrationCode string `json:"integrationCode,omitempty"`
|
||||
Cost float32 `json:"cost,omitempty"`
|
||||
NetCost float32 `json:"netCost,omitempty"`
|
||||
VatRate string `json:"vatRate,omitempty"`
|
||||
Date string `json:"date,omitempty"`
|
||||
Time OrderDeliveryTime `json:"time,omitempty"`
|
||||
Address Address `json:"address,omitempty"`
|
||||
Service OrderDeliveryService `json:"service,omitempty"`
|
||||
Data OrderDeliveryData `json:"data,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
IntegrationCode string `json:"integrationCode,omitempty"`
|
||||
Cost float32 `json:"cost,omitempty"`
|
||||
NetCost float32 `json:"netCost,omitempty"`
|
||||
VatRate string `json:"vatRate,omitempty"`
|
||||
Date string `json:"date,omitempty"`
|
||||
Time *OrderDeliveryTime `json:"time,omitempty"`
|
||||
Address *Address `json:"address,omitempty"`
|
||||
Service *OrderDeliveryService `json:"service,omitempty"`
|
||||
Data *OrderDeliveryData `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// OrderDeliveryTime type
|
||||
|
@ -256,35 +256,35 @@ type OrderPayment struct {
|
|||
|
||||
// OrderItem type
|
||||
type OrderItem struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
InitialPrice float32 `json:"initialPrice,omitempty"`
|
||||
PurchasePrice float32 `json:"purchasePrice,omitempty"`
|
||||
DiscountTotal float32 `json:"discountTotal,omitempty"`
|
||||
DiscountManualAmount float32 `json:"discountManualAmount,omitempty"`
|
||||
DiscountManualPercent float32 `json:"discountManualPercent,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
VatRate string `json:"vatRate,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Quantity float32 `json:"quantity,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
IsCanceled bool `json:"isCanceled,omitempty"`
|
||||
Offer Offer `json:"offer,omitempty"`
|
||||
Properties []Property `json:"properties,omitempty,brackets"`
|
||||
PriceType PriceType `json:"priceType,omitempty"`
|
||||
Id int `json:"id,omitempty"`
|
||||
InitialPrice float32 `json:"initialPrice,omitempty"`
|
||||
PurchasePrice float32 `json:"purchasePrice,omitempty"`
|
||||
DiscountTotal float32 `json:"discountTotal,omitempty"`
|
||||
DiscountManualAmount float32 `json:"discountManualAmount,omitempty"`
|
||||
DiscountManualPercent float32 `json:"discountManualPercent,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
VatRate string `json:"vatRate,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Quantity float32 `json:"quantity,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
IsCanceled bool `json:"isCanceled,omitempty"`
|
||||
Offer *Offer `json:"offer,omitempty"`
|
||||
Properties []*Property `json:"properties,omitempty,brackets"`
|
||||
PriceType *PriceType `json:"priceType,omitempty"`
|
||||
}
|
||||
|
||||
// OrdersHistoryRecord type
|
||||
type OrdersHistoryRecord struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User User `json:"user,omitempty,brackets"`
|
||||
ApiKey ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
Order Order `json:"order,omitempty,brackets"`
|
||||
Id int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User *User `json:"user,omitempty,brackets"`
|
||||
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
Order *Order `json:"order,omitempty,brackets"`
|
||||
}
|
||||
|
||||
// Offer type
|
||||
|
@ -351,19 +351,19 @@ Task related types
|
|||
|
||||
// Task type
|
||||
type Task struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
PerformerId int `json:"performerId,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
Commentary string `json:"commentary,omitempty"`
|
||||
Datetime string `json:"datetime,omitempty"`
|
||||
Complete bool `json:"complete,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Creator int `json:"creator,omitempty"`
|
||||
Performer int `json:"performer,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
PhoneSite string `json:"phoneSite,omitempty"`
|
||||
Customer Customer `json:"customer,omitempty"`
|
||||
Order Order `json:"order,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -372,9 +372,9 @@ type Task struct {
|
|||
|
||||
// Note type
|
||||
type Note struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Customer Customer `json:"customer,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ func TestClient_NotesCreateDelete(t *testing.T) {
|
|||
f := v5.Note{
|
||||
Text: "some text",
|
||||
ManagerId: GetUser(),
|
||||
Customer: v5.Customer{
|
||||
Customer: &v5.Customer{
|
||||
Id: createCustomerResponse.Id,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -37,11 +37,8 @@ func TestClient_TasksTasks(t *testing.T) {
|
|||
func TestClient_TaskChange(t *testing.T) {
|
||||
c := client()
|
||||
|
||||
random1 := RandomString(15)
|
||||
random2 := RandomString(20)
|
||||
|
||||
f := v5.Task{
|
||||
Text: random1,
|
||||
Text: RandomString(15),
|
||||
PerformerId: GetUser(),
|
||||
}
|
||||
|
||||
|
@ -62,7 +59,7 @@ func TestClient_TaskChange(t *testing.T) {
|
|||
}
|
||||
|
||||
f.Id = cr.Id
|
||||
f.Commentary = random2
|
||||
f.Commentary = RandomString(20)
|
||||
|
||||
gt, sg, err := c.Task(f.Id)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue