@@ -1959,7 +1959,7 @@ func (c *Client) CorporateCustomerEdit(customer CorporateCustomer, by string, si
19591959
19601960// ClearCart clears the current customer's shopping cart
19611961//
1962- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-customer-interaction-site-cart-clear
1962+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-customer-interaction-site-cart-clear
19631963//
19641964// Example:
19651965//
@@ -2021,7 +2021,7 @@ func (c *Client) ClearCart(site string, filter SiteFilter, req ClearCartRequest)
20212021
20222022// SetCart creates or overwrites shopping cart data
20232023//
2024- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-customer-interaction-site-cart-set
2024+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-customer-interaction-site-cart-set
20252025//
20262026// Example:
20272027//
@@ -2091,7 +2091,7 @@ func (c *Client) SetCart(site string, filter SiteFilter, req SetCartRequest) (
20912091
20922092// GetCart returns the current customer's shopping cart
20932093//
2094- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-customer-interaction-site-cart-customerId
2094+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-customer-interaction-site-cart-customerId
20952095//
20962096// Example:
20972097//
@@ -2125,6 +2125,146 @@ func (c *Client) GetCart(site, customer string, filter GetCartFilter) (CartRespo
21252125 return resp , status , nil
21262126}
21272127
2128+ // GetFavorites returns the current customer's list of favorite offers
2129+ //
2130+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-customer-interaction-site-favorites-customerId
2131+ //
2132+ // Example:
2133+ //
2134+ // var client = retailcrm.New("https://demo.url", "09jIJ")
2135+ //
2136+ // data, status, err := client.GetFavorites("site_id","customer_id",
2137+ // retailcrm.GetFavoritesFilter{ SiteBy: "code", By: "externalId"})
2138+ //
2139+ // if err != nil {
2140+ // if apiErr, ok := retailcrm.AsAPIError(err); ok {
2141+ // log.Fatalf("http status: %d, %s", status, apiErr.String())
2142+ // }
2143+ //
2144+ // log.Fatalf("http status: %d, error: %s", status, err)
2145+ // }
2146+ func (c * Client ) GetFavorites (site , customer string , filter FavoritesFilter ) (FavoritesResponse , int , error ) {
2147+ var resp FavoritesResponse
2148+
2149+ params , _ := query .Values (filter )
2150+
2151+ data , status , err := c .GetRequest (fmt .Sprintf ("/customer-interaction/%s/favorites/%s?%s" , site , customer , params .Encode ()))
2152+ if err != nil {
2153+ return resp , status , err
2154+ }
2155+
2156+ err = json .Unmarshal (data , & resp )
2157+ if err != nil {
2158+ return resp , status , err
2159+ }
2160+
2161+ return resp , status , nil
2162+ }
2163+
2164+ // AddFavorite adds favorite products for customer
2165+ //
2166+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-customer-interaction-site-favorites-customerId-add
2167+ //
2168+ // Example:
2169+ //
2170+ // var client = retailcrm.New("https://demo.url", "09jIJ")
2171+ //
2172+ // data, status, err := client.AddFavorite("site_id", "customer_external_id", retailcrm.FavoritesFilter{SiteBy: "id", By: "externalId"},
2173+ // retailcrm.AddFavoriteRequest{
2174+ // ID: 1,
2175+ // ExternalID: "ext_id",
2176+ // XMLID: "xml_id",
2177+ // },
2178+ // )
2179+ //
2180+ // if err != nil {
2181+ // if apiErr, ok := retailcrm.AsAPIError(err); ok {
2182+ // log.Fatalf("http status: %d, %s", status, apiErr.String())
2183+ // }
2184+ //
2185+ // log.Fatalf("http status: %d, error: %s", status, err)
2186+ // }
2187+ func (c * Client ) AddFavorite (site , customer string , filter FavoritesFilter , req AddFavoriteRequest ) (
2188+ SuccessfulResponse , int , error ,
2189+ ) {
2190+ var resp SuccessfulResponse
2191+
2192+ updateJSON , err := json .Marshal (& req )
2193+ if err != nil {
2194+ return SuccessfulResponse {}, 0 , err
2195+ }
2196+
2197+ p := url.Values {
2198+ "favorite" : {string (updateJSON )},
2199+ }
2200+
2201+ params , _ := query .Values (filter )
2202+
2203+ data , status , err := c .PostRequest (fmt .Sprintf ("/customer-interaction/%s/favorites/%s/add?%s" , site , customer , params .Encode ()), p )
2204+ if err != nil {
2205+ return resp , status , err
2206+ }
2207+
2208+ err = json .Unmarshal (data , & resp )
2209+ if err != nil {
2210+ return resp , status , err
2211+ }
2212+
2213+ return resp , status , nil
2214+ }
2215+
2216+ // RemoveFavorite removes favorite products from customer
2217+ //
2218+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-customer-interaction-site-favorites-customerId-remove
2219+ //
2220+ // Example:
2221+ //
2222+ // var client = retailcrm.New("https://demo.url", "09jIJ")
2223+ //
2224+ // data, status, err := client.RemoveFavorite("site_id", "customer_external_id", retailcrm.FavoritesFilter{SiteBy: "id", By: "externalId"},
2225+ // retailcrm.AddFavoriteRequest{
2226+ // ID: 1,
2227+ // ExternalID: "ext_id",
2228+ // XMLID: "xml_id",
2229+ // },
2230+ // )
2231+ //
2232+ // if err != nil {
2233+ // if apiErr, ok := retailcrm.AsAPIError(err); ok {
2234+ // log.Fatalf("http status: %d, %s", status, apiErr.String())
2235+ // }
2236+ //
2237+ // log.Fatalf("http status: %d, error: %s", status, err)
2238+ // }
2239+ func (c * Client ) RemoveFavorite (site , customer string , filter FavoritesFilter , req AddFavoriteRequest ) (
2240+ SuccessfulResponse , int , error ,
2241+ ) {
2242+ var resp SuccessfulResponse
2243+
2244+ updateJSON , err := json .Marshal (& req )
2245+ if err != nil {
2246+ return SuccessfulResponse {}, 0 , err
2247+ }
2248+
2249+ p := url.Values {
2250+ "favorite" : {string (updateJSON )},
2251+ }
2252+
2253+ params , _ := query .Values (filter )
2254+
2255+ data , status , err := c .PostRequest (fmt .Sprintf ("/customer-interaction/%s/favorites/%s/remove?%s" , site , customer , params .Encode ()), p )
2256+ if err != nil {
2257+ return resp , status , err
2258+ }
2259+
2260+ err = json .Unmarshal (data , & resp )
2261+ if err != nil {
2262+ return resp , status , err
2263+ }
2264+
2265+ return resp , status , nil
2266+ }
2267+
21282268// DeliveryTracking updates tracking data
21292269//
21302270// For more information see http://www.simla.com/docs/Developers/API/APIVersions/APIv5#post--api-v5-delivery-generic-subcode-tracking
@@ -6277,7 +6417,7 @@ func (c *Client) AccountBonusOperations(id int, parameters AccountBonusOperation
62776417
62786418// ProductsBatchEdit perform editing products batch
62796419//
6280- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-store-products-batch-edit
6420+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-store-products-batch-edit
62816421//
62826422// Example:
62836423//
@@ -6333,7 +6473,7 @@ func (c *Client) ProductsBatchEdit(products []ProductEdit) (ProductsBatchEditRes
63336473
63346474// ProductsBatchCreate perform adding products batch
63356475//
6336- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-store-products-batch-create
6476+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-store-products-batch-create
63376477//
63386478// Example:
63396479//
@@ -6387,7 +6527,7 @@ func (c *Client) ProductsBatchCreate(products []ProductCreate) (ProductsBatchEdi
63876527
63886528// LoyaltyAccountCreate аdd a client to the loyalty program
63896529//
6390- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-loyalty-account-create
6530+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-loyalty-account-create
63916531//
63926532// Example:
63936533//
@@ -6441,7 +6581,7 @@ func (c *Client) LoyaltyAccountCreate(site string, loyaltyAccount SerializedCrea
64416581
64426582// LoyaltyAccountEdit edit a client in the loyalty program
64436583//
6444- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-loyalty-account-id-edit
6584+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-loyalty-account-id-edit
64456585//
64466586// Example:
64476587//
@@ -6491,7 +6631,7 @@ func (c *Client) LoyaltyAccountEdit(id int, loyaltyAccount SerializedEditLoyalty
64916631
64926632// LoyaltyAccount return information about client in the loyalty program
64936633//
6494- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-loyalty-account-id
6634+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-loyalty-account-id
64956635//
64966636// Example:
64976637//
@@ -6530,7 +6670,7 @@ func (c *Client) LoyaltyAccount(id int) (LoyaltyAccountResponse, int, error) {
65306670
65316671// LoyaltyAccountActivate activate participation in the loyalty program for client
65326672//
6533- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-loyalty-account-id-activate
6673+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-loyalty-account-id-activate
65346674//
65356675// Example:
65366676//
@@ -6569,7 +6709,7 @@ func (c *Client) LoyaltyAccountActivate(id int) (LoyaltyAccountActivateResponse,
65696709
65706710// LoyaltyBonusCredit accrue bonus participation in the program of loyalty
65716711//
6572- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-loyalty-account-id-bonus-credit
6712+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-loyalty-account-id-bonus-credit
65736713//
65746714// Example:
65756715//
@@ -6615,7 +6755,7 @@ func (c *Client) LoyaltyBonusCredit(id int, req LoyaltyBonusCreditRequest) (Loya
66156755
66166756// LoyaltyBonusStatusDetails get details on the bonus account
66176757//
6618- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-loyalty-account-id-bonus-status-details
6758+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-loyalty-account-id-bonus-status-details
66196759//
66206760// Example:
66216761//
@@ -6665,7 +6805,7 @@ func (c *Client) LoyaltyBonusStatusDetails(
66656805
66666806// LoyaltyAccounts return list of participations in the loyalty program
66676807//
6668- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-loyalty-accounts
6808+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-loyalty-accounts
66696809//
66706810// Example:
66716811//
@@ -6719,7 +6859,7 @@ func (c *Client) LoyaltyAccounts(req LoyaltyAccountsRequest) (LoyaltyAccountsRes
67196859
67206860// LoyaltyCalculate calculations of the maximum discount
67216861//
6722- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-loyalty-calculate
6862+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-loyalty-calculate
67236863//
67246864// Example:
67256865//
@@ -6786,7 +6926,7 @@ func (c *Client) LoyaltyCalculate(req LoyaltyCalculateRequest) (LoyaltyCalculate
67866926
67876927// GetLoyalties returns list of loyalty programs
67886928//
6789- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-loyalty-loyalties
6929+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-loyalty-loyalties
67906930//
67916931// Example:
67926932//
@@ -6838,7 +6978,7 @@ func (c *Client) GetLoyalties(req LoyaltiesRequest) (LoyaltiesResponse, int, err
68386978
68396979// GetLoyaltyByID return program of loyalty by id
68406980//
6841- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#get--api-v5-loyalty-loyalties-id
6981+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#get--api-v5-loyalty-loyalties-id
68426982//
68436983// Example:
68446984//
@@ -6878,7 +7018,7 @@ func (c *Client) GetLoyaltyByID(id int) (LoyaltyResponse, int, error) {
68787018
68797019// OrderIntegrationDeliveryCancel cancels of integration delivery
68807020//
6881- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-orders-externalId-delivery-cancel
7021+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-orders-externalId-delivery-cancel
68827022//
68837023// Example:
68847024//
@@ -6922,7 +7062,7 @@ func (c *Client) OrderIntegrationDeliveryCancel(by string, force bool, id string
69227062
69237063// CreateProductsGroup adds a product group
69247064//
6925- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-store-product-groups-create
7065+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-store-product-groups-create
69267066//
69277067// Example:
69287068//
@@ -6975,7 +7115,7 @@ func (c *Client) CreateProductsGroup(group ProductGroup) (ActionProductsGroupRes
69757115
69767116// EditProductsGroup edits a product group
69777117//
6978- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-store-product-groups-externalId-edit
7118+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-store-product-groups-externalId-edit
69797119//
69807120// Example:
69817121//
@@ -7105,7 +7245,7 @@ func (c *Client) GetOrderPlate(by, orderID, site string, plateID int) (io.ReadCl
71057245
71067246// NotificationsSend send a notification
71077247//
7108- // For more information see https://docs.retailcrm.ru/Developers/API/APIVersions/ APIv5#post--api-v5-notifications-send
7248+ // For more information see https://docs.retailcrm.ru/Developers/API/APIv5#post--api-v5-notifications-send
71097249//
71107250// Example:
71117251//
0 commit comments