-
Notifications
You must be signed in to change notification settings - Fork 4
/
report_profit_service.go
87 lines (74 loc) · 6.04 KB
/
report_profit_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package moysklad
import (
"context"
"github.com/go-resty/resty/v2"
)
// ReportProfitService
// Сервис для работы с отчётом "Прибыльность".
type ReportProfitService struct {
Endpoint
}
func NewReportProfitService(client *Client) *ReportProfitService {
e := NewEndpoint(client, "report/profit")
return &ReportProfitService{e}
}
// GetByProduct Запрос на получение отчета "Прибыльность по товарам".
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-towaram
func (s *ReportProfitService) GetByProduct(ctx context.Context, params *Params) (*List[ProfitByProduct], *resty.Response, error) {
path := "report/profit/byproduct"
return NewRequestBuilder[List[ProfitByProduct]](s.client, path).SetParams(params).Get(ctx)
}
// GetByVariant Запрос на получение отчета "Прибыльность по модификациям".
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-modifikaciqm
func (s *ReportProfitService) GetByVariant(ctx context.Context, params *Params) (*List[ProfitByVariant], *resty.Response, error) {
path := "report/profit/byvariant"
return NewRequestBuilder[List[ProfitByVariant]](s.client, path).SetParams(params).Get(ctx)
}
// GetByEmployee Запрос на получение отчета "Прибыльность по сотрудникам".
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-sotrudnikam
func (s *ReportProfitService) GetByEmployee(ctx context.Context, params *Params) (*List[ProfitByEmployee], *resty.Response, error) {
path := "report/profit/byemployee"
return NewRequestBuilder[List[ProfitByEmployee]](s.client, path).SetParams(params).Get(ctx)
}
// GetByCounterparty Запрос на получение отчета "Прибыльность по покупателям".
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-pokupatelqm
func (s *ReportProfitService) GetByCounterparty(ctx context.Context, params *Params) (*List[ProfitByCounterparty], *resty.Response, error) {
path := "report/profit/bycounterparty"
return NewRequestBuilder[List[ProfitByCounterparty]](s.client, path).SetParams(params).Get(ctx)
}
// GetBySalesChannel Запрос на получение отчета "Прибыльность по каналам продаж".
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-kanalam-prodazh
func (s *ReportProfitService) GetBySalesChannel(ctx context.Context, params *Params) (*List[ProfitBySalesChannel], *resty.Response, error) {
path := "report/profit/bysaleschannel"
return NewRequestBuilder[List[ProfitBySalesChannel]](s.client, path).SetParams(params).Get(ctx)
}
// GetByProductAsync Запрос на получение отчета "Прибыльность по товарам" (асинхронно).
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-towaram
func (s *ReportProfitService) GetByProductAsync(ctx context.Context, params *Params) (*AsyncResultService[List[ProfitByProduct]], *resty.Response, error) {
path := "report/profit/byproduct"
return NewRequestBuilder[List[ProfitByProduct]](s.client, path).SetParams(params).Async(ctx)
}
// GetByVariantAsync Запрос на получение отчета "Прибыльность по модификациям" (асинхронно).
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-modifikaciqm
func (s *ReportProfitService) GetByVariantAsync(ctx context.Context, params *Params) (*AsyncResultService[List[ProfitByVariant]], *resty.Response, error) {
path := "report/profit/byvariant"
return NewRequestBuilder[List[ProfitByVariant]](s.client, path).SetParams(params).Async(ctx)
}
// GetByEmployeeAsync Запрос на получение отчета "Прибыльность по сотрудникам" (асинхронно).
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-sotrudnikam
func (s *ReportProfitService) GetByEmployeeAsync(ctx context.Context, params *Params) (*AsyncResultService[List[ProfitByEmployee]], *resty.Response, error) {
path := "report/profit/byemployee"
return NewRequestBuilder[List[ProfitByEmployee]](s.client, path).SetParams(params).Async(ctx)
}
// GetByCounterpartyAsync Запрос на получение отчета "Прибыльность по покупателям" (асинхронно).
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-pokupatelqm
func (s *ReportProfitService) GetByCounterpartyAsync(ctx context.Context, params *Params) (*AsyncResultService[List[ProfitByCounterparty]], *resty.Response, error) {
path := "report/profit/bycounterparty"
return NewRequestBuilder[List[ProfitByCounterparty]](s.client, path).SetParams(params).Async(ctx)
}
// GetBySalesChannelAsync Запрос на получение отчета "Прибыльность по каналам продаж" (асинхронно).
// Документация МойСклад: https://dev.moysklad.ru/doc/api/remap/1.2/reports/#otchety-otchet-pribyl-nost-poluchit-pribyl-nost-po-kanalam-prodazh
func (s *ReportProfitService) GetBySalesChannelAsync(ctx context.Context, params *Params) (*AsyncResultService[List[ProfitBySalesChannel]], *resty.Response, error) {
path := "report/profit/bysaleschannel"
return NewRequestBuilder[List[ProfitBySalesChannel]](s.client, path).SetParams(params).Async(ctx)
}