api-client-go/response.go

553 lines
16 KiB
Go
Raw Normal View History

package retailcrm
2018-02-27 11:37:15 +03:00
// SuccessfulResponse type.
type SuccessfulResponse struct {
2018-02-27 11:37:15 +03:00
Success bool `json:"success,omitempty"`
}
// CreateResponse type.
2018-02-27 11:37:15 +03:00
type CreateResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrderCreateResponse type.
type OrderCreateResponse struct {
CreateResponse
Order Order `json:"order,omitempty"`
}
// OperationResponse type.
2018-02-27 11:37:15 +03:00
type OperationResponse struct {
Success bool `json:"success"`
Errors map[string]string `json:"ErrorsList,omitempty"`
2018-02-27 11:37:15 +03:00
}
// VersionResponse return available API versions.
2018-02-27 11:37:15 +03:00
type VersionResponse struct {
Success bool `json:"success,omitempty"`
Versions []string `json:"versions,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CredentialResponse return available API methods.
2018-02-27 11:37:15 +03:00
type CredentialResponse struct {
Success bool `json:"success,omitempty"`
// deprecated
Credentials []string `json:"credentials,omitempty"`
Scopes []string `json:"scopes,omitempty"`
2018-02-27 11:37:15 +03:00
SiteAccess string `json:"siteAccess,omitempty"`
SitesAvailable []string `json:"sitesAvailable,omitempty"`
2018-02-27 11:37:15 +03:00
}
2022-02-03 18:09:33 +03:00
// SystemInfoResponse return system info.
type SystemInfoResponse struct {
Success bool `json:"success,omitempty"`
SystemVersion string `json:"systemVersion,omitempty"`
PublicURL string `json:"publicUrl,omitempty"`
TechnicalURL string `json:"technicalUrl,omitempty"`
}
// CustomerResponse type.
2018-02-27 11:37:15 +03:00
type CustomerResponse struct {
Success bool `json:"success"`
Customer *Customer `json:"customer,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CorporateCustomerResponse type.
type CorporateCustomerResponse struct {
Success bool `json:"success"`
CorporateCustomer *CorporateCustomer `json:"customerCorporate,omitempty"`
}
// CustomersResponse type.
2018-02-27 11:37:15 +03:00
type CustomersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Customers []Customer `json:"customers,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CorporateCustomersResponse type.
type CorporateCustomersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomersCorporate []CorporateCustomer `json:"customersCorporate,omitempty"`
}
// CorporateCustomersNotesResponse type.
type CorporateCustomersNotesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Notes []Note `json:"notes,omitempty"`
}
// CorporateCustomersAddressesResponse type.
type CorporateCustomersAddressesResponse struct {
Success bool `json:"success"`
Addresses []CorporateCustomerAddress `json:"addresses"`
}
// CorporateCustomerCompaniesResponse type.
type CorporateCustomerCompaniesResponse struct {
Success bool `json:"success"`
Companies []Company `json:"companies"`
}
// CorporateCustomerContactsResponse type.
type CorporateCustomerContactsResponse struct {
Success bool `json:"success"`
Contacts []CorporateCustomerContact `json:"contacts"`
}
// CustomerChangeResponse type.
2018-02-27 11:37:15 +03:00
type CustomerChangeResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
2018-02-27 11:37:15 +03:00
State string `json:"state,omitempty"`
}
// CorporateCustomerChangeResponse type.
type CorporateCustomerChangeResponse CustomerChangeResponse
// CustomersUploadResponse type.
2018-02-27 11:37:15 +03:00
type CustomersUploadResponse struct {
Success bool `json:"success"`
UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CorporateCustomersUploadResponse type.
type CorporateCustomersUploadResponse CustomersUploadResponse
// CustomersHistoryResponse type.
2018-02-27 11:37:15 +03:00
type CustomersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []CustomerHistoryRecord `json:"history,omitempty"`
2018-02-27 11:37:15 +03:00
Pagination *Pagination `json:"pagination,omitempty"`
}
// CorporateCustomersHistoryResponse type.
type CorporateCustomersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []CorporateCustomerHistoryRecord `json:"history,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
}
// OrderResponse type.
2018-02-27 11:37:15 +03:00
type OrderResponse struct {
Success bool `json:"success"`
Order *Order `json:"order,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrdersResponse type.
2018-02-27 11:37:15 +03:00
type OrdersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Orders []Order `json:"orders,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrdersStatusesResponse type.
2020-06-29 16:26:10 +03:00
type OrdersStatusesResponse struct {
Success bool `json:"success"`
Orders []OrdersStatus `json:"orders"`
}
// OrdersUploadResponse type.
2018-02-27 11:37:15 +03:00
type OrdersUploadResponse struct {
Success bool `json:"success"`
UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrdersHistoryResponse type.
2018-02-27 11:37:15 +03:00
type OrdersHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []OrdersHistoryRecord `json:"history,omitempty"`
2018-02-27 11:37:15 +03:00
Pagination *Pagination `json:"pagination,omitempty"`
}
// PackResponse type.
2018-02-27 11:37:15 +03:00
type PackResponse struct {
Success bool `json:"success"`
Pack *Pack `json:"pack,omitempty"`
2018-02-27 11:37:15 +03:00
}
// PacksResponse type.
2018-02-27 11:37:15 +03:00
type PacksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Packs []Pack `json:"packs,omitempty"`
2018-02-27 11:37:15 +03:00
}
// PacksHistoryResponse type.
2018-02-27 11:37:15 +03:00
type PacksHistoryResponse struct {
Success bool `json:"success,omitempty"`
GeneratedAt string `json:"generatedAt,omitempty"`
History []PacksHistoryRecord `json:"history,omitempty"`
2018-02-27 11:37:15 +03:00
Pagination *Pagination `json:"pagination,omitempty"`
}
// UserResponse type.
2018-02-27 11:37:15 +03:00
type UserResponse struct {
Success bool `json:"success"`
User *User `json:"user,omitempty"`
2018-02-27 11:37:15 +03:00
}
// UsersResponse type.
2018-02-27 11:37:15 +03:00
type UsersResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Users []User `json:"users,omitempty"`
2018-02-27 11:37:15 +03:00
}
// UserGroupsResponse type.
2018-02-27 11:37:15 +03:00
type UserGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Groups []UserGroup `json:"groups,omitempty"`
2018-02-27 11:37:15 +03:00
}
// TaskResponse type.
2018-02-27 11:37:15 +03:00
type TaskResponse struct {
Success bool `json:"success"`
Task *Task `json:"task,omitempty"`
2018-02-27 11:37:15 +03:00
}
// TasksResponse type.
2018-02-27 11:37:15 +03:00
type TasksResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Tasks []Task `json:"tasks,omitempty"`
2018-02-27 11:37:15 +03:00
}
// NotesResponse type.
2018-02-27 11:37:15 +03:00
type NotesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Notes []Note `json:"notes,omitempty"`
2018-02-27 11:37:15 +03:00
}
// SegmentsResponse type.
2018-02-27 11:37:15 +03:00
type SegmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Segments []Segment `json:"segments,omitempty"`
2018-02-27 11:37:15 +03:00
}
// SettingsResponse type.
2020-07-14 10:22:36 +03:00
type SettingsResponse struct {
Success bool `json:"success"`
Settings Settings `json:"settings,omitempty"`
2020-07-14 10:22:36 +03:00
}
// CountriesResponse type.
2018-02-27 11:37:15 +03:00
type CountriesResponse struct {
Success bool `json:"success"`
CountriesIso []string `json:"countriesIso,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CostGroupsResponse type.
2018-02-27 11:37:15 +03:00
type CostGroupsResponse struct {
Success bool `json:"success"`
CostGroups []CostGroup `json:"costGroups,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CostItemsResponse type.
2018-02-27 11:37:15 +03:00
type CostItemsResponse struct {
Success bool `json:"success"`
CostItems []CostItem `json:"costItems,omitempty"`
2018-02-27 11:37:15 +03:00
}
// CouriersResponse type.
2018-02-27 11:37:15 +03:00
type CouriersResponse struct {
Success bool `json:"success"`
Couriers []Courier `json:"couriers,omitempty"`
2018-02-27 11:37:15 +03:00
}
// DeliveryServiceResponse type.
2018-02-27 11:37:15 +03:00
type DeliveryServiceResponse struct {
Success bool `json:"success"`
DeliveryServices map[string]DeliveryService `json:"deliveryServices,omitempty"`
2018-02-27 11:37:15 +03:00
}
// DeliveryTypesResponse type.
2018-02-27 11:37:15 +03:00
type DeliveryTypesResponse struct {
Success bool `json:"success"`
DeliveryTypes map[string]DeliveryType `json:"deliveryTypes,omitempty"`
2018-02-27 11:37:15 +03:00
}
// LegalEntitiesResponse type.
2018-02-27 11:37:15 +03:00
type LegalEntitiesResponse struct {
Success bool `json:"success"`
LegalEntities []LegalEntity `json:"legalEntities,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrderMethodsResponse type.
2018-02-27 11:37:15 +03:00
type OrderMethodsResponse struct {
Success bool `json:"success"`
OrderMethods map[string]OrderMethod `json:"orderMethods,omitempty"`
2018-02-27 11:37:15 +03:00
}
// OrderTypesResponse type.
2018-02-27 11:37:15 +03:00
type OrderTypesResponse struct {
Success bool `json:"success"`
OrderTypes map[string]OrderType `json:"orderTypes,omitempty"`
2018-02-27 11:37:15 +03:00
}
// PaymentStatusesResponse type.
2018-02-27 11:37:15 +03:00
type PaymentStatusesResponse struct {
Success bool `json:"success"`
PaymentStatuses map[string]PaymentStatus `json:"paymentStatuses,omitempty"`
2018-02-27 11:37:15 +03:00
}
// PaymentTypesResponse type.
2018-02-27 11:37:15 +03:00
type PaymentTypesResponse struct {
Success bool `json:"success"`
PaymentTypes map[string]PaymentType `json:"paymentTypes,omitempty"`
2018-02-27 11:37:15 +03:00
}
// PriceTypesResponse type.
2018-02-27 11:37:15 +03:00
type PriceTypesResponse struct {
Success bool `json:"success"`
PriceTypes []PriceType `json:"priceTypes,omitempty"`
2018-02-27 11:37:15 +03:00
}
// ProductStatusesResponse type.
2018-02-27 11:37:15 +03:00
type ProductStatusesResponse struct {
Success bool `json:"success"`
ProductStatuses map[string]ProductStatus `json:"productStatuses,omitempty"`
2018-02-27 11:37:15 +03:00
}
// StatusesResponse type.
2018-02-27 11:37:15 +03:00
type StatusesResponse struct {
Success bool `json:"success"`
Statuses map[string]Status `json:"statuses,omitempty"`
2018-02-27 11:37:15 +03:00
}
// StatusGroupsResponse type.
2018-02-27 11:37:15 +03:00
type StatusGroupsResponse struct {
Success bool `json:"success"`
StatusGroups map[string]StatusGroup `json:"statusGroups,omitempty"`
2018-02-27 11:37:15 +03:00
}
// SitesResponse type.
2018-02-27 11:37:15 +03:00
type SitesResponse struct {
Success bool `json:"success"`
Sites map[string]Site `json:"sites,omitempty"`
2018-02-27 11:37:15 +03:00
}
// StoresResponse type.
2018-02-27 11:37:15 +03:00
type StoresResponse struct {
Success bool `json:"success"`
Stores []Store `json:"stores,omitempty"`
2018-02-27 11:37:15 +03:00
}
// InventoriesResponse type.
2018-02-27 11:37:15 +03:00
type InventoriesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Offers []Offer `json:"offers,omitempty"`
}
// StoreUploadResponse type.
2018-02-27 11:37:15 +03:00
type StoreUploadResponse struct {
Success bool `json:"success"`
ProcessedOffersCount int `json:"processedOffersCount,omitempty"`
NotFoundOffers []Offer `json:"notFoundOffers,omitempty"`
}
// ProductsGroupsResponse type.
2018-02-27 11:37:15 +03:00
type ProductsGroupsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
ProductGroup []ProductGroup `json:"productGroup,omitempty"`
2018-02-27 11:37:15 +03:00
}
// ProductsResponse type.
2018-02-27 11:37:15 +03:00
type ProductsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Products []Product `json:"products,omitempty"`
2018-02-27 11:37:15 +03:00
}
// ProductsPropertiesResponse type.
2018-02-27 11:37:15 +03:00
type ProductsPropertiesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Properties []Property `json:"properties,omitempty"`
2018-02-27 11:37:15 +03:00
}
// DeliveryShipmentsResponse type.
2018-02-27 11:37:15 +03:00
type DeliveryShipmentsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
DeliveryShipments []DeliveryShipment `json:"deliveryShipments,omitempty"`
2018-02-27 11:37:15 +03:00
}
// DeliveryShipmentResponse type.
2018-02-27 11:37:15 +03:00
type DeliveryShipmentResponse struct {
Success bool `json:"success"`
DeliveryShipment *DeliveryShipment `json:"deliveryShipment,omitempty"`
2018-02-27 11:37:15 +03:00
}
// DeliveryShipmentUpdateResponse type.
2018-02-27 11:37:15 +03:00
type DeliveryShipmentUpdateResponse struct {
Success bool `json:"success"`
ID int `json:"id,omitempty"`
2018-02-27 11:37:15 +03:00
Status string `json:"status,omitempty"`
}
// IntegrationModuleResponse type.
2018-02-27 11:37:15 +03:00
type IntegrationModuleResponse struct {
Success bool `json:"success"`
IntegrationModule *IntegrationModule `json:"integrationModule,omitempty"`
}
// UpdateScopesResponse update scopes response.
type UpdateScopesResponse struct {
ErrorResponse
APIKey string `json:"apiKey"`
}
// IntegrationModuleEditResponse type.
2018-02-27 11:37:15 +03:00
type IntegrationModuleEditResponse struct {
Success bool `json:"success"`
Info ResponseInfo `json:"info,omitempty"`
}
// ResponseInfo type.
type ResponseInfo struct {
MgTransportInfo MgInfo `json:"mgTransport,omitempty"`
MgBotInfo MgInfo `json:"mgBot,omitempty"`
BillingInfo *BillingInfo `json:"billingInfo,omitempty"`
}
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 struct {
Name string `json:"name,omitempty"`
ShortName string `json:"shortName,omitempty"`
Code string `json:"code,omitempty"`
}
// MgInfo type.
type MgInfo struct {
EndpointURL string `json:"endpointUrl"`
Token string `json:"token"`
2018-02-27 11:37:15 +03:00
}
// CostsResponse type.
type CostsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Costs []Cost `json:"costs,omitempty"`
}
// CostsUploadResponse type.
type CostsUploadResponse struct {
2018-04-16 17:02:27 +03:00
Success bool `json:"success"`
UploadedCosts []int `json:"uploadedCosts,omitempty"`
}
// CostsDeleteResponse type.
type CostsDeleteResponse struct {
2018-04-16 17:02:27 +03:00
Success bool `json:"success"`
Count int `json:"count,omitempty"`
NotRemovedIds []int `json:"notRemovedIds,omitempty"`
}
// CostResponse type.
type CostResponse struct {
Success bool `json:"success"`
Cost *Cost `json:"cost,omitempty"`
}
// FilesResponse type.
2019-09-04 11:38:21 +03:00
type FilesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
Files []File `json:"files,omitempty"`
2019-09-04 11:38:21 +03:00
}
// FileUpload response.
2019-09-04 11:38:21 +03:00
type FileUploadResponse struct {
Success bool `json:"success"`
File *File `json:"file,omitempty"`
}
// FileResponse type.
2019-09-04 11:38:21 +03:00
type FileResponse struct {
Success bool `json:"success"`
File *File `json:"file,omitempty"`
}
// CustomFieldsResponse type.
type CustomFieldsResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomFields []CustomFields `json:"customFields,omitempty"`
}
// CustomDictionariesResponse type.
type CustomDictionariesResponse struct {
Success bool `json:"success"`
Pagination *Pagination `json:"pagination,omitempty"`
CustomDictionaries *[]CustomDictionary `json:"customDictionaries,omitempty"`
}
// CustomResponse type.
type CustomResponse struct {
Success bool `json:"success"`
Code string `json:"code,omitempty"`
}
// CustomDictionaryResponse type.
type CustomDictionaryResponse struct {
Success bool `json:"success"`
CustomDictionary *CustomDictionary `json:"CustomDictionary,omitempty"`
}
// CustomFieldResponse type.
type CustomFieldResponse struct {
Success bool `json:"success"`
CustomField CustomFields `json:"customField,omitempty"`
}
2019-02-20 10:07:02 +03:00
// UnitsResponse type.
2019-02-20 10:07:02 +03:00
type UnitsResponse struct {
2019-09-04 11:38:21 +03:00
Success bool `json:"success"`
Units *[]Unit `json:"units,omitempty"`
2019-02-20 10:07:02 +03:00
}
// ErrorResponse should be returned to the one-step connection request in case of failure.
type ErrorResponse struct {
SuccessfulResponse
ErrorMessage string `json:"errorMsg"`
}
// ConnectResponse should be returned to the one-step connection request in case of successful connection.
type ConnectResponse struct {
SuccessfulResponse
AccountURL string `json:"accountUrl"`
}
// ConnectionConfigResponse contains connection configuration for one-step connection.
type ConnectionConfigResponse struct {
SuccessfulResponse
Scopes []string `json:"scopes"`
RegisterURL string `json:"registerUrl"`
}
// NewConnectResponse returns ConnectResponse with the provided account URL.
func NewConnectResponse(accountURL string) ConnectResponse {
return ConnectResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
AccountURL: accountURL,
}
}