forked from cidertool/asc-go
/
reporting_power_performance_metrics.go
173 lines (148 loc) · 7.11 KB
/
reporting_power_performance_metrics.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/**
Copyright (C) 2020 Aaron Sky.
This file is part of asc-go, a package for working with Apple's
App Store Connect API.
asc-go is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
asc-go is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with asc-go. If not, see <http://www.gnu.org/licenses/>.
*/
package asc
import (
"context"
"fmt"
)
// DiagnosticLog defines model for DiagnosticLog.
//
// https://developer.apple.com/documentation/appstoreconnectapi/diagnosticlog
type DiagnosticLog struct {
ID string `json:"id"`
Links ResourceLinks `json:"links"`
Type string `json:"type"`
}
// DiagnosticLogsResponse defines model for DiagnosticLogsResponse.
//
// https://developer.apple.com/documentation/appstoreconnectapi/diagnosticlogsresponse
type DiagnosticLogsResponse struct {
Data []DiagnosticLog `json:"data"`
Links PagedDocumentLinks `json:"links"`
Meta *PagingInformation `json:"meta,omitempty"`
}
// DiagnosticSignature defines model for DiagnosticSignature.
//
// https://developer.apple.com/documentation/appstoreconnectapi/diagnosticsignature
type DiagnosticSignature struct {
Attributes *DiagnosticSignatureAttributes `json:"attributes,omitempty"`
ID string `json:"id"`
Links ResourceLinks `json:"links"`
Type string `json:"type"`
}
// DiagnosticSignatureAttributes defines model for DiagnosticSignature.Attributes
//
// https://developer.apple.com/documentation/appstoreconnectapi/diagnosticsignature/attributes
type DiagnosticSignatureAttributes struct {
DiagnosticType *string `json:"diagnosticType,omitempty"`
Signature *string `json:"signature,omitempty"`
Weight *float32 `json:"weight,omitempty"`
}
// DiagnosticSignaturesResponse defines model for DiagnosticSignaturesResponse.
//
// https://developer.apple.com/documentation/appstoreconnectapi/diagnosticsignaturesresponse
type DiagnosticSignaturesResponse struct {
Data []DiagnosticSignature `json:"data"`
Included []DiagnosticLog `json:"included,omitempty"`
Links PagedDocumentLinks `json:"links"`
Meta *PagingInformation `json:"meta,omitempty"`
}
// PerfPowerMetric defines model for PerfPowerMetric.
//
// https://developer.apple.com/documentation/appstoreconnectapi/perfpowermetric
type PerfPowerMetric struct {
Attributes *PerfPowerMetricAttributes `json:"attributes,omitempty"`
ID string `json:"id"`
Links ResourceLinks `json:"links"`
Type string `json:"type"`
}
// PerfPowerMetricAttributes defines model for PerfPowerMetric.Attributes
//
// https://developer.apple.com/documentation/appstoreconnectapi/perfpowermetric/attributes
type PerfPowerMetricAttributes struct {
DeviceType *string `json:"deviceType,omitempty"`
MetricType *string `json:"metricType,omitempty"`
Platform *string `json:"platform,omitempty"`
}
// PerfPowerMetricsResponse defines model for PerfPowerMetricsResponse.
//
// https://developer.apple.com/documentation/appstoreconnectapi/perfpowermetricsresponse
type PerfPowerMetricsResponse struct {
Data []PerfPowerMetric `json:"data"`
Links PagedDocumentLinks `json:"links"`
Meta *PagingInformation `json:"meta,omitempty"`
}
// GetPerfPowerMetricsQuery are query options for GetPerfPowerMetrics
//
// https://developer.apple.com/documentation/appstoreconnectapi/get_power_and_performance_metrics_for_a_build
type GetPerfPowerMetricsQuery struct {
FilterDeviceType []string `url:"filter[deviceType],omitempty"`
FilterMetricType []string `url:"filter[metricType],omitempty"`
FilterPlatform []string `url:"filter[platform],omitempty"`
Cursor string `url:"cursor,omitempty"`
}
// ListDiagnosticsSignaturesQuery are query options for ListDiagnosticsSignatures
//
// https://developer.apple.com/documentation/appstoreconnectapi/list_all_diagnostic_signatures_for_a_build
type ListDiagnosticsSignaturesQuery struct {
FieldsDiagnosticSignatures []string `url:"fields[diagnosticSignatures],omitempty"`
FilterDiagnosticType []string `url:"filter[diagnosticType],omitempty"`
Limit int `url:"limit,omitempty"`
Cursor string `url:"cursor,omitempty"`
}
// GetLogsForDiagnosticSignatureQuery are query options for GetLogsForDiagnosticSignature
//
// https://developer.apple.com/documentation/appstoreconnectapi/download_logs_for_a_diagnostic_signature
type GetLogsForDiagnosticSignatureQuery struct {
Limit int `url:"limit,omitempty"`
Cursor string `url:"cursor,omitempty"`
}
// GetPerfPowerMetricsForApp gets the performance and power metrics data for the most recent versions of an app.
//
// https://developer.apple.com/documentation/appstoreconnectapi/get_power_and_performance_metrics_for_an_app
func (s *ReportingService) GetPerfPowerMetricsForApp(ctx context.Context, id string, params *GetPerfPowerMetricsQuery) (*PerfPowerMetricsResponse, *Response, error) {
url := fmt.Sprintf("apps/%s/perfPowerMetrics", id)
res := new(PerfPowerMetricsResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}
// GetPerfPowerMetricsForBuild gets the performance and power metrics data for a specific build.
//
// https://developer.apple.com/documentation/appstoreconnectapi/get_power_and_performance_metrics_for_a_build
func (s *ReportingService) GetPerfPowerMetricsForBuild(ctx context.Context, id string, params *GetPerfPowerMetricsQuery) (*PerfPowerMetricsResponse, *Response, error) {
url := fmt.Sprintf("builds/%s/perfPowerMetrics", id)
res := new(PerfPowerMetricsResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}
// ListDiagnosticSignaturesForBuild lists the aggregate backtrace signatures captured for a specific build.
//
// https://developer.apple.com/documentation/appstoreconnectapi/list_all_diagnostic_signatures_for_a_build
func (s *ReportingService) ListDiagnosticSignaturesForBuild(ctx context.Context, id string, params *ListDiagnosticsSignaturesQuery) (*DiagnosticSignaturesResponse, *Response, error) {
url := fmt.Sprintf("builds/%s/diagnosticSignatures", id)
res := new(DiagnosticSignaturesResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}
// GetLogsForDiagnosticSignature gets the anonymized backtrace logs associated with a specific diagnostic signature.
//
// https://developer.apple.com/documentation/appstoreconnectapi/download_logs_for_a_diagnostic_signature
func (s *ReportingService) GetLogsForDiagnosticSignature(ctx context.Context, id string, params *GetLogsForDiagnosticSignatureQuery) (*DiagnosticLogsResponse, *Response, error) {
url := fmt.Sprintf("diagnosticSignatures/%s/logs", id)
res := new(DiagnosticLogsResponse)
resp, err := s.client.get(ctx, url, params, res)
return res, resp, err
}