Move to vendor

Signed-off-by: Olivier Gambier <olivier@docker.com>
This commit is contained in:
Olivier Gambier 2016-03-18 14:07:13 -07:00
parent c8d8e7e357
commit 77e69b9cf3
1268 changed files with 34 additions and 24 deletions

View file

@ -0,0 +1,156 @@
// Copyright 2015 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// canonicalDocsURL is a map from auto-generated documentation URL (originating from
// "documentationLink") to a valid (possibly through 301 redirect[s]) URL.
// If the auto-generated URL is not valid, then it maps to "" and will not
// be added to the auto-generated API comments.
// Note that this map is currently updated manually.
var canonicalDocsURL = map[string]string{
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/cancel": "https://cloud.google.com/compute/docs/instance-groups/manager/#cancelrollingupdate",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/get": "https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/insert": "https://cloud.google.com/compute/docs/instance-groups/manager/#starting_an_update",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/list": "https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/listInstanceUpdates": "https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/pause": "https://cloud.google.com/compute/docs/instance-groups/manager/#pausing_a_rolling_update",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/resume": "https://cloud.google.com/compute/docs/instance-groups/manager/#continuerollingupdate",
"https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_servicerollingUpdates/rollback": "https://cloud.google.com/compute/docs/instance-groups/manager/#rollingbackupdate",
"https://developers.google.com/compute/docs/reference/latest/addresses/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/addresses/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/addresses/delete": "https://cloud.google.com/compute/docs/reference/latest/addresses/delete",
"https://developers.google.com/compute/docs/reference/latest/addresses/get": "https://cloud.google.com/compute/docs/reference/latest/addresses/get",
"https://developers.google.com/compute/docs/reference/latest/addresses/insert": "https://cloud.google.com/compute/docs/reference/latest/addresses/insert",
"https://developers.google.com/compute/docs/reference/latest/addresses/list": "https://cloud.google.com/compute/docs/reference/latest/addresses/list",
"https://developers.google.com/compute/docs/reference/latest/backendServices/delete": "https://cloud.google.com/compute/docs/reference/latest/backendServices/delete",
"https://developers.google.com/compute/docs/reference/latest/backendServices/get": "https://cloud.google.com/compute/docs/reference/latest/backendServices/get",
"https://developers.google.com/compute/docs/reference/latest/backendServices/getHealth": "https://cloud.google.com/compute/docs/reference/latest/backendServices/getHealth",
"https://developers.google.com/compute/docs/reference/latest/backendServices/insert": "https://cloud.google.com/compute/docs/reference/latest/backendServices/insert",
"https://developers.google.com/compute/docs/reference/latest/backendServices/list": "https://cloud.google.com/compute/docs/reference/latest/backendServices/list",
"https://developers.google.com/compute/docs/reference/latest/backendServices/patch": "https://cloud.google.com/compute/docs/reference/latest/backendServices/patch",
"https://developers.google.com/compute/docs/reference/latest/backendServices/update": "https://cloud.google.com/compute/docs/reference/latest/backendServices/update",
"https://developers.google.com/compute/docs/reference/latest/diskTypes/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/diskTypes/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/diskTypes/get": "https://cloud.google.com/compute/docs/reference/latest/diskTypes/get",
"https://developers.google.com/compute/docs/reference/latest/diskTypes/list": "https://cloud.google.com/compute/docs/reference/latest/diskTypes/list",
"https://developers.google.com/compute/docs/reference/latest/disks/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/disks/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/disks/createSnapshot": "https://cloud.google.com/compute/docs/reference/latest/disks/createSnapshot",
"https://developers.google.com/compute/docs/reference/latest/disks/delete": "https://cloud.google.com/compute/docs/reference/latest/disks/delete",
"https://developers.google.com/compute/docs/reference/latest/disks/get": "https://cloud.google.com/compute/docs/reference/latest/disks/get",
"https://developers.google.com/compute/docs/reference/latest/disks/insert": "https://cloud.google.com/compute/docs/reference/latest/disks/insert",
"https://developers.google.com/compute/docs/reference/latest/disks/list": "https://cloud.google.com/compute/docs/reference/latest/disks/list",
"https://developers.google.com/compute/docs/reference/latest/firewalls/delete": "https://cloud.google.com/compute/docs/reference/latest/firewalls/delete",
"https://developers.google.com/compute/docs/reference/latest/firewalls/get": "https://cloud.google.com/compute/docs/reference/latest/firewalls/get",
"https://developers.google.com/compute/docs/reference/latest/firewalls/insert": "https://cloud.google.com/compute/docs/reference/latest/firewalls/insert",
"https://developers.google.com/compute/docs/reference/latest/firewalls/list": "https://cloud.google.com/compute/docs/reference/latest/firewalls/list",
"https://developers.google.com/compute/docs/reference/latest/firewalls/patch": "https://cloud.google.com/compute/docs/reference/latest/firewalls/patch",
"https://developers.google.com/compute/docs/reference/latest/firewalls/update": "https://cloud.google.com/compute/docs/reference/latest/firewalls/update",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/delete": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/delete",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/get": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/get",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/insert": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/insert",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/list": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/list",
"https://developers.google.com/compute/docs/reference/latest/forwardingRules/setTarget": "https://cloud.google.com/compute/docs/reference/latest/forwardingRules/setTarget",
"https://developers.google.com/compute/docs/reference/latest/globalAddresses/delete": "https://cloud.google.com/compute/docs/reference/latest/globalAddresses/delete",
"https://developers.google.com/compute/docs/reference/latest/globalAddresses/get": "https://cloud.google.com/compute/docs/reference/latest/globalAddresses/get",
"https://developers.google.com/compute/docs/reference/latest/globalAddresses/insert": "https://cloud.google.com/compute/docs/reference/latest/globalAddresses/insert",
"https://developers.google.com/compute/docs/reference/latest/globalAddresses/list": "https://cloud.google.com/compute/docs/reference/latest/globalAddresses/list",
"https://developers.google.com/compute/docs/reference/latest/globalForwardingRules/delete": "https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules/delete",
"https://developers.google.com/compute/docs/reference/latest/globalForwardingRules/get": "https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules/get",
"https://developers.google.com/compute/docs/reference/latest/globalForwardingRules/insert": "https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules/insert",
"https://developers.google.com/compute/docs/reference/latest/globalForwardingRules/list": "https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules/list",
"https://developers.google.com/compute/docs/reference/latest/globalForwardingRules/setTarget": "https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules/setTarget",
"https://developers.google.com/compute/docs/reference/latest/globalOperations/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/globalOperations/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/globalOperations/delete": "https://cloud.google.com/compute/docs/reference/latest/globalOperations/delete",
"https://developers.google.com/compute/docs/reference/latest/globalOperations/get": "https://cloud.google.com/compute/docs/reference/latest/globalOperations/get",
"https://developers.google.com/compute/docs/reference/latest/globalOperations/list": "https://cloud.google.com/compute/docs/reference/latest/globalOperations/list",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/delete": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/delete",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/get": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/get",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/insert": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/insert",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/list": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/list",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/patch": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/patch",
"https://developers.google.com/compute/docs/reference/latest/httpHealthChecks/update": "https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks/update",
"https://developers.google.com/compute/docs/reference/latest/images/delete": "https://cloud.google.com/compute/docs/reference/latest/images/delete",
"https://developers.google.com/compute/docs/reference/latest/images/deprecate": "https://cloud.google.com/compute/docs/reference/latest/images/deprecate",
"https://developers.google.com/compute/docs/reference/latest/images/get": "https://cloud.google.com/compute/docs/reference/latest/images/get",
"https://developers.google.com/compute/docs/reference/latest/images/insert": "https://cloud.google.com/compute/docs/reference/latest/images/insert",
"https://developers.google.com/compute/docs/reference/latest/images/list": "https://cloud.google.com/compute/docs/reference/latest/images/list",
"https://developers.google.com/compute/docs/reference/latest/instanceTemplates/delete": "https://cloud.google.com/compute/docs/reference/latest/instanceTemplates/delete",
"https://developers.google.com/compute/docs/reference/latest/instanceTemplates/get": "https://cloud.google.com/compute/docs/reference/latest/instanceTemplates/get",
"https://developers.google.com/compute/docs/reference/latest/instanceTemplates/insert": "https://cloud.google.com/compute/docs/reference/latest/instanceTemplates/insert",
"https://developers.google.com/compute/docs/reference/latest/instanceTemplates/list": "https://cloud.google.com/compute/docs/reference/latest/instanceTemplates/list",
"https://developers.google.com/compute/docs/reference/latest/instances/addAccessConfig": "https://cloud.google.com/compute/docs/reference/latest/instances/addAccessConfig",
"https://developers.google.com/compute/docs/reference/latest/instances/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/instances/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/instances/attachDisk": "https://cloud.google.com/compute/docs/reference/latest/instances/attachDisk",
"https://developers.google.com/compute/docs/reference/latest/instances/delete": "https://cloud.google.com/compute/docs/reference/latest/instances/delete",
"https://developers.google.com/compute/docs/reference/latest/instances/deleteAccessConfig": "https://cloud.google.com/compute/docs/reference/latest/instances/deleteAccessConfig",
"https://developers.google.com/compute/docs/reference/latest/instances/detachDisk": "https://cloud.google.com/compute/docs/reference/latest/instances/detachDisk",
"https://developers.google.com/compute/docs/reference/latest/instances/get": "https://cloud.google.com/compute/docs/reference/latest/instances/get",
"https://developers.google.com/compute/docs/reference/latest/instances/getSerialPortOutput": "https://cloud.google.com/compute/docs/reference/latest/instances/getSerialPortOutput",
"https://developers.google.com/compute/docs/reference/latest/instances/insert": "https://cloud.google.com/compute/docs/reference/latest/instances/insert",
"https://developers.google.com/compute/docs/reference/latest/instances/list": "https://cloud.google.com/compute/docs/reference/latest/instances/list",
"https://developers.google.com/compute/docs/reference/latest/instances/reset": "https://cloud.google.com/compute/docs/reference/latest/instances/reset",
"https://developers.google.com/compute/docs/reference/latest/instances/setDiskAutoDelete": "https://cloud.google.com/compute/docs/reference/latest/instances/setDiskAutoDelete",
"https://developers.google.com/compute/docs/reference/latest/instances/setMetadata": "https://cloud.google.com/compute/docs/reference/latest/instances/setMetadata",
"https://developers.google.com/compute/docs/reference/latest/instances/setScheduling": "https://cloud.google.com/compute/docs/reference/latest/instances/setScheduling",
"https://developers.google.com/compute/docs/reference/latest/instances/setTags": "https://cloud.google.com/compute/docs/reference/latest/instances/setTags",
"https://developers.google.com/compute/docs/reference/latest/instances/start": "https://cloud.google.com/compute/docs/reference/latest/instances/start",
"https://developers.google.com/compute/docs/reference/latest/instances/stop": "https://cloud.google.com/compute/docs/reference/latest/instances/stop",
"https://developers.google.com/compute/docs/reference/latest/licenses/get": "https://cloud.google.com/compute/docs/reference/latest/licenses/get",
"https://developers.google.com/compute/docs/reference/latest/machineTypes/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/machineTypes/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/machineTypes/get": "https://cloud.google.com/compute/docs/reference/latest/machineTypes/get",
"https://developers.google.com/compute/docs/reference/latest/machineTypes/list": "https://cloud.google.com/compute/docs/reference/latest/machineTypes/list",
"https://developers.google.com/compute/docs/reference/latest/networks/delete": "https://cloud.google.com/compute/docs/reference/latest/networks/delete",
"https://developers.google.com/compute/docs/reference/latest/networks/get": "https://cloud.google.com/compute/docs/reference/latest/networks/get",
"https://developers.google.com/compute/docs/reference/latest/networks/insert": "https://cloud.google.com/compute/docs/reference/latest/networks/insert",
"https://developers.google.com/compute/docs/reference/latest/networks/list": "https://cloud.google.com/compute/docs/reference/latest/networks/list",
"https://developers.google.com/compute/docs/reference/latest/projects/get": "https://cloud.google.com/compute/docs/reference/latest/projects/get",
"https://developers.google.com/compute/docs/reference/latest/projects/setCommonInstanceMetadata": "https://cloud.google.com/compute/docs/reference/latest/projects/setCommonInstanceMetadata",
"https://developers.google.com/compute/docs/reference/latest/projects/setUsageExportBucket": "https://cloud.google.com/compute/docs/reference/latest/projects/setUsageExportBucket",
"https://developers.google.com/compute/docs/reference/latest/regionOperations/delete": "https://cloud.google.com/compute/docs/reference/latest/regionOperations/delete",
"https://developers.google.com/compute/docs/reference/latest/regionOperations/get": "https://cloud.google.com/compute/docs/reference/latest/regionOperations/get",
"https://developers.google.com/compute/docs/reference/latest/regionOperations/list": "https://cloud.google.com/compute/docs/reference/latest/regionOperations/list",
"https://developers.google.com/compute/docs/reference/latest/regions/get": "https://cloud.google.com/compute/docs/reference/latest/regions/get",
"https://developers.google.com/compute/docs/reference/latest/regions/list": "https://cloud.google.com/compute/docs/reference/latest/regions/list",
"https://developers.google.com/compute/docs/reference/latest/routes/delete": "https://cloud.google.com/compute/docs/reference/latest/routes/delete",
"https://developers.google.com/compute/docs/reference/latest/routes/get": "https://cloud.google.com/compute/docs/reference/latest/routes/get",
"https://developers.google.com/compute/docs/reference/latest/routes/insert": "https://cloud.google.com/compute/docs/reference/latest/routes/insert",
"https://developers.google.com/compute/docs/reference/latest/routes/list": "https://cloud.google.com/compute/docs/reference/latest/routes/list",
"https://developers.google.com/compute/docs/reference/latest/snapshots/delete": "https://cloud.google.com/compute/docs/reference/latest/snapshots/delete",
"https://developers.google.com/compute/docs/reference/latest/snapshots/get": "https://cloud.google.com/compute/docs/reference/latest/snapshots/get",
"https://developers.google.com/compute/docs/reference/latest/snapshots/list": "https://cloud.google.com/compute/docs/reference/latest/snapshots/list",
"https://developers.google.com/compute/docs/reference/latest/targetHttpProxies/delete": "https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies/delete",
"https://developers.google.com/compute/docs/reference/latest/targetHttpProxies/get": "https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies/get",
"https://developers.google.com/compute/docs/reference/latest/targetHttpProxies/insert": "https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies/insert",
"https://developers.google.com/compute/docs/reference/latest/targetHttpProxies/list": "https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies/list",
"https://developers.google.com/compute/docs/reference/latest/targetHttpProxies/setUrlMap": "https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies/setUrlMap",
"https://developers.google.com/compute/docs/reference/latest/targetInstances/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/targetInstances/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/targetInstances/delete": "https://cloud.google.com/compute/docs/reference/latest/targetInstances/delete",
"https://developers.google.com/compute/docs/reference/latest/targetInstances/get": "https://cloud.google.com/compute/docs/reference/latest/targetInstances/get",
"https://developers.google.com/compute/docs/reference/latest/targetInstances/insert": "https://cloud.google.com/compute/docs/reference/latest/targetInstances/insert",
"https://developers.google.com/compute/docs/reference/latest/targetInstances/list": "https://cloud.google.com/compute/docs/reference/latest/targetInstances/list",
"https://developers.google.com/compute/docs/reference/latest/targetPools/addHealthCheck": "https://cloud.google.com/compute/docs/reference/latest/targetPools/addHealthCheck",
"https://developers.google.com/compute/docs/reference/latest/targetPools/addInstance": "https://cloud.google.com/compute/docs/reference/latest/targetPools/addInstance",
"https://developers.google.com/compute/docs/reference/latest/targetPools/aggregatedList": "https://cloud.google.com/compute/docs/reference/latest/targetPools/aggregatedList",
"https://developers.google.com/compute/docs/reference/latest/targetPools/delete": "https://cloud.google.com/compute/docs/reference/latest/targetPools/delete",
"https://developers.google.com/compute/docs/reference/latest/targetPools/get": "https://cloud.google.com/compute/docs/reference/latest/targetPools/get",
"https://developers.google.com/compute/docs/reference/latest/targetPools/getHealth": "https://cloud.google.com/compute/docs/reference/latest/targetPools/getHealth",
"https://developers.google.com/compute/docs/reference/latest/targetPools/insert": "https://cloud.google.com/compute/docs/reference/latest/targetPools/insert",
"https://developers.google.com/compute/docs/reference/latest/targetPools/list": "https://cloud.google.com/compute/docs/reference/latest/targetPools/list",
"https://developers.google.com/compute/docs/reference/latest/targetPools/removeHealthCheck": "https://cloud.google.com/compute/docs/reference/latest/targetPools/removeHealthCheck",
"https://developers.google.com/compute/docs/reference/latest/targetPools/removeInstance": "https://cloud.google.com/compute/docs/reference/latest/targetPools/removeInstance",
"https://developers.google.com/compute/docs/reference/latest/targetPools/setBackup": "https://cloud.google.com/compute/docs/reference/latest/targetPools/setBackup",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/delete": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/delete",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/get": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/get",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/insert": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/insert",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/list": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/list",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/patch": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/patch",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/update": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/update",
"https://developers.google.com/compute/docs/reference/latest/urlMaps/validate": "https://cloud.google.com/compute/docs/reference/latest/urlMaps/validate",
"https://developers.google.com/compute/docs/reference/latest/zoneOperations/delete": "https://cloud.google.com/compute/docs/reference/latest/zoneOperations/delete",
"https://developers.google.com/compute/docs/reference/latest/zoneOperations/get": "https://cloud.google.com/compute/docs/reference/latest/zoneOperations/get",
"https://developers.google.com/compute/docs/reference/latest/zoneOperations/list": "https://cloud.google.com/compute/docs/reference/latest/zoneOperations/list",
"https://developers.google.com/compute/docs/reference/latest/zones/get": "https://cloud.google.com/compute/docs/reference/latest/zones/get",
"https://developers.google.com/compute/docs/reference/latest/zones/list": "https://cloud.google.com/compute/docs/reference/latest/zones/list",
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,175 @@
package main
import (
"bytes"
"flag"
"io/ioutil"
"path/filepath"
"testing"
)
var updateGolden = flag.Bool("update_golden", false, "If true, causes TestAPIs to update golden files")
func TestAPIs(t *testing.T) {
names := []string{
"any",
"arrayofarray-1",
"arrayofenum",
"arrayofmapofobjects",
"arrayofmapofstrings",
"blogger-3",
"getwithoutbody",
"mapofany",
"mapofarrayofobjects",
"mapofobjects",
"mapofstrings-1",
"quotednum",
"resource-named-service", // blogger/v3/blogger-api.json + s/BlogUserInfo/Service/
"unfortunatedefaults",
"variants",
"wrapnewlines",
}
for _, name := range names {
api, err := apiFromFile(filepath.Join("testdata", name+".json"))
if err != nil {
t.Errorf("Error loading API testdata/%s.json: %v", name, err)
continue
}
clean, err := api.GenerateCode()
if err != nil {
t.Errorf("Error generating code for %s: %v", name, err)
continue
}
goldenFile := filepath.Join("testdata", name+".want")
if *updateGolden {
if err := ioutil.WriteFile(goldenFile, clean, 0644); err != nil {
t.Fatal(err)
}
}
want, err := ioutil.ReadFile(goldenFile)
if err != nil {
t.Error(err)
continue
}
if !bytes.Equal(want, clean) {
tf, _ := ioutil.TempFile("", "api-"+name+"-got-json.")
tf.Write(clean)
tf.Close()
t.Errorf("Output for API %s differs: diff -u %s %s", name, goldenFile, tf.Name())
}
}
}
func TestScope(t *testing.T) {
tests := [][]string{
{
"https://www.googleapis.com/auth/somescope",
"SomescopeScope",
},
{
"https://mail.google.com/somescope",
"MailGoogleComSomescopeScope",
},
{
"https://mail.google.com/",
"MailGoogleComScope",
},
}
for _, test := range tests {
if got := scopeIdentifierFromURL(test[0]); got != test[1] {
t.Errorf("scopeIdentifierFromURL(%q) got %q, want %q", test[0], got, test[1])
}
}
}
func TestDepunct(t *testing.T) {
tests := []struct {
needCap bool
in, want string
}{
{
needCap: true,
in: "part__description",
want: "Part__description",
},
{
needCap: true,
in: "Part_description",
want: "PartDescription",
},
{
needCap: false,
in: "part_description",
want: "partDescription",
},
{
needCap: false,
in: "part-description",
want: "partDescription",
},
{
needCap: false,
in: "part.description",
want: "partDescription",
},
{
needCap: false,
in: "part$description",
want: "partDescription",
},
{
needCap: false,
in: "part/description",
want: "partDescription",
},
{
needCap: true,
in: "Part__description_name",
want: "Part__descriptionName",
},
{
needCap: true,
in: "Part_description_name",
want: "PartDescriptionName",
},
{
needCap: true,
in: "Part__description__name",
want: "Part__description__name",
},
{
needCap: true,
in: "Part_description__name",
want: "PartDescription__name",
},
}
for _, test := range tests {
if got := depunct(test.in, test.needCap); got != test.want {
t.Errorf("depunct(%q,%v) = %q; want %q", test.in, test.needCap, got, test.want)
}
}
}
func TestRenameVersion(t *testing.T) {
tests := []struct {
version, want string
}{
{
version: "directory_v1",
want: "directory/v1",
},
{
version: "email_migration_v1",
want: "email_migration/v1",
},
{
version: "my_api_v1.2",
want: "my_api/v1.2",
},
}
for _, test := range tests {
if got := renameVersion(test.version); got != test.want {
t.Errorf("renameVersion(%q) = %q; want %q", test.version, got, test.want)
}
}
}

View file

@ -0,0 +1,323 @@
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"testing/iotest"
"golang.org/x/net/context"
storage "google.golang.org/api/storage/v1"
)
type myHandler struct {
location string
r *http.Request
body []byte
err error
}
func (h *myHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.r = r
if h.location != "" {
w.Header().Set("Location", h.location)
}
h.body, h.err = ioutil.ReadAll(r.Body)
fmt.Fprintf(w, "{}")
}
func TestMedia(t *testing.T) {
handler := &myHandler{}
server := httptest.NewServer(handler)
defer server.Close()
client := &http.Client{}
s, err := storage.New(client)
if err != nil {
t.Fatalf("unable to create service: %v", err)
}
s.BasePath = server.URL
const body = "fake media data"
f := strings.NewReader(body)
o := &storage.Object{
Bucket: "mybucket",
Name: "filename",
ContentType: "plain/text",
ContentEncoding: "utf-8",
ContentLanguage: "en",
}
_, err = s.Objects.Insert("mybucket", o).Media(f).Do()
if err != nil {
t.Fatalf("unable to insert object: %v", err)
}
g := handler.r
if w := "POST"; g.Method != w {
t.Errorf("Method = %q; want %q", g.Method, w)
}
if w := "HTTP/1.1"; g.Proto != w {
t.Errorf("Proto = %q; want %q", g.Proto, w)
}
if w := 1; g.ProtoMajor != w {
t.Errorf("ProtoMajor = %v; want %v", g.ProtoMajor, w)
}
if w := 1; g.ProtoMinor != w {
t.Errorf("ProtoMinor = %v; want %v", g.ProtoMinor, w)
}
if w, k := "google-api-go-client/0.5", "User-Agent"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w, k := "multipart/related; boundary=", "Content-Type"; len(g.Header[k]) != 1 || !strings.HasPrefix(g.Header[k][0], w) {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w, k := "gzip", "Accept-Encoding"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w := int64(-1); g.ContentLength != w {
t.Errorf("ContentLength = %v; want %v", g.ContentLength, w)
}
if w := "chunked"; len(g.TransferEncoding) != 1 || g.TransferEncoding[0] != w {
t.Errorf("TransferEncoding = %#v; want %q", g.TransferEncoding, w)
}
if w := strings.TrimPrefix(s.BasePath, "http://"); g.Host != w {
t.Errorf("Host = %q; want %q", g.Host, w)
}
if g.Form != nil {
t.Errorf("Form = %#v; want nil", g.Form)
}
if g.PostForm != nil {
t.Errorf("PostForm = %#v; want nil", g.PostForm)
}
if g.MultipartForm != nil {
t.Errorf("MultipartForm = %#v; want nil", g.MultipartForm)
}
if w := s.BasePath + "/b/mybucket/o?alt=json&uploadType=multipart"; g.RequestURI != w {
t.Errorf("RequestURI = %q; want %q", g.RequestURI, w)
}
if w := "\r\n\r\n" + body + "\r\n"; !strings.Contains(string(handler.body), w) {
t.Errorf("Body = %q, want substring %q", handler.body, w)
}
if handler.err != nil {
t.Errorf("handler err = %v, want nil", handler.err)
}
}
func TestResumableMedia(t *testing.T) {
handler := &myHandler{}
server := httptest.NewServer(handler)
defer server.Close()
handler.location = server.URL
client := &http.Client{}
s, err := storage.New(client)
if err != nil {
t.Fatalf("unable to create service: %v", err)
}
s.BasePath = server.URL
const data = "fake resumable media data"
f := strings.NewReader(data)
o := &storage.Object{
Bucket: "mybucket",
Name: "filename",
ContentType: "plain/text",
ContentEncoding: "utf-8",
ContentLanguage: "en",
}
// If all goes well, this will cause two POST requests to be sent to our fake GCS server:
// 1. Resumable upload session initiation request, to which server will respond with 200 OK and Location header.
// 2. Upload of the first and only chunk, with Content-Range header set to specify entire content.
// The test below verifies the content and headers of this second POST request.
_, err = s.Objects.Insert("mybucket", o).Name("filename").ResumableMedia(context.Background(), f, int64(len(data)), "text/plain").Do()
if err != nil {
t.Fatalf("unable to insert object: %v", err)
}
g := handler.r
if w := "POST"; g.Method != w {
t.Errorf("Method = %q; want %q", g.Method, w)
}
if w := "HTTP/1.1"; g.Proto != w {
t.Errorf("Proto = %q; want %q", g.Proto, w)
}
if w := 1; g.ProtoMajor != w {
t.Errorf("ProtoMajor = %v; want %v", g.ProtoMajor, w)
}
if w := 1; g.ProtoMinor != w {
t.Errorf("ProtoMinor = %v; want %v", g.ProtoMinor, w)
}
if w, k := "google-api-go-client/0.5", "User-Agent"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w, k := "text/plain", "Content-Type"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %v", k, g.Header[k], w)
}
if w, k := fmt.Sprintf("bytes 0-%v/%v", len(data)-1, len(data)), "Content-Range"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %v", k, g.Header[k], w)
}
if w, k := "gzip", "Accept-Encoding"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w := int64(len(data)); g.ContentLength != w {
t.Errorf("ContentLength = %v; want %v", g.ContentLength, w)
}
if s := string(handler.body); s != data {
t.Errorf("body = %q; want %q", s, data)
}
if len(g.TransferEncoding) != 0 {
t.Errorf("TransferEncoding = %#v; want nil", g.TransferEncoding)
}
if g.Form != nil {
t.Errorf("Form = %#v; want nil", g.Form)
}
if g.PostForm != nil {
t.Errorf("PostForm = %#v; want nil", g.PostForm)
}
if g.MultipartForm != nil {
t.Errorf("MultipartForm = %#v; want nil", g.MultipartForm)
}
if handler.err != nil {
t.Errorf("handler err = %v, want nil", handler.err)
}
}
func TestNoMedia(t *testing.T) {
handler := &myHandler{}
server := httptest.NewServer(handler)
defer server.Close()
client := &http.Client{}
s, err := storage.New(client)
if err != nil {
t.Fatalf("unable to create service: %v", err)
}
s.BasePath = server.URL
o := &storage.Object{
Bucket: "mybucket",
Name: "filename",
ContentType: "plain/text",
ContentEncoding: "utf-8",
ContentLanguage: "en",
}
_, err = s.Objects.Insert("mybucket", o).Do()
if err != nil {
t.Fatalf("unable to insert object: %v", err)
}
g := handler.r
if w := "POST"; g.Method != w {
t.Errorf("Method = %q; want %q", g.Method, w)
}
if w := "HTTP/1.1"; g.Proto != w {
t.Errorf("Proto = %q; want %q", g.Proto, w)
}
if w := 1; g.ProtoMajor != w {
t.Errorf("ProtoMajor = %v; want %v", g.ProtoMajor, w)
}
if w := 1; g.ProtoMinor != w {
t.Errorf("ProtoMinor = %v; want %v", g.ProtoMinor, w)
}
if w, k := "google-api-go-client/0.5", "User-Agent"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w, k := "application/json", "Content-Type"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w, k := "gzip", "Accept-Encoding"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
if w := int64(116); g.ContentLength != w {
t.Errorf("ContentLength = %v; want %v", g.ContentLength, w)
}
if len(g.TransferEncoding) != 0 {
t.Errorf("TransferEncoding = %#v; want []string{}", g.TransferEncoding)
}
if w := strings.TrimPrefix(s.BasePath, "http://"); g.Host != w {
t.Errorf("Host = %q; want %q", g.Host, w)
}
if g.Form != nil {
t.Errorf("Form = %#v; want nil", g.Form)
}
if g.PostForm != nil {
t.Errorf("PostForm = %#v; want nil", g.PostForm)
}
if g.MultipartForm != nil {
t.Errorf("MultipartForm = %#v; want nil", g.MultipartForm)
}
if w := s.BasePath + "/b/mybucket/o?alt=json"; g.RequestURI != w {
t.Errorf("RequestURI = %q; want %q", g.RequestURI, w)
}
if w := `{"bucket":"mybucket","contentEncoding":"utf-8","contentLanguage":"en","contentType":"plain/text","name":"filename"}` + "\n"; string(handler.body) != w {
t.Errorf("Body = %q, want %q", handler.body, w)
}
if handler.err != nil {
t.Errorf("handler err = %v, want nil", handler.err)
}
}
func TestMediaErrHandling(t *testing.T) {
handler := &myHandler{}
server := httptest.NewServer(handler)
defer server.Close()
client := &http.Client{}
s, err := storage.New(client)
if err != nil {
t.Fatalf("unable to create service: %v", err)
}
s.BasePath = server.URL
const body = "fake media data"
f := strings.NewReader(body)
// The combination of TimeoutReader and OneByteReader causes the first byte to
// be successfully delivered, but then a timeout error is reported. This
// allows us to test the goroutine within the getMediaType function.
r := iotest.TimeoutReader(iotest.OneByteReader(f))
o := &storage.Object{
Bucket: "mybucket",
Name: "filename",
ContentType: "plain/text",
ContentEncoding: "utf-8",
ContentLanguage: "en",
}
_, err = s.Objects.Insert("mybucket", o).Media(r).Do()
if err == nil || !strings.Contains(err.Error(), "timeout") {
t.Errorf("expected timeout error, got %v", err)
}
if handler.err != nil {
t.Errorf("handler err = %v, want nil", handler.err)
}
}
func TestUserAgent(t *testing.T) {
handler := &myHandler{}
server := httptest.NewServer(handler)
defer server.Close()
client := &http.Client{}
s, err := storage.New(client)
if err != nil {
t.Fatalf("unable to create service: %v", err)
}
s.BasePath = server.URL
s.UserAgent = "myagent/1.0"
f := strings.NewReader("fake media data")
o := &storage.Object{
Bucket: "mybucket",
Name: "filename",
ContentType: "plain/text",
ContentEncoding: "utf-8",
ContentLanguage: "en",
}
_, err = s.Objects.Insert("mybucket", o).Media(f).Do()
if err != nil {
t.Fatalf("unable to insert object: %v", err)
}
g := handler.r
if w, k := "google-api-go-client/0.5 myagent/1.0", "User-Agent"; len(g.Header[k]) != 1 || g.Header[k][0] != w {
t.Errorf("header %q = %#v; want %q", k, g.Header[k], w)
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,49 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "arrayofarray:v1",
"name": "arrayofarray",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an array of arrays.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"GeoJsonMultiPolygon": {
"id": "GeoJsonMultiPolygon",
"type": "object",
"description": "Multi Polygon",
"properties": {
"coordinates": {
"type": "array",
"description": "Coordinate arrays.",
"items": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number",
"format": "double"
}
}
}
}
},
"type": {
"type": "string",
"description": "Identifies this object as a multi-polygon.",
"enum": [
"MultiPolygon"
],
"enumDescriptions": [
""
]
}
}
}
}
}

View file

@ -0,0 +1,91 @@
// Package arrayofarray provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/arrayofarray/v1"
// ...
// arrayofarrayService, err := arrayofarray.New(oauthHttpClient)
package arrayofarray // import "google.golang.org/api/arrayofarray/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "arrayofarray:v1"
const apiName = "arrayofarray"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// GeoJsonMultiPolygon: Multi Polygon
type GeoJsonMultiPolygon struct {
// Coordinates: Coordinate arrays.
Coordinates [][][][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a multi-polygon.
//
// Possible values:
// "MultiPolygon"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonMultiPolygon) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonMultiPolygon
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,191 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "arrayofenum:v1",
"name": "arrayofenum",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an array of enums.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Container": {
"id": "Container",
"type": "object",
"description": "Represents a Google Tag Manager Container.",
"properties": {
"accountId": {
"type": "string",
"description": "GTM Account ID."
},
"containerId": {
"type": "string",
"description": "This is a long description that has URLs in it that shouldn't break. https://sites.google.com/a/google.com/adx-integration/Home/engineering/binary-releases/rtb-api-release https://cs.corp.google.com/#piper///depot/google3/contentads/adx/tools/rtb_api/adxrtb.py"
},
"domainName": {
"type": "array",
"description": "Optional list of domain names associated with the Container.",
"items": {
"type": "string"
}
},
"enabledBuiltInVariable": {
"type": "array",
"description": "List of enabled built-in variables. Valid values include: pageUrl, pageHostname, pagePath, referrer, event, clickElement, clickClasses, clickId, clickTarget, clickUrl, clickText, formElement, formClasses, formId, formTarget, formUrl, formText, errorMessage, errorUrl, errorLine, newHistoryFragment, oldHistoryFragment, newHistoryState, oldHistoryState, historySource, containerVersion, debugMode, randomNumber, containerId.",
"items": {
"type": "string",
"enum": [
"advertiserId",
"advertisingTrackingEnabled",
"appId",
"appName",
"appVersionCode",
"appVersionName",
"clickClasses",
"clickElement",
"clickId",
"clickTarget",
"clickText",
"clickUrl",
"containerId",
"containerVersion",
"debugMode",
"deviceName",
"errorLine",
"errorMessage",
"errorUrl",
"event",
"formClasses",
"formElement",
"formId",
"formTarget",
"formText",
"formUrl",
"historySource",
"language",
"newHistoryFragment",
"newHistoryState",
"oldHistoryFragment",
"oldHistoryState",
"osVersion",
"pageHostname",
"pagePath",
"pageUrl",
"platform",
"randomNumber",
"referrer",
"resolution",
"sdkVersion"
],
"enumDescriptions": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
]
}
},
"fingerprint": {
"type": "string",
"description": "The fingerprint of the GTM Container as computed at storage time. This value is recomputed whenever the account is modified."
},
"name": {
"type": "string",
"description": "Container display name.",
"annotations": {
"required": [
"tagmanager.accounts.containers.create"
]
}
},
"notes": {
"type": "string",
"description": "Container Notes."
},
"publicId": {
"type": "string",
"description": "Container Public ID."
},
"timeZoneCountryId": {
"type": "string",
"description": "Container Country ID.",
"annotations": {
"required": [
"tagmanager.accounts.containers.create"
]
}
},
"timeZoneId": {
"type": "string",
"description": "Container Time Zone ID.",
"annotations": {
"required": [
"tagmanager.accounts.containers.create"
]
}
},
"usageContext": {
"type": "array",
"description": "List of Usage Contexts for the Container. Valid values include: web, android, ios.",
"items": {
"type": "string",
"enum": [
"android",
"ios",
"web"
],
"enumDescriptions": [
"",
"",
""
]
},
"annotations": {
"required": [
"tagmanager.accounts.containers.create"
]
}
}
}
}
}
}

View file

@ -0,0 +1,176 @@
// Package arrayofenum provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/arrayofenum/v1"
// ...
// arrayofenumService, err := arrayofenum.New(oauthHttpClient)
package arrayofenum // import "google.golang.org/api/arrayofenum/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "arrayofenum:v1"
const apiName = "arrayofenum"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// Container: Represents a Google Tag Manager Container.
type Container struct {
// AccountId: GTM Account ID.
AccountId string `json:"accountId,omitempty"`
// ContainerId: This is a long description that has URLs in it that
// shouldn't break.
// https://sites.google.com/a/google.com/adx-integration/Home/engineering/binary-releases/rtb-api-release
// https://cs.corp.google.com/#piper///depot/google3/contentads/adx/tools/rtb_api/adxrtb.py
ContainerId string `json:"containerId,omitempty"`
// DomainName: Optional list of domain names associated with the
// Container.
DomainName []string `json:"domainName,omitempty"`
// EnabledBuiltInVariable: List of enabled built-in variables. Valid
// values include: pageUrl, pageHostname, pagePath, referrer, event,
// clickElement, clickClasses, clickId, clickTarget, clickUrl,
// clickText, formElement, formClasses, formId, formTarget, formUrl,
// formText, errorMessage, errorUrl, errorLine, newHistoryFragment,
// oldHistoryFragment, newHistoryState, oldHistoryState, historySource,
// containerVersion, debugMode, randomNumber, containerId.
//
// Possible values:
// "advertiserId"
// "advertisingTrackingEnabled"
// "appId"
// "appName"
// "appVersionCode"
// "appVersionName"
// "clickClasses"
// "clickElement"
// "clickId"
// "clickTarget"
// "clickText"
// "clickUrl"
// "containerId"
// "containerVersion"
// "debugMode"
// "deviceName"
// "errorLine"
// "errorMessage"
// "errorUrl"
// "event"
// "formClasses"
// "formElement"
// "formId"
// "formTarget"
// "formText"
// "formUrl"
// "historySource"
// "language"
// "newHistoryFragment"
// "newHistoryState"
// "oldHistoryFragment"
// "oldHistoryState"
// "osVersion"
// "pageHostname"
// "pagePath"
// "pageUrl"
// "platform"
// "randomNumber"
// "referrer"
// "resolution"
// "sdkVersion"
EnabledBuiltInVariable []string `json:"enabledBuiltInVariable,omitempty"`
// Fingerprint: The fingerprint of the GTM Container as computed at
// storage time. This value is recomputed whenever the account is
// modified.
Fingerprint string `json:"fingerprint,omitempty"`
// Name: Container display name.
Name string `json:"name,omitempty"`
// Notes: Container Notes.
Notes string `json:"notes,omitempty"`
// PublicId: Container Public ID.
PublicId string `json:"publicId,omitempty"`
// TimeZoneCountryId: Container Country ID.
TimeZoneCountryId string `json:"timeZoneCountryId,omitempty"`
// TimeZoneId: Container Time Zone ID.
TimeZoneId string `json:"timeZoneId,omitempty"`
// UsageContext: List of Usage Contexts for the Container. Valid values
// include: web, android, ios.
//
// Possible values:
// "android"
// "ios"
// "web"
UsageContext []string `json:"usageContext,omitempty"`
// ForceSendFields is a list of field names (e.g. "AccountId") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Container) MarshalJSON() ([]byte, error) {
type noMethod Container
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,32 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "arrayofmapofstrings:v1",
"name": "arrayofmapofstrings",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an array of arrays.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Analyze": {
"id": "Analyze",
"type": "object",
"properties": {
"errors": {
"type": "array",
"description": "List of errors with the data.",
"items": {
"type": "object",
"additionalProperties": {
"$ref": "Property",
"description": "Error level followed by a detailed error message."
}
}
}
}
}
}
}

View file

@ -0,0 +1,84 @@
// Package arrayofmapofstrings provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/arrayofmapofstrings/v1"
// ...
// arrayofmapofstringsService, err := arrayofmapofstrings.New(oauthHttpClient)
package arrayofmapofstrings // import "google.golang.org/api/arrayofmapofstrings/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "arrayofmapofstrings:v1"
const apiName = "arrayofmapofstrings"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type Analyze struct {
// Errors: List of errors with the data.
Errors []map[string]Property `json:"errors,omitempty"`
// ForceSendFields is a list of field names (e.g. "Errors") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Analyze) MarshalJSON() ([]byte, error) {
type noMethod Analyze
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,32 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "arrayofmapofstrings:v1",
"name": "arrayofmapofstrings",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an array of arrays.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Analyze": {
"id": "Analyze",
"type": "object",
"properties": {
"errors": {
"type": "array",
"description": "List of errors with the data.",
"items": {
"type": "object",
"additionalProperties": {
"type": "string",
"description": "Error level followed by a detailed error message."
}
}
}
}
}
}
}

View file

@ -0,0 +1,84 @@
// Package arrayofmapofstrings provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/arrayofmapofstrings/v1"
// ...
// arrayofmapofstringsService, err := arrayofmapofstrings.New(oauthHttpClient)
package arrayofmapofstrings // import "google.golang.org/api/arrayofmapofstrings/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "arrayofmapofstrings:v1"
const apiName = "arrayofmapofstrings"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type Analyze struct {
// Errors: List of errors with the data.
Errors []map[string]string `json:"errors,omitempty"`
// ForceSendFields is a list of field names (e.g. "Errors") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Analyze) MarshalJSON() ([]byte, error) {
type noMethod Analyze
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,89 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "getwithoutbody:v1",
"name": "getwithoutbody",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates a GET with a request.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"ListMetricRequest": {
"id": "ListMetricRequest",
"type": "object",
"description": "The request of getwithoutbody.metricDescriptors.list.",
"properties": {
"kind": {
"type": "string",
"description": "Identifies what kind of resource this is. Value: the fixed string \"getwithoutbody#listMetricRequest\".",
"default": "getwithoutbody#listMetricRequest"
}
}
},
"ListMetricResponse": {
"id": "ListMetricResponse",
"type": "object",
"description": "The response of getwithoutbody.metricDescriptors.list.",
"properties": {
"kind": {
"type": "string",
"description": "Identifies what kind of resource this is. Value: the fixed string \"getwithoutbody#listMetricResponse\".",
"default": "getwithoutbody#listMetricResponse"
},
"nextPageToken": {
"type": "string",
"description": "Pagination token. If present, indicates that additional results are available for retrieval. To access the results past the pagination limit, set this value to the pageToken query parameter."
}
}
}
},
"resources": {
"metricDescriptors": {
"methods": {
"list": {
"id": "getwithoutbody.metricDescriptors.list",
"path": "{project}/metricDescriptors",
"httpMethod": "GET",
"description": "List all of the available metric descriptors. Large number of metric descriptors will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.",
"parameters": {
"count": {
"type": "integer",
"description": "Maximum number of metric descriptors per page. Used for pagination. If not specified, count = 100.",
"default": "100",
"format": "int32",
"minimum": "1",
"maximum": "1000",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.",
"location": "query"
},
"project": {
"type": "string",
"description": "The project id. The value can be the numeric project ID or string-based project name.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"project"
],
"request": {
"$ref": "ListMetricRequest"
},
"response": {
"$ref": "ListMetricResponse"
},
"scopes": [
"https://www.googleapis.com/auth/getwithoutbody.readonly"
]
}
}
}
}
}

View file

@ -0,0 +1,302 @@
// Package getwithoutbody provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/getwithoutbody/v1"
// ...
// getwithoutbodyService, err := getwithoutbody.New(oauthHttpClient)
package getwithoutbody // import "google.golang.org/api/getwithoutbody/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "getwithoutbody:v1"
const apiName = "getwithoutbody"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.MetricDescriptors = NewMetricDescriptorsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
MetricDescriptors *MetricDescriptorsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewMetricDescriptorsService(s *Service) *MetricDescriptorsService {
rs := &MetricDescriptorsService{s: s}
return rs
}
type MetricDescriptorsService struct {
s *Service
}
// ListMetricRequest: The request of
// getwithoutbody.metricDescriptors.list.
type ListMetricRequest struct {
// Kind: Identifies what kind of resource this is. Value: the fixed
// string "getwithoutbody#listMetricRequest".
Kind string `json:"kind,omitempty"`
// ForceSendFields is a list of field names (e.g. "Kind") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *ListMetricRequest) MarshalJSON() ([]byte, error) {
type noMethod ListMetricRequest
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// ListMetricResponse: The response of
// getwithoutbody.metricDescriptors.list.
type ListMetricResponse struct {
// Kind: Identifies what kind of resource this is. Value: the fixed
// string "getwithoutbody#listMetricResponse".
Kind string `json:"kind,omitempty"`
// NextPageToken: Pagination token. If present, indicates that
// additional results are available for retrieval. To access the results
// past the pagination limit, set this value to the pageToken query
// parameter.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Kind") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *ListMetricResponse) MarshalJSON() ([]byte, error) {
type noMethod ListMetricResponse
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// method id "getwithoutbody.metricDescriptors.list":
type MetricDescriptorsListCall struct {
s *Service
project string
listmetricrequest *ListMetricRequest
opt_ map[string]interface{}
ctx_ context.Context
}
// List: List all of the available metric descriptors. Large number of
// metric descriptors will be paginated, use the nextPageToken returned
// in the response to request subsequent pages of results by setting the
// pageToken query parameter to the value of the nextPageToken.
func (r *MetricDescriptorsService) List(project string, listmetricrequest *ListMetricRequest) *MetricDescriptorsListCall {
c := &MetricDescriptorsListCall{s: r.s, opt_: make(map[string]interface{})}
c.project = project
c.listmetricrequest = listmetricrequest
return c
}
// Count sets the optional parameter "count": Maximum number of metric
// descriptors per page. Used for pagination. If not specified, count =
// 100.
func (c *MetricDescriptorsListCall) Count(count int64) *MetricDescriptorsListCall {
c.opt_["count"] = count
return c
}
// PageToken sets the optional parameter "pageToken": The pagination
// token, which is used to page through large result sets. Set this
// value to the value of the nextPageToken to retrieve the next page of
// results.
func (c *MetricDescriptorsListCall) PageToken(pageToken string) *MetricDescriptorsListCall {
c.opt_["pageToken"] = pageToken
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *MetricDescriptorsListCall) Fields(s ...googleapi.Field) *MetricDescriptorsListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *MetricDescriptorsListCall) IfNoneMatch(entityTag string) *MetricDescriptorsListCall {
c.opt_["ifNoneMatch"] = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
// Any pending HTTP request will be aborted if the provided context
// is canceled.
func (c *MetricDescriptorsListCall) Context(ctx context.Context) *MetricDescriptorsListCall {
c.ctx_ = ctx
return c
}
func (c *MetricDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["count"]; ok {
params.Set("count", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/metricDescriptors")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "getwithoutbody.metricDescriptors.list" call.
// Exactly one of *ListMetricResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListMetricResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *MetricDescriptorsListCall) Do() (*ListMetricResponse, error) {
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ListMetricResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "List all of the available metric descriptors. Large number of metric descriptors will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.",
// "httpMethod": "GET",
// "id": "getwithoutbody.metricDescriptors.list",
// "parameterOrder": [
// "project"
// ],
// "parameters": {
// "count": {
// "default": "100",
// "description": "Maximum number of metric descriptors per page. Used for pagination. If not specified, count = 100.",
// "format": "int32",
// "location": "query",
// "maximum": "1000",
// "minimum": "1",
// "type": "integer"
// },
// "pageToken": {
// "description": "The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.",
// "location": "query",
// "type": "string"
// },
// "project": {
// "description": "The project id. The value can be the numeric project ID or string-based project name.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/metricDescriptors",
// "request": {
// "$ref": "ListMetricRequest"
// },
// "response": {
// "$ref": "ListMetricResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/getwithoutbody.readonly"
// ]
// }
}

View file

@ -0,0 +1,51 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "mapofany:v1",
"name": "mapofany",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an associative array.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"TableDataInsertAllRequest": {
"id": "TableDataInsertAllRequest",
"type": "object",
"properties": {
"kind": {
"type": "string",
"description": "The resource type of the response.",
"default": "bigquery#tableDataInsertAllRequest"
},
"rows": {
"type": "array",
"description": "The rows to insert.",
"items": {
"type": "object",
"properties": {
"json": {
"$ref": "JsonObject",
"description": "[Required] A JSON object that contains a row of data. The object's properties and values must match the destination table's schema."
}
}
}
}
}
},
"JsonObject": {
"id": "JsonObject",
"type": "object",
"description": "Represents a single JSON object.",
"additionalProperties": {
"$ref": "JsonValue"
}
},
"JsonValue": {
"id": "JsonValue",
"type": "any"
}
}
}

View file

@ -0,0 +1,110 @@
// Package mapofany provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/mapofany/v1"
// ...
// mapofanyService, err := mapofany.New(oauthHttpClient)
package mapofany // import "google.golang.org/api/mapofany/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "mapofany:v1"
const apiName = "mapofany"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type JsonValue interface{}
type TableDataInsertAllRequest struct {
// Kind: The resource type of the response.
Kind string `json:"kind,omitempty"`
// Rows: The rows to insert.
Rows []*TableDataInsertAllRequestRows `json:"rows,omitempty"`
// ForceSendFields is a list of field names (e.g. "Kind") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *TableDataInsertAllRequest) MarshalJSON() ([]byte, error) {
type noMethod TableDataInsertAllRequest
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type TableDataInsertAllRequestRows struct {
// Json: [Required] A JSON object that contains a row of data. The
// object's properties and values must match the destination table's
// schema.
Json map[string]JsonValue `json:"json,omitempty"`
// ForceSendFields is a list of field names (e.g. "Json") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *TableDataInsertAllRequestRows) MarshalJSON() ([]byte, error) {
type noMethod TableDataInsertAllRequestRows
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,72 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "additionalprops:v1",
"name": "additionalprops",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an associative array.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"TimeseriesDescriptor": {
"id": "TimeseriesDescriptor",
"type": "object",
"description": "The descriptions of a time series.",
"properties": {
"labels": {
"type": "object",
"description": "The set of key-value pairs that describe this time series, including target-specific labels and metric-specific labels.",
"additionalProperties": {
"type": "string",
"description": "The label's name."
}
},
"metric": {
"type": "string",
"description": "The name of the metric."
},
"project": {
"type": "string",
"description": "The project ID to which this time series belongs."
},
"tags": {
"type": "object",
"description": "A map of additional information.",
"additionalProperties": {
"type": "array",
"description": "A string which maps to an array of values.",
"items": {
"$ref": "Property"
}
}
}
}
},
"GetMapResponse": {
"id": "GetMapResponse",
"type": "object",
"description": "Response of getting a map.",
"additionalProperties": {
"type": "string"
}
}
},
"resources": {
"atlas": {
"methods": {
"getMap": {
"id": "mapofstrings.getMap",
"path": "map",
"httpMethod": "GET",
"description": "Get a map.",
"response": {
"$ref": "GetMapResponse"
}
}
}
}
}
}

View file

@ -0,0 +1,195 @@
// Package additionalprops provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/additionalprops/v1"
// ...
// additionalpropsService, err := additionalprops.New(oauthHttpClient)
package additionalprops // import "google.golang.org/api/additionalprops/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "additionalprops:v1"
const apiName = "additionalprops"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Atlas = NewAtlasService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Atlas *AtlasService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewAtlasService(s *Service) *AtlasService {
rs := &AtlasService{s: s}
return rs
}
type AtlasService struct {
s *Service
}
// TimeseriesDescriptor: The descriptions of a time series.
type TimeseriesDescriptor struct {
// Labels: The set of key-value pairs that describe this time series,
// including target-specific labels and metric-specific labels.
Labels map[string]string `json:"labels,omitempty"`
// Metric: The name of the metric.
Metric string `json:"metric,omitempty"`
// Project: The project ID to which this time series belongs.
Project string `json:"project,omitempty"`
// Tags: A map of additional information.
Tags map[string][]Property `json:"tags,omitempty"`
// ForceSendFields is a list of field names (e.g. "Labels") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
type noMethod TimeseriesDescriptor
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// method id "mapofstrings.getMap":
type AtlasGetMapCall struct {
s *Service
opt_ map[string]interface{}
ctx_ context.Context
}
// GetMap: Get a map.
func (r *AtlasService) GetMap() *AtlasGetMapCall {
c := &AtlasGetMapCall{s: r.s, opt_: make(map[string]interface{})}
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall {
c.opt_["ifNoneMatch"] = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
// Any pending HTTP request will be aborted if the provided context
// is canceled.
func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall {
c.ctx_ = ctx
return c
}
func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "map")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "mapofstrings.getMap" call.
func (c *AtlasGetMapCall) Do() (map[string]string, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret map[string]string
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get a map.",
// "httpMethod": "GET",
// "id": "mapofstrings.getMap",
// "path": "map",
// "response": {
// "$ref": "GetMapResponse"
// }
// }
}

View file

@ -0,0 +1,30 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "additionalpropsobjs:v1",
"name": "additionalpropsobjs",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an associative array.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Entity": {
"id": "Entity",
"type": "object",
"externalTypeName": "apphosting.client.datastoreservice.proto.Entity",
"properties": {
"properties": {
"type": "object",
"description": "The entity's properties.",
"additionalProperties": {
"$ref": "Property",
"description": "The name of the property. Properties with names matching regex \"__.*__\" are reserved. A reserved property name is forbidden in certain documented contexts. The name cannot be \"\"."
}
}
}
}
}
}

View file

@ -0,0 +1,84 @@
// Package additionalpropsobjs provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/additionalpropsobjs/v1"
// ...
// additionalpropsobjsService, err := additionalpropsobjs.New(oauthHttpClient)
package additionalpropsobjs // import "google.golang.org/api/additionalpropsobjs/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "additionalpropsobjs:v1"
const apiName = "additionalpropsobjs"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type Entity struct {
// Properties: The entity's properties.
Properties map[string]Property `json:"properties,omitempty"`
// ForceSendFields is a list of field names (e.g. "Properties") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Entity) MarshalJSON() ([]byte, error) {
type noMethod Entity
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,72 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "additionalprops:v1",
"name": "additionalprops",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an associative array.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"TimeseriesDescriptor": {
"id": "TimeseriesDescriptor",
"type": "object",
"description": "The descriptions of a time series.",
"properties": {
"labels": {
"type": "object",
"description": "The set of key-value pairs that describe this time series, including target-specific labels and metric-specific labels.",
"additionalProperties": {
"type": "string",
"description": "The label's name."
}
},
"metric": {
"type": "string",
"description": "The name of the metric."
},
"project": {
"type": "string",
"description": "The project ID to which this time series belongs."
},
"tags": {
"type": "object",
"description": "A map of additional information.",
"additionalProperties": {
"type": "array",
"description": "A string which maps to an array of values.",
"items": {
"type": "string"
}
}
}
}
},
"GetMapResponse": {
"id": "GetMapResponse",
"type": "object",
"description": "Response of getting a map.",
"additionalProperties": {
"type": "string"
}
}
},
"resources": {
"atlas": {
"methods": {
"getMap": {
"id": "mapofstrings.getMap",
"path": "map",
"httpMethod": "GET",
"description": "Get a map.",
"response": {
"$ref": "GetMapResponse"
}
}
}
}
}
}

View file

@ -0,0 +1,195 @@
// Package additionalprops provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/additionalprops/v1"
// ...
// additionalpropsService, err := additionalprops.New(oauthHttpClient)
package additionalprops // import "google.golang.org/api/additionalprops/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "additionalprops:v1"
const apiName = "additionalprops"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Atlas = NewAtlasService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Atlas *AtlasService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewAtlasService(s *Service) *AtlasService {
rs := &AtlasService{s: s}
return rs
}
type AtlasService struct {
s *Service
}
// TimeseriesDescriptor: The descriptions of a time series.
type TimeseriesDescriptor struct {
// Labels: The set of key-value pairs that describe this time series,
// including target-specific labels and metric-specific labels.
Labels map[string]string `json:"labels,omitempty"`
// Metric: The name of the metric.
Metric string `json:"metric,omitempty"`
// Project: The project ID to which this time series belongs.
Project string `json:"project,omitempty"`
// Tags: A map of additional information.
Tags map[string][]string `json:"tags,omitempty"`
// ForceSendFields is a list of field names (e.g. "Labels") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
type noMethod TimeseriesDescriptor
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// method id "mapofstrings.getMap":
type AtlasGetMapCall struct {
s *Service
opt_ map[string]interface{}
ctx_ context.Context
}
// GetMap: Get a map.
func (r *AtlasService) GetMap() *AtlasGetMapCall {
c := &AtlasGetMapCall{s: r.s, opt_: make(map[string]interface{})}
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall {
c.opt_["ifNoneMatch"] = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
// Any pending HTTP request will be aborted if the provided context
// is canceled.
func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall {
c.ctx_ = ctx
return c
}
func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "map")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "mapofstrings.getMap" call.
func (c *AtlasGetMapCall) Do() (map[string]string, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret map[string]string
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get a map.",
// "httpMethod": "GET",
// "id": "mapofstrings.getMap",
// "path": "map",
// "response": {
// "$ref": "GetMapResponse"
// }
// }
}

View file

@ -0,0 +1,94 @@
{
"kind": "discovery#restDescription",
"etag": "\"DGgqtFnjgu83tuwvvVNNUhOiHWk/1UCG4CqfTBrxPN0MRjUm7GaLJ7Y\"",
"discoveryVersion": "v1",
"id": "adexchangebuyer:v1.1",
"name": "adexchangebuyer",
"version": "v1.1",
"title": "Ad Exchange Buyer API",
"description": "Lets you manage your Ad Exchange Buyer account.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
"x16": "http://www.google.com/images/icons/product/doubleclick-16.gif",
"x32": "http://www.google.com/images/icons/product/doubleclick-32.gif"
},
"documentationLink": "https://developers.google.com/ad-exchange/buyer-rest",
"protocol": "rest",
"baseUrl": "https://www.googleapis.com/adexchangebuyer/v1.1/",
"basePath": "/adexchangebuyer/v1.1/",
"rootUrl": "https://www.googleapis.com/",
"servicePath": "adexchangebuyer/v1.1/",
"batchPath": "batch",
"parameters": {
"alt": {
"type": "string",
"description": "Data format for the response.",
"default": "json",
"enum": [
"json"
],
"enumDescriptions": [
"Responses with Content-Type of application/json"
],
"location": "query"
},
"fields": {
"type": "string",
"description": "Selector specifying which fields to include in a partial response.",
"location": "query"
},
"key": {
"type": "string",
"description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
"location": "query"
},
"oauth_token": {
"type": "string",
"description": "OAuth 2.0 token for the current user.",
"location": "query"
},
"prettyPrint": {
"type": "boolean",
"description": "Returns response with indentations and line breaks.",
"default": "true",
"location": "query"
},
"quotaUser": {
"type": "string",
"description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
"location": "query"
},
"userIp": {
"type": "string",
"description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
"location": "query"
}
},
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/adexchange.buyer": {
"description": "Manage your Ad Exchange buyer account configuration"
}
}
}
},
"schemas": {
"Creative": {
"id": "Creative",
"type": "object",
"description": "A creative and its classification data.",
"properties": {
"advertiserId": {
"type": "array",
"description": "Detected advertiser id, if any. Read-only. This field should not be set in requests.",
"items": {
"type": "string",
"format": "int64"
}
}
}
}
}
}

View file

@ -0,0 +1,94 @@
// Package adexchangebuyer provides access to the Ad Exchange Buyer API.
//
// See https://developers.google.com/ad-exchange/buyer-rest
//
// Usage example:
//
// import "google.golang.org/api/adexchangebuyer/v1.1"
// ...
// adexchangebuyerService, err := adexchangebuyer.New(oauthHttpClient)
package adexchangebuyer // import "google.golang.org/api/adexchangebuyer/v1.1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "adexchangebuyer:v1.1"
const apiName = "adexchangebuyer"
const apiVersion = "v1.1"
const basePath = "https://www.googleapis.com/adexchangebuyer/v1.1/"
// OAuth2 scopes used by this API.
const (
// Manage your Ad Exchange buyer account configuration
AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// Creative: A creative and its classification data.
type Creative struct {
// AdvertiserId: Detected advertiser id, if any. Read-only. This field
// should not be set in requests.
AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
// ForceSendFields is a list of field names (e.g. "AdvertiserId") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Creative) MarshalJSON() ([]byte, error) {
type noMethod Creative
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,158 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "wrapnewlines:v1",
"name": "wrapnewlines",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates wrapping of descriptions containing newlines.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Thing": {
"id": "Thing",
"type": "object",
"description": "don't care",
"properties": {
"bool_empty_default_a":{
"type": "boolean",
"description": "\nNonempty default: no\nUnfortunate default: no",
"default": "false"
},
"bool_empty_default_b":{
"type": "boolean",
"description": "\nNonempty default: no\nUnfortunate default: no"
},
"bool_nonempty_default":{
"type": "boolean",
"description": "\nNonempty default: yes\nUnfortunate default: yes",
"default": "true"
},
"string_nonempty_default_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: yes\nAccepts empty value: no\nUnfortunate default: no",
"default": "nonempty"
},
"string_nonempty_default_enum_accepts_empty": {
"type": "string",
"description": "\nNonempty default: yes\nAccepts empty value: yes (enum)\nUnfortunate default: yes",
"default": "nonempty",
"enum": [
"",
"nonempty",
"aaa"
],
"enumDescriptions": [
"",
""
]
},
"string_nonempty_default_enum_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: yes\nAccepts empty value: no (enum)\nUnfortunate default: no",
"default": "nonempty",
"enum": [
"nonempty",
"aaa"
],
"enumDescriptions": [
""
]
},
"string_nonempty_default_pattern_accepts_empty": {
"type": "string",
"description": "\nNonempty default: yes\nAccepts empty value: yes (pattern)\nUnfortunate default: yes",
"default": "nonempty",
"pattern": ".?"
},
"string_nonempty_default_pattern_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: yes\nAccepts empty value: no (pattern)\nUnfortunate default: no",
"default": "nonempty",
"pattern": "."
},
"string_empty_default_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: no\nAccepts empty value: no\nUnfortunate default: no",
"default": ""
},
"string_empty_default_enum_accepts_empty": {
"type": "string",
"description": "\nNonempty default: no\nAccepts empty value: yes (enum)\nUnfortunate default: no",
"default": "",
"enum": [
"",
"value"
],
"enumDescriptions": [
"",
""
]
},
"string_empty_default_enum_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: no\nAccepts empty value: no (enum)\nUnfortunate default: no",
"default": "",
"enum": [
"value"
],
"enumDescriptions": [
""
]
},
"string_empty_default_pattern_accepts_empty": {
"type": "string",
"description": "\nNonempty default: no\nAccepts empty value: yes (pattern)\nUnfortunate default: no",
"default": "",
"pattern": ".?"
},
"string_empty_default_pattern_doesnt_accept_empty": {
"type": "string",
"description": "\nNonempty default: no\nAccepts empty value: no (pattern)\nUnfortunate default: no",
"default": "",
"pattern": "."
},
"numeric_empty_default_a":{
"type": "string",
"format": "int64",
"description": "\nNonempty default: no\nUnfortunate default: no",
"default": ""
},
"numeric_empty_default_b":{
"type": "string",
"format": "int64",
"description": "\nNonempty default: no\nUnfortunate default: no"
},
"numeric_empty_default_c":{
"type": "string",
"format": "int64",
"description": "\nNonempty default: no\nUnfortunate default: no",
"default": "0"
},
"numeric_empty_default_d":{
"type": "number",
"description": "\nNonempty default: no\nUnfortunate default: no",
"default": "0.0"
},
"numeric_empty_default_e":{
"type": "number",
"description": "\nNonempty default: no\nUnfortunate default: no",
"default": "-0.0"
},
"numeric_nonempty_default_a":{
"type": "string",
"format": "int64",
"description": "\nNonempty default: yes\nUnfortunate default: yes\nstring encoded, so will not be represented as pointer.",
"default": "1"
},
"numeric_nonempty_default_b":{
"type": "number",
"description": "\nNonempty default: yes\nUnfortunate default: yes",
"default": "0.001"
}
}
}
}
}

View file

@ -0,0 +1,217 @@
// Package wrapnewlines provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/wrapnewlines/v1"
// ...
// wrapnewlinesService, err := wrapnewlines.New(oauthHttpClient)
package wrapnewlines // import "google.golang.org/api/wrapnewlines/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "wrapnewlines:v1"
const apiName = "wrapnewlines"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// Thing: don't care
type Thing struct {
// BoolEmptyDefaultA:
// Nonempty default: no
// Unfortunate default: no
BoolEmptyDefaultA bool `json:"bool_empty_default_a,omitempty"`
// BoolEmptyDefaultB:
// Nonempty default: no
// Unfortunate default: no
BoolEmptyDefaultB bool `json:"bool_empty_default_b,omitempty"`
// BoolNonemptyDefault:
// Nonempty default: yes
// Unfortunate default: yes
//
// Default: true
BoolNonemptyDefault *bool `json:"bool_nonempty_default,omitempty"`
// NumericEmptyDefaultA:
// Nonempty default: no
// Unfortunate default: no
NumericEmptyDefaultA int64 `json:"numeric_empty_default_a,omitempty,string"`
// NumericEmptyDefaultB:
// Nonempty default: no
// Unfortunate default: no
NumericEmptyDefaultB int64 `json:"numeric_empty_default_b,omitempty,string"`
// NumericEmptyDefaultC:
// Nonempty default: no
// Unfortunate default: no
NumericEmptyDefaultC int64 `json:"numeric_empty_default_c,omitempty,string"`
// NumericEmptyDefaultD:
// Nonempty default: no
// Unfortunate default: no
NumericEmptyDefaultD float64 `json:"numeric_empty_default_d,omitempty"`
// NumericEmptyDefaultE:
// Nonempty default: no
// Unfortunate default: no
NumericEmptyDefaultE float64 `json:"numeric_empty_default_e,omitempty"`
// NumericNonemptyDefaultA:
// Nonempty default: yes
// Unfortunate default: yes
// string encoded, so will not be represented as pointer.
//
// Default: 1
NumericNonemptyDefaultA *int64 `json:"numeric_nonempty_default_a,omitempty,string"`
// NumericNonemptyDefaultB:
// Nonempty default: yes
// Unfortunate default: yes
//
// Default: 0.001
NumericNonemptyDefaultB *float64 `json:"numeric_nonempty_default_b,omitempty"`
// StringEmptyDefaultDoesntAcceptEmpty:
// Nonempty default: no
// Accepts empty value: no
// Unfortunate default: no
StringEmptyDefaultDoesntAcceptEmpty string `json:"string_empty_default_doesnt_accept_empty,omitempty"`
// StringEmptyDefaultEnumAcceptsEmpty:
// Nonempty default: no
// Accepts empty value: yes (enum)
// Unfortunate default: no
//
// Possible values:
// "" (default)
// "value"
StringEmptyDefaultEnumAcceptsEmpty string `json:"string_empty_default_enum_accepts_empty,omitempty"`
// StringEmptyDefaultEnumDoesntAcceptEmpty:
// Nonempty default: no
// Accepts empty value: no (enum)
// Unfortunate default: no
//
// Possible values:
// "value"
StringEmptyDefaultEnumDoesntAcceptEmpty string `json:"string_empty_default_enum_doesnt_accept_empty,omitempty"`
// StringEmptyDefaultPatternAcceptsEmpty:
// Nonempty default: no
// Accepts empty value: yes (pattern)
// Unfortunate default: no
StringEmptyDefaultPatternAcceptsEmpty string `json:"string_empty_default_pattern_accepts_empty,omitempty"`
// StringEmptyDefaultPatternDoesntAcceptEmpty:
// Nonempty default: no
// Accepts empty value: no (pattern)
// Unfortunate default: no
StringEmptyDefaultPatternDoesntAcceptEmpty string `json:"string_empty_default_pattern_doesnt_accept_empty,omitempty"`
// StringNonemptyDefaultDoesntAcceptEmpty:
// Nonempty default: yes
// Accepts empty value: no
// Unfortunate default: no
StringNonemptyDefaultDoesntAcceptEmpty string `json:"string_nonempty_default_doesnt_accept_empty,omitempty"`
// StringNonemptyDefaultEnumAcceptsEmpty:
// Nonempty default: yes
// Accepts empty value: yes (enum)
// Unfortunate default: yes
//
// Possible values:
// ""
// "nonempty" (default)
// "aaa"
StringNonemptyDefaultEnumAcceptsEmpty *string `json:"string_nonempty_default_enum_accepts_empty,omitempty"`
// StringNonemptyDefaultEnumDoesntAcceptEmpty:
// Nonempty default: yes
// Accepts empty value: no (enum)
// Unfortunate default: no
//
// Possible values:
// "nonempty" (default)
// "aaa"
StringNonemptyDefaultEnumDoesntAcceptEmpty string `json:"string_nonempty_default_enum_doesnt_accept_empty,omitempty"`
// StringNonemptyDefaultPatternAcceptsEmpty:
// Nonempty default: yes
// Accepts empty value: yes (pattern)
// Unfortunate default: yes
//
// Default: nonempty
StringNonemptyDefaultPatternAcceptsEmpty *string `json:"string_nonempty_default_pattern_accepts_empty,omitempty"`
// StringNonemptyDefaultPatternDoesntAcceptEmpty:
// Nonempty default: yes
// Accepts empty value: no (pattern)
// Unfortunate default: no
StringNonemptyDefaultPatternDoesntAcceptEmpty string `json:"string_nonempty_default_pattern_doesnt_accept_empty,omitempty"`
// ForceSendFields is a list of field names (e.g. "BoolEmptyDefaultA")
// to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Thing) MarshalJSON() ([]byte, error) {
type noMethod Thing
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,418 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "additionalpropsobjs:v1",
"name": "additionalpropsobjs",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates an associative array.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"GeoJsonGeometry": {
"id": "GeoJsonGeometry",
"type": "object",
"variant": {
"discriminant": "type",
"map": [
{
"type_value": "GeometryCollection",
"$ref": "GeoJsonGeometryCollection"
},
{
"type_value": "LineString",
"$ref": "GeoJsonLineString"
},
{
"type_value": "MultiLineString",
"$ref": "GeoJsonMultiLineString"
},
{
"type_value": "MultiPoint",
"$ref": "GeoJsonMultiPoint"
},
{
"type_value": "MultiPolygon",
"$ref": "GeoJsonMultiPolygon"
},
{
"type_value": "Point",
"$ref": "GeoJsonPoint"
},
{
"type_value": "Polygon",
"$ref": "GeoJsonPolygon"
}
]
}
},
"GeoJsonGeometryCollection": {
"id": "GeoJsonGeometryCollection",
"type": "object",
"description": "A heterogenous collection of GeoJsonGeometry objects.",
"properties": {
"geometries": {
"type": "array",
"description": "An array of geometry objects. There must be at least 2 different types of geometries in the array.",
"items": {
"$ref": "GeoJsonGeometry"
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonGeometryCollection.",
"enum": [
"GeometryCollection"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonLineString": {
"id": "GeoJsonLineString",
"type": "object",
"properties": {
"coordinates": {
"type": "array",
"description": "An array of two or more positions, representing a line.",
"items": {
"$ref": "GeoJsonPosition"
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonLineString.",
"enum": [
"LineString"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonMultiLineString": {
"id": "GeoJsonMultiLineString",
"type": "object",
"description": "Multi Line String",
"properties": {
"coordinates": {
"type": "array",
"description": "An array of at least two GeoJsonLineString coordinate arrays.",
"items": {
"type": "array",
"items": {
"$ref": "GeoJsonPosition"
}
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonMultiLineString.",
"enum": [
"MultiLineString"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonMultiPoint": {
"id": "GeoJsonMultiPoint",
"type": "object",
"properties": {
"coordinates": {
"type": "array",
"description": "An array of at least two GeoJsonPoint coordinate arrays.",
"items": {
"$ref": "GeoJsonPosition"
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonMultiPoint.",
"enum": [
"MultiPoint"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonMultiPolygon": {
"id": "GeoJsonMultiPolygon",
"type": "object",
"properties": {
"coordinates": {
"type": "array",
"description": "An array of at least two GeoJsonPolygon coordinate arrays.",
"items": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "GeoJsonPosition"
}
}
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonMultiPolygon.",
"enum": [
"MultiPolygon"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonPoint": {
"id": "GeoJsonPoint",
"type": "object",
"properties": {
"coordinates": {
"$ref": "GeoJsonPosition",
"description": "A single GeoJsonPosition, specifying the location of the point."
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonPoint.",
"enum": [
"Point"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonPolygon": {
"id": "GeoJsonPolygon",
"type": "object",
"properties": {
"coordinates": {
"type": "array",
"description": "An array of LinearRings, each of which is an array of four or more GeoJsonPositions. The first and last coordinates in each LinearRing must be the same. For polygons with multiple rings, the first LinearRing is the external ring, with subsequent rings being interior rings (i.e. hole). All LinearRings must contain GeoJsonPositions in counter-clockwise order.",
"items": {
"type": "array",
"items": {
"$ref": "GeoJsonPosition"
}
}
},
"type": {
"type": "string",
"description": "Identifies this object as a GeoJsonPolygon.",
"enum": [
"Polygon"
],
"enumDescriptions": [
""
]
}
}
},
"GeoJsonPosition": {
"id": "GeoJsonPosition",
"type": "array",
"description": "A position represents a geographical position as an array containing a longitude and a latitude, and optionally an altitude, in that order. All Geometry objects make use of positions to represent geometries as nested arrays. The structure of the array is governed by the type of the geometry.",
"items": {
"type": "number",
"format": "double"
}
},
"MapFolder": {
"id": "MapFolder",
"type": "object",
"properties": {
"contents": {
"type": "array",
"items": {
"$ref": "MapItem"
}
},
"defaultViewport": {
"type": "array",
"description": "An array of four numbers (west, south, east, north) which defines the rectangular bounding box of the default viewport. The numbers represent latitude and longitude in decimal degrees.",
"items": {
"type": "number",
"format": "double"
}
},
"expandable": {
"type": "boolean",
"description": "The expandability setting of this MapFolder. If true, the folder can be expanded."
},
"key": {
"type": "string",
"description": "A user defined alias for this MapFolder, specific to this Map."
},
"name": {
"type": "string",
"description": "The name of this MapFolder.",
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"type": {
"type": "string",
"description": "Identifies this object as a MapFolder.",
"enum": [
"folder"
],
"enumDescriptions": [
""
],
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"visibility": {
"type": "string",
"description": "The visibility setting of this MapFolder. One of \"defaultOn\" or \"defaultOff\"."
}
}
},
"MapItem": {
"id": "MapItem",
"type": "object",
"variant": {
"discriminant": "type",
"map": [
{
"type_value": "folder",
"$ref": "MapFolder"
},
{
"type_value": "kmlLink",
"$ref": "MapKmlLink"
},
{
"type_value": "layer",
"$ref": "MapLayer"
}
]
}
},
"MapKmlLink": {
"id": "MapKmlLink",
"type": "object",
"properties": {
"defaultViewport": {
"type": "array",
"description": "An array of four numbers (west, south, east, north) which defines the rectangular bounding box of the default viewport. The numbers represent latitude and longitude in decimal degrees.",
"items": {
"type": "number",
"format": "double"
}
},
"kmlUrl": {
"type": "string",
"description": "The URL to the KML file represented by this MapKmlLink.",
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"name": {
"type": "string",
"description": "The name of this MapKmlLink.",
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"type": {
"type": "string",
"description": "Identifies this object as a MapKmlLink.",
"enum": [
"kmlLink"
],
"enumDescriptions": [
""
],
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"visibility": {
"type": "string",
"description": "The visibility setting of this MapKmlLink. One of \"defaultOn\" or \"defaultOff\"."
}
}
},
"MapLayer": {
"id": "MapLayer",
"type": "object",
"properties": {
"defaultViewport": {
"type": "array",
"description": "An array of four numbers (west, south, east, north) which defines the rectangular bounding box of the default viewport. The numbers represent latitude and longitude in decimal degrees.",
"items": {
"type": "number",
"format": "double"
}
},
"id": {
"type": "string",
"description": "The ID of this MapLayer. This ID can be used to request more details about the layer.",
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"key": {
"type": "string",
"description": "A user defined alias for this MapLayer, specific to this Map."
},
"name": {
"type": "string",
"description": "The name of this MapLayer."
},
"type": {
"type": "string",
"description": "Identifies this object as a MapLayer.",
"enum": [
"layer"
],
"enumDescriptions": [
""
],
"annotations": {
"required": [
"mapsengine.maps.create",
"mapsengine.maps.patch"
]
}
},
"visibility": {
"type": "string",
"description": "The visibility setting of this MapLayer. One of \"defaultOn\" or \"defaultOff\"."
}
}
}
}
}

View file

@ -0,0 +1,465 @@
// Package additionalpropsobjs provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/additionalpropsobjs/v1"
// ...
// additionalpropsobjsService, err := additionalpropsobjs.New(oauthHttpClient)
package additionalpropsobjs // import "google.golang.org/api/additionalpropsobjs/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "additionalpropsobjs:v1"
const apiName = "additionalpropsobjs"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type GeoJsonGeometry map[string]interface{}
func (t GeoJsonGeometry) Type() string {
return googleapi.VariantType(t)
}
func (t GeoJsonGeometry) GeometryCollection() (r GeoJsonGeometryCollection, ok bool) {
if t.Type() != "GeometryCollection" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) LineString() (r GeoJsonLineString, ok bool) {
if t.Type() != "LineString" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) MultiLineString() (r GeoJsonMultiLineString, ok bool) {
if t.Type() != "MultiLineString" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) MultiPoint() (r GeoJsonMultiPoint, ok bool) {
if t.Type() != "MultiPoint" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) MultiPolygon() (r GeoJsonMultiPolygon, ok bool) {
if t.Type() != "MultiPolygon" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) Point() (r GeoJsonPoint, ok bool) {
if t.Type() != "Point" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t GeoJsonGeometry) Polygon() (r GeoJsonPolygon, ok bool) {
if t.Type() != "Polygon" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
// GeoJsonGeometryCollection: A heterogenous collection of
// GeoJsonGeometry objects.
type GeoJsonGeometryCollection struct {
// Geometries: An array of geometry objects. There must be at least 2
// different types of geometries in the array.
Geometries []GeoJsonGeometry `json:"geometries,omitempty"`
// Type: Identifies this object as a GeoJsonGeometryCollection.
//
// Possible values:
// "GeometryCollection"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Geometries") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonGeometryCollection) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonGeometryCollection
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type GeoJsonLineString struct {
// Coordinates: An array of two or more positions, representing a line.
Coordinates [][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonLineString.
//
// Possible values:
// "LineString"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonLineString) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonLineString
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// GeoJsonMultiLineString: Multi Line String
type GeoJsonMultiLineString struct {
// Coordinates: An array of at least two GeoJsonLineString coordinate
// arrays.
Coordinates [][][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonMultiLineString.
//
// Possible values:
// "MultiLineString"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonMultiLineString) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonMultiLineString
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type GeoJsonMultiPoint struct {
// Coordinates: An array of at least two GeoJsonPoint coordinate arrays.
Coordinates [][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonMultiPoint.
//
// Possible values:
// "MultiPoint"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonMultiPoint) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonMultiPoint
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type GeoJsonMultiPolygon struct {
// Coordinates: An array of at least two GeoJsonPolygon coordinate
// arrays.
Coordinates [][][][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonMultiPolygon.
//
// Possible values:
// "MultiPolygon"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonMultiPolygon) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonMultiPolygon
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type GeoJsonPoint struct {
// Coordinates: A single GeoJsonPosition, specifying the location of the
// point.
Coordinates []float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonPoint.
//
// Possible values:
// "Point"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonPoint) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonPoint
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type GeoJsonPolygon struct {
// Coordinates: An array of LinearRings, each of which is an array of
// four or more GeoJsonPositions. The first and last coordinates in each
// LinearRing must be the same. For polygons with multiple rings, the
// first LinearRing is the external ring, with subsequent rings being
// interior rings (i.e. hole). All LinearRings must contain
// GeoJsonPositions in counter-clockwise order.
Coordinates [][][]float64 `json:"coordinates,omitempty"`
// Type: Identifies this object as a GeoJsonPolygon.
//
// Possible values:
// "Polygon"
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Coordinates") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *GeoJsonPolygon) MarshalJSON() ([]byte, error) {
type noMethod GeoJsonPolygon
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type MapFolder struct {
Contents []MapItem `json:"contents,omitempty"`
// DefaultViewport: An array of four numbers (west, south, east, north)
// which defines the rectangular bounding box of the default viewport.
// The numbers represent latitude and longitude in decimal degrees.
DefaultViewport []float64 `json:"defaultViewport,omitempty"`
// Expandable: The expandability setting of this MapFolder. If true, the
// folder can be expanded.
Expandable bool `json:"expandable,omitempty"`
// Key: A user defined alias for this MapFolder, specific to this Map.
Key string `json:"key,omitempty"`
// Name: The name of this MapFolder.
Name string `json:"name,omitempty"`
// Type: Identifies this object as a MapFolder.
//
// Possible values:
// "folder"
Type string `json:"type,omitempty"`
// Visibility: The visibility setting of this MapFolder. One of
// "defaultOn" or "defaultOff".
Visibility string `json:"visibility,omitempty"`
// ForceSendFields is a list of field names (e.g. "Contents") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *MapFolder) MarshalJSON() ([]byte, error) {
type noMethod MapFolder
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type MapItem map[string]interface{}
func (t MapItem) Type() string {
return googleapi.VariantType(t)
}
func (t MapItem) Folder() (r MapFolder, ok bool) {
if t.Type() != "Folder" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t MapItem) KmlLink() (r MapKmlLink, ok bool) {
if t.Type() != "KmlLink" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
func (t MapItem) Layer() (r MapLayer, ok bool) {
if t.Type() != "Layer" {
return r, false
}
ok = googleapi.ConvertVariant(map[string]interface{}(t), &r)
return r, ok
}
type MapKmlLink struct {
// DefaultViewport: An array of four numbers (west, south, east, north)
// which defines the rectangular bounding box of the default viewport.
// The numbers represent latitude and longitude in decimal degrees.
DefaultViewport []float64 `json:"defaultViewport,omitempty"`
// KmlUrl: The URL to the KML file represented by this MapKmlLink.
KmlUrl string `json:"kmlUrl,omitempty"`
// Name: The name of this MapKmlLink.
Name string `json:"name,omitempty"`
// Type: Identifies this object as a MapKmlLink.
//
// Possible values:
// "kmlLink"
Type string `json:"type,omitempty"`
// Visibility: The visibility setting of this MapKmlLink. One of
// "defaultOn" or "defaultOff".
Visibility string `json:"visibility,omitempty"`
// ForceSendFields is a list of field names (e.g. "DefaultViewport") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *MapKmlLink) MarshalJSON() ([]byte, error) {
type noMethod MapKmlLink
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type MapLayer struct {
// DefaultViewport: An array of four numbers (west, south, east, north)
// which defines the rectangular bounding box of the default viewport.
// The numbers represent latitude and longitude in decimal degrees.
DefaultViewport []float64 `json:"defaultViewport,omitempty"`
// Id: The ID of this MapLayer. This ID can be used to request more
// details about the layer.
Id string `json:"id,omitempty"`
// Key: A user defined alias for this MapLayer, specific to this Map.
Key string `json:"key,omitempty"`
// Name: The name of this MapLayer.
Name string `json:"name,omitempty"`
// Type: Identifies this object as a MapLayer.
//
// Possible values:
// "layer"
Type string `json:"type,omitempty"`
// Visibility: The visibility setting of this MapLayer. One of
// "defaultOn" or "defaultOff".
Visibility string `json:"visibility,omitempty"`
// ForceSendFields is a list of field names (e.g. "DefaultViewport") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *MapLayer) MarshalJSON() ([]byte, error) {
type noMethod MapLayer
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}

View file

@ -0,0 +1,30 @@
{
"kind": "discovery#restDescription",
"etag": "\"kEk3sFj6Ef5_yR1-H3bAO6qw9mI/3m5rB86FE5KuW1K3jAl88AxCreg\"",
"discoveryVersion": "v1",
"id": "wrapnewlines:v1",
"name": "wrapnewlines",
"version": "v1",
"title": "Example API",
"description": "The Example API demonstrates wrapping of descriptions containing newlines.",
"ownerDomain": "google.com",
"ownerName": "Google",
"protocol": "rest",
"schemas": {
"Thing": {
"id": "Thing",
"type": "object",
"description": "don't care",
"properties": {
"oneline": {
"type": "string",
"description": "First sentence. Second sentence. Description is long enough to be wrapped."
},
"twoline": {
"type": "string",
"description": "First sentence.\nSecond sentence. Description is long enough to be wrapped."
}
}
}
}
}

View file

@ -0,0 +1,90 @@
// Package wrapnewlines provides access to the Example API.
//
// Usage example:
//
// import "google.golang.org/api/wrapnewlines/v1"
// ...
// wrapnewlinesService, err := wrapnewlines.New(oauthHttpClient)
package wrapnewlines // import "google.golang.org/api/wrapnewlines/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "wrapnewlines:v1"
const apiName = "wrapnewlines"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/discovery/v1/apis"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// Thing: don't care
type Thing struct {
// Oneline: First sentence. Second sentence. Description is long enough
// to be wrapped.
Oneline string `json:"oneline,omitempty"`
// Twoline: First sentence.
// Second sentence. Description is long enough to be wrapped.
Twoline string `json:"twoline,omitempty"`
// ForceSendFields is a list of field names (e.g. "Oneline") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Thing) MarshalJSON() ([]byte, error) {
type noMethod Thing
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}