-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproductchecklist.go
211 lines (189 loc) · 8.67 KB
/
productchecklist.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package phoebe
import (
"context"
"errors"
"fmt"
"net/http"
"github.com/phoebe-bird/phoebe-go/internal/apijson"
"github.com/phoebe-bird/phoebe-go/internal/requestconfig"
"github.com/phoebe-bird/phoebe-go/option"
)
// ProductChecklistService contains methods and other services that help with
// interacting with the phoebe API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewProductChecklistService] method instead.
type ProductChecklistService struct {
Options []option.RequestOption
}
// NewProductChecklistService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewProductChecklistService(opts ...option.RequestOption) (r *ProductChecklistService) {
r = &ProductChecklistService{}
r.Options = opts
return
}
// Get the details and observations of a checklist.
//
// #### Notes Do NOT use this to download large amounts of data. You will be banned if you do. In the fields for each observation, the following fields are duplicates or obsolete and will be removed at a future date: _howManyAtleast_, _howManyAtmost_, _hideFlags_, _projId_, _subId_, _subnational1Code_ and _present_.
func (r *ProductChecklistService) View(ctx context.Context, subID string, opts ...option.RequestOption) (res *ProductChecklistViewResponse, err error) {
opts = append(r.Options[:], opts...)
if subID == "" {
err = errors.New("missing required subId parameter")
return
}
path := fmt.Sprintf("product/checklist/view/%s", subID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
type ProductChecklistViewResponse struct {
AllObsReported bool `json:"allObsReported"`
ChecklistID string `json:"checklistId"`
CreationDt string `json:"creationDt"`
DurationHrs float64 `json:"durationHrs"`
ISOObsDate string `json:"isoObsDate"`
LastEditedDt string `json:"lastEditedDt"`
Loc ProductChecklistViewResponseLoc `json:"loc"`
LocID string `json:"locId"`
NumObservers int64 `json:"numObservers"`
NumSpecies int64 `json:"numSpecies"`
Obs []ProductChecklistViewResponseOb `json:"obs"`
ObsDt string `json:"obsDt"`
ObsTime string `json:"obsTime"`
ObsTimeValid bool `json:"obsTimeValid"`
ProjID string `json:"projId"`
ProtocolID string `json:"protocolId"`
SubID string `json:"subId"`
SubmissionMethodCode string `json:"submissionMethodCode"`
Subnational1Code string `json:"subnational1Code"`
UserDisplayName string `json:"userDisplayName"`
JSON productChecklistViewResponseJSON `json:"-"`
}
// productChecklistViewResponseJSON contains the JSON metadata for the struct
// [ProductChecklistViewResponse]
type productChecklistViewResponseJSON struct {
AllObsReported apijson.Field
ChecklistID apijson.Field
CreationDt apijson.Field
DurationHrs apijson.Field
ISOObsDate apijson.Field
LastEditedDt apijson.Field
Loc apijson.Field
LocID apijson.Field
NumObservers apijson.Field
NumSpecies apijson.Field
Obs apijson.Field
ObsDt apijson.Field
ObsTime apijson.Field
ObsTimeValid apijson.Field
ProjID apijson.Field
ProtocolID apijson.Field
SubID apijson.Field
SubmissionMethodCode apijson.Field
Subnational1Code apijson.Field
UserDisplayName apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ProductChecklistViewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r productChecklistViewResponseJSON) RawJSON() string {
return r.raw
}
type ProductChecklistViewResponseLoc struct {
CountryCode string `json:"countryCode"`
CountryName string `json:"countryName"`
HierarchicalName string `json:"hierarchicalName"`
IsHotspot bool `json:"isHotspot"`
Lat float64 `json:"lat"`
Latitude float64 `json:"latitude"`
Lng float64 `json:"lng"`
LocID string `json:"locId"`
LocName string `json:"locName"`
Longitude float64 `json:"longitude"`
Name string `json:"name"`
Subnational1Code string `json:"subnational1Code"`
Subnational1Name string `json:"subnational1Name"`
JSON productChecklistViewResponseLocJSON `json:"-"`
}
// productChecklistViewResponseLocJSON contains the JSON metadata for the struct
// [ProductChecklistViewResponseLoc]
type productChecklistViewResponseLocJSON struct {
CountryCode apijson.Field
CountryName apijson.Field
HierarchicalName apijson.Field
IsHotspot apijson.Field
Lat apijson.Field
Latitude apijson.Field
Lng apijson.Field
LocID apijson.Field
LocName apijson.Field
Longitude apijson.Field
Name apijson.Field
Subnational1Code apijson.Field
Subnational1Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ProductChecklistViewResponseLoc) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r productChecklistViewResponseLocJSON) RawJSON() string {
return r.raw
}
type ProductChecklistViewResponseOb struct {
ObsAux []ProductChecklistViewResponseObsObsAux `json:"obsAux"`
ObsDt string `json:"obsDt"`
ObsID string `json:"obsId"`
SpeciesCode string `json:"speciesCode"`
JSON productChecklistViewResponseObJSON `json:"-"`
}
// productChecklistViewResponseObJSON contains the JSON metadata for the struct
// [ProductChecklistViewResponseOb]
type productChecklistViewResponseObJSON struct {
ObsAux apijson.Field
ObsDt apijson.Field
ObsID apijson.Field
SpeciesCode apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ProductChecklistViewResponseOb) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r productChecklistViewResponseObJSON) RawJSON() string {
return r.raw
}
type ProductChecklistViewResponseObsObsAux struct {
AuxCode string `json:"auxCode"`
EntryMethodCode string `json:"entryMethodCode"`
FieldName string `json:"fieldName"`
ObsID string `json:"obsId"`
SpeciesCode string `json:"speciesCode"`
SubID string `json:"subId"`
Value string `json:"value"`
JSON productChecklistViewResponseObsObsAuxJSON `json:"-"`
}
// productChecklistViewResponseObsObsAuxJSON contains the JSON metadata for the
// struct [ProductChecklistViewResponseObsObsAux]
type productChecklistViewResponseObsObsAuxJSON struct {
AuxCode apijson.Field
EntryMethodCode apijson.Field
FieldName apijson.Field
ObsID apijson.Field
SpeciesCode apijson.Field
SubID apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ProductChecklistViewResponseObsObsAux) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r productChecklistViewResponseObsObsAuxJSON) RawJSON() string {
return r.raw
}