1// Copyright YEAR Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package additionalpropsobjs provides access to the Example API.
8//
9// # Library status
10//
11// These client libraries are officially supported by Google. However, this
12// library is considered complete and is in maintenance mode. This means
13// that we will address critical bugs and security issues but will not add
14// any new features.
15//
16// When possible, we recommend using our newer
17// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
18// that are still actively being worked and iterated on.
19//
20// # Creating a client
21//
22// Usage example:
23//
24// import "google.golang.org/api/additionalpropsobjs/v1"
25// ...
26// ctx := context.Background()
27// additionalpropsobjsService, err := additionalpropsobjs.NewService(ctx)
28//
29// In this example, Google Application Default Credentials are used for
30// authentication. For information on how to create and obtain Application
31// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
32//
33// # Other authentication options
34//
35// To use an API key for authentication (note: some APIs do not support API
36// keys), use [google.golang.org/api/option.WithAPIKey]:
37//
38// additionalpropsobjsService, err := additionalpropsobjs.NewService(ctx, option.WithAPIKey("AIza..."))
39//
40// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
41// flow, use [google.golang.org/api/option.WithTokenSource]:
42//
43// config := &oauth2.Config{...}
44// // ...
45// token, err := config.Exchange(ctx, ...)
46// additionalpropsobjsService, err := additionalpropsobjs.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
47//
48// See [google.golang.org/api/option.ClientOption] for details on options.
49package additionalpropsobjs // import "google.golang.org/api/additionalpropsobjs/v1"
50
51import (
52 "bytes"
53 "context"
54 "encoding/json"
55 "errors"
56 "fmt"
57 "io"
58 "net/http"
59 "net/url"
60 "strconv"
61 "strings"
62
63 googleapi "google.golang.org/api/googleapi"
64 internal "google.golang.org/api/internal"
65 gensupport "google.golang.org/api/internal/gensupport"
66 option "google.golang.org/api/option"
67 internaloption "google.golang.org/api/option/internaloption"
68 htransport "google.golang.org/api/transport/http"
69)
70
71// Always reference these packages, just in case the auto-generated code
72// below doesn't.
73var _ = bytes.NewBuffer
74var _ = strconv.Itoa
75var _ = fmt.Sprintf
76var _ = json.NewDecoder
77var _ = io.Copy
78var _ = url.Parse
79var _ = gensupport.MarshalJSON
80var _ = googleapi.Version
81var _ = errors.New
82var _ = strings.Replace
83var _ = context.Canceled
84var _ = internaloption.WithDefaultEndpoint
85var _ = internal.Version
86
87const apiId = "additionalpropsobjs:v1"
88const apiName = "additionalpropsobjs"
89const apiVersion = "v1"
90const basePath = "https://www.googleapis.com/discovery/v1/apis"
91const basePathTemplate = "https://www.UNIVERSE_DOMAIN/discovery/v1/apis"
92
93// NewService creates a new Service.
94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
95 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
96 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
97 opts = append(opts, internaloption.EnableNewAuthLibrary())
98 client, endpoint, err := htransport.NewClient(ctx, opts...)
99 if err != nil {
100 return nil, err
101 }
102 s, err := New(client)
103 if err != nil {
104 return nil, err
105 }
106 if endpoint != "" {
107 s.BasePath = endpoint
108 }
109 return s, nil
110}
111
112// New creates a new Service. It uses the provided http.Client for requests.
113//
114// Deprecated: please use NewService instead.
115// To provide a custom HTTP client, use option.WithHTTPClient.
116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
117func New(client *http.Client) (*Service, error) {
118 if client == nil {
119 return nil, errors.New("client is nil")
120 }
121 s := &Service{client: client, BasePath: basePath}
122 return s, nil
123}
124
125type Service struct {
126 client *http.Client
127 BasePath string // API endpoint base URL
128 UserAgent string // optional additional User-Agent fragment
129}
130
131func (s *Service) userAgent() string {
132 if s.UserAgent == "" {
133 return googleapi.UserAgent
134 }
135 return googleapi.UserAgent + " " + s.UserAgent
136}
137
138type GeoJsonGeometry map[string]interface{}
139
140func (t GeoJsonGeometry) Type() string {
141 return googleapi.VariantType(t)
142}
143
144func (t GeoJsonGeometry) GeometryCollection() (r GeoJsonGeometryCollection, ok bool) {
145 if t.Type() != "GeometryCollection" {
146 return r, false
147 }
148 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
149 return r, ok
150}
151
152func (t GeoJsonGeometry) LineString() (r GeoJsonLineString, ok bool) {
153 if t.Type() != "LineString" {
154 return r, false
155 }
156 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
157 return r, ok
158}
159
160func (t GeoJsonGeometry) MultiLineString() (r GeoJsonMultiLineString, ok bool) {
161 if t.Type() != "MultiLineString" {
162 return r, false
163 }
164 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
165 return r, ok
166}
167
168func (t GeoJsonGeometry) MultiPoint() (r GeoJsonMultiPoint, ok bool) {
169 if t.Type() != "MultiPoint" {
170 return r, false
171 }
172 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
173 return r, ok
174}
175
176func (t GeoJsonGeometry) MultiPolygon() (r GeoJsonMultiPolygon, ok bool) {
177 if t.Type() != "MultiPolygon" {
178 return r, false
179 }
180 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
181 return r, ok
182}
183
184func (t GeoJsonGeometry) Point() (r GeoJsonPoint, ok bool) {
185 if t.Type() != "Point" {
186 return r, false
187 }
188 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
189 return r, ok
190}
191
192func (t GeoJsonGeometry) Polygon() (r GeoJsonPolygon, ok bool) {
193 if t.Type() != "Polygon" {
194 return r, false
195 }
196 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
197 return r, ok
198}
199
200// GeoJsonGeometryCollection: A heterogenous collection of GeoJsonGeometry
201// objects.
202type GeoJsonGeometryCollection struct {
203 // Geometries: An array of geometry objects. There must be at least 2 different
204 // types of geometries in the array.
205 Geometries []GeoJsonGeometry `json:"geometries,omitempty"`
206 // Type: Identifies this object as a GeoJsonGeometryCollection.
207 //
208 // Possible values:
209 // "GeometryCollection"
210 Type string `json:"type,omitempty"`
211 // ForceSendFields is a list of field names (e.g. "Geometries") to
212 // unconditionally include in API requests. By default, fields with empty or
213 // default values are omitted from API requests. See
214 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
215 // details.
216 ForceSendFields []string `json:"-"`
217 // NullFields is a list of field names (e.g. "Geometries") to include in API
218 // requests with the JSON null value. By default, fields with empty values are
219 // omitted from API requests. See
220 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
221 NullFields []string `json:"-"`
222}
223
224func (s *GeoJsonGeometryCollection) MarshalJSON() ([]byte, error) {
225 type NoMethod GeoJsonGeometryCollection
226 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
227}
228
229type GeoJsonLineString struct {
230 // Coordinates: An array of two or more positions, representing a line.
231 Coordinates [][]float64 `json:"coordinates,omitempty"`
232 // Type: Identifies this object as a GeoJsonLineString.
233 //
234 // Possible values:
235 // "LineString"
236 Type string `json:"type,omitempty"`
237 // ForceSendFields is a list of field names (e.g. "Coordinates") to
238 // unconditionally include in API requests. By default, fields with empty or
239 // default values are omitted from API requests. See
240 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
241 // details.
242 ForceSendFields []string `json:"-"`
243 // NullFields is a list of field names (e.g. "Coordinates") to include in API
244 // requests with the JSON null value. By default, fields with empty values are
245 // omitted from API requests. See
246 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
247 NullFields []string `json:"-"`
248}
249
250func (s *GeoJsonLineString) MarshalJSON() ([]byte, error) {
251 type NoMethod GeoJsonLineString
252 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
253}
254
255// GeoJsonMultiLineString: Multi Line String
256type GeoJsonMultiLineString struct {
257 // Coordinates: An array of at least two GeoJsonLineString coordinate arrays.
258 Coordinates [][][]float64 `json:"coordinates,omitempty"`
259 // Type: Identifies this object as a GeoJsonMultiLineString.
260 //
261 // Possible values:
262 // "MultiLineString"
263 Type string `json:"type,omitempty"`
264 // ForceSendFields is a list of field names (e.g. "Coordinates") to
265 // unconditionally include in API requests. By default, fields with empty or
266 // default values are omitted from API requests. See
267 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
268 // details.
269 ForceSendFields []string `json:"-"`
270 // NullFields is a list of field names (e.g. "Coordinates") to include in API
271 // requests with the JSON null value. By default, fields with empty values are
272 // omitted from API requests. See
273 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
274 NullFields []string `json:"-"`
275}
276
277func (s *GeoJsonMultiLineString) MarshalJSON() ([]byte, error) {
278 type NoMethod GeoJsonMultiLineString
279 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
280}
281
282type GeoJsonMultiPoint struct {
283 // Coordinates: An array of at least two GeoJsonPoint coordinate arrays.
284 Coordinates [][]float64 `json:"coordinates,omitempty"`
285 // Type: Identifies this object as a GeoJsonMultiPoint.
286 //
287 // Possible values:
288 // "MultiPoint"
289 Type string `json:"type,omitempty"`
290 // ForceSendFields is a list of field names (e.g. "Coordinates") to
291 // unconditionally include in API requests. By default, fields with empty or
292 // default values are omitted from API requests. See
293 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
294 // details.
295 ForceSendFields []string `json:"-"`
296 // NullFields is a list of field names (e.g. "Coordinates") to include in API
297 // requests with the JSON null value. By default, fields with empty values are
298 // omitted from API requests. See
299 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
300 NullFields []string `json:"-"`
301}
302
303func (s *GeoJsonMultiPoint) MarshalJSON() ([]byte, error) {
304 type NoMethod GeoJsonMultiPoint
305 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
306}
307
308type GeoJsonMultiPolygon struct {
309 // Coordinates: An array of at least two GeoJsonPolygon coordinate arrays.
310 Coordinates [][][][]float64 `json:"coordinates,omitempty"`
311 // Type: Identifies this object as a GeoJsonMultiPolygon.
312 //
313 // Possible values:
314 // "MultiPolygon"
315 Type string `json:"type,omitempty"`
316 // ForceSendFields is a list of field names (e.g. "Coordinates") to
317 // unconditionally include in API requests. By default, fields with empty or
318 // default values are omitted from API requests. See
319 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
320 // details.
321 ForceSendFields []string `json:"-"`
322 // NullFields is a list of field names (e.g. "Coordinates") to include in API
323 // requests with the JSON null value. By default, fields with empty values are
324 // omitted from API requests. See
325 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
326 NullFields []string `json:"-"`
327}
328
329func (s *GeoJsonMultiPolygon) MarshalJSON() ([]byte, error) {
330 type NoMethod GeoJsonMultiPolygon
331 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
332}
333
334type GeoJsonPoint struct {
335 // Coordinates: A single GeoJsonPosition, specifying the location of the point.
336 Coordinates []float64 `json:"coordinates,omitempty"`
337 // Type: Identifies this object as a GeoJsonPoint.
338 //
339 // Possible values:
340 // "Point"
341 Type string `json:"type,omitempty"`
342 // ForceSendFields is a list of field names (e.g. "Coordinates") to
343 // unconditionally include in API requests. By default, fields with empty or
344 // default values are omitted from API requests. See
345 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
346 // details.
347 ForceSendFields []string `json:"-"`
348 // NullFields is a list of field names (e.g. "Coordinates") to include in API
349 // requests with the JSON null value. By default, fields with empty values are
350 // omitted from API requests. See
351 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
352 NullFields []string `json:"-"`
353}
354
355func (s *GeoJsonPoint) MarshalJSON() ([]byte, error) {
356 type NoMethod GeoJsonPoint
357 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
358}
359
360type GeoJsonPolygon struct {
361 // Coordinates: An array of LinearRings, each of which is an array of four or
362 // more GeoJsonPositions. The first and last coordinates in each LinearRing
363 // must be the same. For polygons with multiple rings, the first LinearRing is
364 // the external ring, with subsequent rings being interior rings (i.e. hole).
365 // All LinearRings must contain GeoJsonPositions in counter-clockwise order.
366 Coordinates [][][]float64 `json:"coordinates,omitempty"`
367 // Type: Identifies this object as a GeoJsonPolygon.
368 //
369 // Possible values:
370 // "Polygon"
371 Type string `json:"type,omitempty"`
372 // ForceSendFields is a list of field names (e.g. "Coordinates") to
373 // unconditionally include in API requests. By default, fields with empty or
374 // default values are omitted from API requests. See
375 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
376 // details.
377 ForceSendFields []string `json:"-"`
378 // NullFields is a list of field names (e.g. "Coordinates") to include in API
379 // requests with the JSON null value. By default, fields with empty values are
380 // omitted from API requests. See
381 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
382 NullFields []string `json:"-"`
383}
384
385func (s *GeoJsonPolygon) MarshalJSON() ([]byte, error) {
386 type NoMethod GeoJsonPolygon
387 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
388}
389
390type MapFolder struct {
391 Contents []MapItem `json:"contents,omitempty"`
392 // DefaultViewport: An array of four numbers (west, south, east, north) which
393 // defines the rectangular bounding box of the default viewport. The numbers
394 // represent latitude and longitude in decimal degrees.
395 DefaultViewport []float64 `json:"defaultViewport,omitempty"`
396 // Expandable: The expandability setting of this MapFolder. If true, the folder
397 // can be expanded.
398 Expandable bool `json:"expandable,omitempty"`
399 // Key: A user defined alias for this MapFolder, specific to this Map.
400 Key string `json:"key,omitempty"`
401 // Name: The name of this MapFolder.
402 Name string `json:"name,omitempty"`
403 // Type: Identifies this object as a MapFolder.
404 //
405 // Possible values:
406 // "folder"
407 Type string `json:"type,omitempty"`
408 // Visibility: The visibility setting of this MapFolder. One of "defaultOn" or
409 // "defaultOff".
410 Visibility string `json:"visibility,omitempty"`
411 // ForceSendFields is a list of field names (e.g. "Contents") to
412 // unconditionally include in API requests. By default, fields with empty or
413 // default values are omitted from API requests. See
414 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
415 // details.
416 ForceSendFields []string `json:"-"`
417 // NullFields is a list of field names (e.g. "Contents") to include in API
418 // requests with the JSON null value. By default, fields with empty values are
419 // omitted from API requests. See
420 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
421 NullFields []string `json:"-"`
422}
423
424func (s *MapFolder) MarshalJSON() ([]byte, error) {
425 type NoMethod MapFolder
426 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
427}
428
429func (s *MapFolder) UnmarshalJSON(data []byte) error {
430 type NoMethod MapFolder
431 var s1 struct {
432 DefaultViewport []gensupport.JSONFloat64 `json:"defaultViewport"`
433 *NoMethod
434 }
435 s1.NoMethod = (*NoMethod)(s)
436 if err := json.Unmarshal(data, &s1); err != nil {
437 return err
438 }
439 s.DefaultViewport = make([]float64, len(s1.DefaultViewport))
440 for i := range s1.DefaultViewport {
441 s.DefaultViewport[i] = float64(s1.DefaultViewport[i])
442 }
443 return nil
444}
445
446type MapItem map[string]interface{}
447
448func (t MapItem) Type() string {
449 return googleapi.VariantType(t)
450}
451
452func (t MapItem) Folder() (r MapFolder, ok bool) {
453 if t.Type() != "Folder" {
454 return r, false
455 }
456 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
457 return r, ok
458}
459
460func (t MapItem) KmlLink() (r MapKmlLink, ok bool) {
461 if t.Type() != "KmlLink" {
462 return r, false
463 }
464 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
465 return r, ok
466}
467
468func (t MapItem) Layer() (r MapLayer, ok bool) {
469 if t.Type() != "Layer" {
470 return r, false
471 }
472 ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
473 return r, ok
474}
475
476type MapKmlLink struct {
477 // DefaultViewport: An array of four numbers (west, south, east, north) which
478 // defines the rectangular bounding box of the default viewport. The numbers
479 // represent latitude and longitude in decimal degrees.
480 DefaultViewport []float64 `json:"defaultViewport,omitempty"`
481 // KmlUrl: The URL to the KML file represented by this MapKmlLink.
482 KmlUrl string `json:"kmlUrl,omitempty"`
483 // Name: The name of this MapKmlLink.
484 Name string `json:"name,omitempty"`
485 // Type: Identifies this object as a MapKmlLink.
486 //
487 // Possible values:
488 // "kmlLink"
489 Type string `json:"type,omitempty"`
490 // Visibility: The visibility setting of this MapKmlLink. One of "defaultOn" or
491 // "defaultOff".
492 Visibility string `json:"visibility,omitempty"`
493 // ForceSendFields is a list of field names (e.g. "DefaultViewport") to
494 // unconditionally include in API requests. By default, fields with empty or
495 // default values are omitted from API requests. See
496 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
497 // details.
498 ForceSendFields []string `json:"-"`
499 // NullFields is a list of field names (e.g. "DefaultViewport") to include in
500 // API requests with the JSON null value. By default, fields with empty values
501 // are omitted from API requests. See
502 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
503 NullFields []string `json:"-"`
504}
505
506func (s *MapKmlLink) MarshalJSON() ([]byte, error) {
507 type NoMethod MapKmlLink
508 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
509}
510
511func (s *MapKmlLink) UnmarshalJSON(data []byte) error {
512 type NoMethod MapKmlLink
513 var s1 struct {
514 DefaultViewport []gensupport.JSONFloat64 `json:"defaultViewport"`
515 *NoMethod
516 }
517 s1.NoMethod = (*NoMethod)(s)
518 if err := json.Unmarshal(data, &s1); err != nil {
519 return err
520 }
521 s.DefaultViewport = make([]float64, len(s1.DefaultViewport))
522 for i := range s1.DefaultViewport {
523 s.DefaultViewport[i] = float64(s1.DefaultViewport[i])
524 }
525 return nil
526}
527
528type MapLayer struct {
529 // DefaultViewport: An array of four numbers (west, south, east, north) which
530 // defines the rectangular bounding box of the default viewport. The numbers
531 // represent latitude and longitude in decimal degrees.
532 DefaultViewport []float64 `json:"defaultViewport,omitempty"`
533 // Id: The ID of this MapLayer. This ID can be used to request more details
534 // about the layer.
535 Id string `json:"id,omitempty"`
536 // Key: A user defined alias for this MapLayer, specific to this Map.
537 Key string `json:"key,omitempty"`
538 // Name: The name of this MapLayer.
539 Name string `json:"name,omitempty"`
540 // Type: Identifies this object as a MapLayer.
541 //
542 // Possible values:
543 // "layer"
544 Type string `json:"type,omitempty"`
545 // Visibility: The visibility setting of this MapLayer. One of "defaultOn" or
546 // "defaultOff".
547 Visibility string `json:"visibility,omitempty"`
548 // ForceSendFields is a list of field names (e.g. "DefaultViewport") to
549 // unconditionally include in API requests. By default, fields with empty or
550 // default values are omitted from API requests. See
551 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
552 // details.
553 ForceSendFields []string `json:"-"`
554 // NullFields is a list of field names (e.g. "DefaultViewport") to include in
555 // API requests with the JSON null value. By default, fields with empty values
556 // are omitted from API requests. See
557 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
558 NullFields []string `json:"-"`
559}
560
561func (s *MapLayer) MarshalJSON() ([]byte, error) {
562 type NoMethod MapLayer
563 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
564}
565
566func (s *MapLayer) UnmarshalJSON(data []byte) error {
567 type NoMethod MapLayer
568 var s1 struct {
569 DefaultViewport []gensupport.JSONFloat64 `json:"defaultViewport"`
570 *NoMethod
571 }
572 s1.NoMethod = (*NoMethod)(s)
573 if err := json.Unmarshal(data, &s1); err != nil {
574 return err
575 }
576 s.DefaultViewport = make([]float64, len(s1.DefaultViewport))
577 for i := range s1.DefaultViewport {
578 s.DefaultViewport[i] = float64(s1.DefaultViewport[i])
579 }
580 return nil
581}
View as plain text