You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1293 lines
48 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package discovery provides access to the API Discovery Service.
  6. //
  7. // For product documentation, see: https://developers.google.com/discovery/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/discovery/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // discoveryService, err := discovery.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // discoveryService, err := discovery.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // discoveryService, err := discovery.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package discovery // import "google.golang.org/api/discovery/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "discovery:v1"
  67. const apiName = "discovery"
  68. const apiVersion = "v1"
  69. const basePath = "https://www.googleapis.com/discovery/v1/"
  70. // NewService creates a new Service.
  71. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  72. client, endpoint, err := htransport.NewClient(ctx, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. s, err := New(client)
  77. if err != nil {
  78. return nil, err
  79. }
  80. if endpoint != "" {
  81. s.BasePath = endpoint
  82. }
  83. return s, nil
  84. }
  85. // New creates a new Service. It uses the provided http.Client for requests.
  86. //
  87. // Deprecated: please use NewService instead.
  88. // To provide a custom HTTP client, use option.WithHTTPClient.
  89. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  90. func New(client *http.Client) (*Service, error) {
  91. if client == nil {
  92. return nil, errors.New("client is nil")
  93. }
  94. s := &Service{client: client, BasePath: basePath}
  95. s.Apis = NewApisService(s)
  96. return s, nil
  97. }
  98. type Service struct {
  99. client *http.Client
  100. BasePath string // API endpoint base URL
  101. UserAgent string // optional additional User-Agent fragment
  102. Apis *ApisService
  103. }
  104. func (s *Service) userAgent() string {
  105. if s.UserAgent == "" {
  106. return googleapi.UserAgent
  107. }
  108. return googleapi.UserAgent + " " + s.UserAgent
  109. }
  110. func NewApisService(s *Service) *ApisService {
  111. rs := &ApisService{s: s}
  112. return rs
  113. }
  114. type ApisService struct {
  115. s *Service
  116. }
  117. type DirectoryList struct {
  118. // DiscoveryVersion: Indicate the version of the Discovery API used to
  119. // generate this doc.
  120. DiscoveryVersion string `json:"discoveryVersion,omitempty"`
  121. // Items: The individual directory entries. One entry per api/version
  122. // pair.
  123. Items []*DirectoryListItems `json:"items,omitempty"`
  124. // Kind: The kind for this response.
  125. Kind string `json:"kind,omitempty"`
  126. // ServerResponse contains the HTTP response code and headers from the
  127. // server.
  128. googleapi.ServerResponse `json:"-"`
  129. // ForceSendFields is a list of field names (e.g. "DiscoveryVersion") to
  130. // unconditionally include in API requests. By default, fields with
  131. // empty values are omitted from API requests. However, any non-pointer,
  132. // non-interface field appearing in ForceSendFields will be sent to the
  133. // server regardless of whether the field is empty or not. This may be
  134. // used to include empty fields in Patch requests.
  135. ForceSendFields []string `json:"-"`
  136. // NullFields is a list of field names (e.g. "DiscoveryVersion") to
  137. // include in API requests with the JSON null value. By default, fields
  138. // with empty values are omitted from API requests. However, any field
  139. // with an empty value appearing in NullFields will be sent to the
  140. // server as null. It is an error if a field in this list has a
  141. // non-empty value. This may be used to include null fields in Patch
  142. // requests.
  143. NullFields []string `json:"-"`
  144. }
  145. func (s *DirectoryList) MarshalJSON() ([]byte, error) {
  146. type NoMethod DirectoryList
  147. raw := NoMethod(*s)
  148. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  149. }
  150. type DirectoryListItems struct {
  151. // Description: The description of this API.
  152. Description string `json:"description,omitempty"`
  153. // DiscoveryLink: A link to the discovery document.
  154. DiscoveryLink string `json:"discoveryLink,omitempty"`
  155. // DiscoveryRestUrl: The URL for the discovery REST document.
  156. DiscoveryRestUrl string `json:"discoveryRestUrl,omitempty"`
  157. // DocumentationLink: A link to human readable documentation for the
  158. // API.
  159. DocumentationLink string `json:"documentationLink,omitempty"`
  160. // Icons: Links to 16x16 and 32x32 icons representing the API.
  161. Icons *DirectoryListItemsIcons `json:"icons,omitempty"`
  162. // Id: The id of this API.
  163. Id string `json:"id,omitempty"`
  164. // Kind: The kind for this response.
  165. Kind string `json:"kind,omitempty"`
  166. // Labels: Labels for the status of this API, such as labs or
  167. // deprecated.
  168. Labels []string `json:"labels,omitempty"`
  169. // Name: The name of the API.
  170. Name string `json:"name,omitempty"`
  171. // Preferred: True if this version is the preferred version to use.
  172. Preferred bool `json:"preferred,omitempty"`
  173. // Title: The title of this API.
  174. Title string `json:"title,omitempty"`
  175. // Version: The version of the API.
  176. Version string `json:"version,omitempty"`
  177. // ForceSendFields is a list of field names (e.g. "Description") to
  178. // unconditionally include in API requests. By default, fields with
  179. // empty values are omitted from API requests. However, any non-pointer,
  180. // non-interface field appearing in ForceSendFields will be sent to the
  181. // server regardless of whether the field is empty or not. This may be
  182. // used to include empty fields in Patch requests.
  183. ForceSendFields []string `json:"-"`
  184. // NullFields is a list of field names (e.g. "Description") to include
  185. // in API requests with the JSON null value. By default, fields with
  186. // empty values are omitted from API requests. However, any field with
  187. // an empty value appearing in NullFields will be sent to the server as
  188. // null. It is an error if a field in this list has a non-empty value.
  189. // This may be used to include null fields in Patch requests.
  190. NullFields []string `json:"-"`
  191. }
  192. func (s *DirectoryListItems) MarshalJSON() ([]byte, error) {
  193. type NoMethod DirectoryListItems
  194. raw := NoMethod(*s)
  195. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  196. }
  197. // DirectoryListItemsIcons: Links to 16x16 and 32x32 icons representing
  198. // the API.
  199. type DirectoryListItemsIcons struct {
  200. // X16: The URL of the 16x16 icon.
  201. X16 string `json:"x16,omitempty"`
  202. // X32: The URL of the 32x32 icon.
  203. X32 string `json:"x32,omitempty"`
  204. // ForceSendFields is a list of field names (e.g. "X16") to
  205. // unconditionally include in API requests. By default, fields with
  206. // empty values are omitted from API requests. However, any non-pointer,
  207. // non-interface field appearing in ForceSendFields will be sent to the
  208. // server regardless of whether the field is empty or not. This may be
  209. // used to include empty fields in Patch requests.
  210. ForceSendFields []string `json:"-"`
  211. // NullFields is a list of field names (e.g. "X16") to include in API
  212. // requests with the JSON null value. By default, fields with empty
  213. // values are omitted from API requests. However, any field with an
  214. // empty value appearing in NullFields will be sent to the server as
  215. // null. It is an error if a field in this list has a non-empty value.
  216. // This may be used to include null fields in Patch requests.
  217. NullFields []string `json:"-"`
  218. }
  219. func (s *DirectoryListItemsIcons) MarshalJSON() ([]byte, error) {
  220. type NoMethod DirectoryListItemsIcons
  221. raw := NoMethod(*s)
  222. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  223. }
  224. type JsonSchema struct {
  225. // Ref: A reference to another schema. The value of this property is the
  226. // "id" of another schema.
  227. Ref string `json:"$ref,omitempty"`
  228. // AdditionalProperties: If this is a schema for an object, this
  229. // property is the schema for any additional properties with dynamic
  230. // keys on this object.
  231. AdditionalProperties *JsonSchema `json:"additionalProperties,omitempty"`
  232. // Annotations: Additional information about this property.
  233. Annotations *JsonSchemaAnnotations `json:"annotations,omitempty"`
  234. // Default: The default value of this property (if one exists).
  235. Default string `json:"default,omitempty"`
  236. // Description: A description of this object.
  237. Description string `json:"description,omitempty"`
  238. // Enum: Values this parameter may take (if it is an enum).
  239. Enum []string `json:"enum,omitempty"`
  240. // EnumDescriptions: The descriptions for the enums. Each position maps
  241. // to the corresponding value in the "enum" array.
  242. EnumDescriptions []string `json:"enumDescriptions,omitempty"`
  243. // Format: An additional regular expression or key that helps constrain
  244. // the value. For more details see:
  245. // http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23
  246. Format string `json:"format,omitempty"`
  247. // Id: Unique identifier for this schema.
  248. Id string `json:"id,omitempty"`
  249. // Items: If this is a schema for an array, this property is the schema
  250. // for each element in the array.
  251. Items *JsonSchema `json:"items,omitempty"`
  252. // Location: Whether this parameter goes in the query or the path for
  253. // REST requests.
  254. Location string `json:"location,omitempty"`
  255. // Maximum: The maximum value of this parameter.
  256. Maximum string `json:"maximum,omitempty"`
  257. // Minimum: The minimum value of this parameter.
  258. Minimum string `json:"minimum,omitempty"`
  259. // Pattern: The regular expression this parameter must conform to. Uses
  260. // Java 6 regex format:
  261. // http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
  262. Pattern string `json:"pattern,omitempty"`
  263. // Properties: If this is a schema for an object, list the schema for
  264. // each property of this object.
  265. Properties map[string]JsonSchema `json:"properties,omitempty"`
  266. // ReadOnly: The value is read-only, generated by the service. The value
  267. // cannot be modified by the client. If the value is included in a POST,
  268. // PUT, or PATCH request, it is ignored by the service.
  269. ReadOnly bool `json:"readOnly,omitempty"`
  270. // Repeated: Whether this parameter may appear multiple times.
  271. Repeated bool `json:"repeated,omitempty"`
  272. // Required: Whether the parameter is required.
  273. Required bool `json:"required,omitempty"`
  274. // Type: The value type for this schema. A list of values can be found
  275. // here: http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
  276. Type string `json:"type,omitempty"`
  277. // Variant: In a variant data type, the value of one property is used to
  278. // determine how to interpret the entire entity. Its value must exist in
  279. // a map of descriminant values to schema names.
  280. Variant *JsonSchemaVariant `json:"variant,omitempty"`
  281. // ForceSendFields is a list of field names (e.g. "Ref") to
  282. // unconditionally include in API requests. By default, fields with
  283. // empty values are omitted from API requests. However, any non-pointer,
  284. // non-interface field appearing in ForceSendFields will be sent to the
  285. // server regardless of whether the field is empty or not. This may be
  286. // used to include empty fields in Patch requests.
  287. ForceSendFields []string `json:"-"`
  288. // NullFields is a list of field names (e.g. "Ref") to include in API
  289. // requests with the JSON null value. By default, fields with empty
  290. // values are omitted from API requests. However, any field with an
  291. // empty value appearing in NullFields will be sent to the server as
  292. // null. It is an error if a field in this list has a non-empty value.
  293. // This may be used to include null fields in Patch requests.
  294. NullFields []string `json:"-"`
  295. }
  296. func (s *JsonSchema) MarshalJSON() ([]byte, error) {
  297. type NoMethod JsonSchema
  298. raw := NoMethod(*s)
  299. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  300. }
  301. // JsonSchemaAnnotations: Additional information about this property.
  302. type JsonSchemaAnnotations struct {
  303. // Required: A list of methods for which this property is required on
  304. // requests.
  305. Required []string `json:"required,omitempty"`
  306. // ForceSendFields is a list of field names (e.g. "Required") to
  307. // unconditionally include in API requests. By default, fields with
  308. // empty values are omitted from API requests. However, any non-pointer,
  309. // non-interface field appearing in ForceSendFields will be sent to the
  310. // server regardless of whether the field is empty or not. This may be
  311. // used to include empty fields in Patch requests.
  312. ForceSendFields []string `json:"-"`
  313. // NullFields is a list of field names (e.g. "Required") to include in
  314. // API requests with the JSON null value. By default, fields with empty
  315. // values are omitted from API requests. However, any field with an
  316. // empty value appearing in NullFields will be sent to the server as
  317. // null. It is an error if a field in this list has a non-empty value.
  318. // This may be used to include null fields in Patch requests.
  319. NullFields []string `json:"-"`
  320. }
  321. func (s *JsonSchemaAnnotations) MarshalJSON() ([]byte, error) {
  322. type NoMethod JsonSchemaAnnotations
  323. raw := NoMethod(*s)
  324. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  325. }
  326. // JsonSchemaVariant: In a variant data type, the value of one property
  327. // is used to determine how to interpret the entire entity. Its value
  328. // must exist in a map of descriminant values to schema names.
  329. type JsonSchemaVariant struct {
  330. // Discriminant: The name of the type discriminant property.
  331. Discriminant string `json:"discriminant,omitempty"`
  332. // Map: The map of discriminant value to schema to use for parsing..
  333. Map []*JsonSchemaVariantMap `json:"map,omitempty"`
  334. // ForceSendFields is a list of field names (e.g. "Discriminant") to
  335. // unconditionally include in API requests. By default, fields with
  336. // empty values are omitted from API requests. However, any non-pointer,
  337. // non-interface field appearing in ForceSendFields will be sent to the
  338. // server regardless of whether the field is empty or not. This may be
  339. // used to include empty fields in Patch requests.
  340. ForceSendFields []string `json:"-"`
  341. // NullFields is a list of field names (e.g. "Discriminant") to include
  342. // in API requests with the JSON null value. By default, fields with
  343. // empty values are omitted from API requests. However, any field with
  344. // an empty value appearing in NullFields will be sent to the server as
  345. // null. It is an error if a field in this list has a non-empty value.
  346. // This may be used to include null fields in Patch requests.
  347. NullFields []string `json:"-"`
  348. }
  349. func (s *JsonSchemaVariant) MarshalJSON() ([]byte, error) {
  350. type NoMethod JsonSchemaVariant
  351. raw := NoMethod(*s)
  352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  353. }
  354. type JsonSchemaVariantMap struct {
  355. Ref string `json:"$ref,omitempty"`
  356. TypeValue string `json:"type_value,omitempty"`
  357. // ForceSendFields is a list of field names (e.g. "Ref") to
  358. // unconditionally include in API requests. By default, fields with
  359. // empty values are omitted from API requests. However, any non-pointer,
  360. // non-interface field appearing in ForceSendFields will be sent to the
  361. // server regardless of whether the field is empty or not. This may be
  362. // used to include empty fields in Patch requests.
  363. ForceSendFields []string `json:"-"`
  364. // NullFields is a list of field names (e.g. "Ref") to include in API
  365. // requests with the JSON null value. By default, fields with empty
  366. // values are omitted from API requests. However, any field with an
  367. // empty value appearing in NullFields will be sent to the server as
  368. // null. It is an error if a field in this list has a non-empty value.
  369. // This may be used to include null fields in Patch requests.
  370. NullFields []string `json:"-"`
  371. }
  372. func (s *JsonSchemaVariantMap) MarshalJSON() ([]byte, error) {
  373. type NoMethod JsonSchemaVariantMap
  374. raw := NoMethod(*s)
  375. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  376. }
  377. type RestDescription struct {
  378. // Auth: Authentication information.
  379. Auth *RestDescriptionAuth `json:"auth,omitempty"`
  380. // BasePath: [DEPRECATED] The base path for REST requests.
  381. BasePath string `json:"basePath,omitempty"`
  382. // BaseUrl: [DEPRECATED] The base URL for REST requests.
  383. BaseUrl string `json:"baseUrl,omitempty"`
  384. // BatchPath: The path for REST batch requests.
  385. BatchPath string `json:"batchPath,omitempty"`
  386. // CanonicalName: Indicates how the API name should be capitalized and
  387. // split into various parts. Useful for generating pretty class names.
  388. CanonicalName string `json:"canonicalName,omitempty"`
  389. // Description: The description of this API.
  390. Description string `json:"description,omitempty"`
  391. // DiscoveryVersion: Indicate the version of the Discovery API used to
  392. // generate this doc.
  393. DiscoveryVersion string `json:"discoveryVersion,omitempty"`
  394. // DocumentationLink: A link to human readable documentation for the
  395. // API.
  396. DocumentationLink string `json:"documentationLink,omitempty"`
  397. // Etag: The ETag for this response.
  398. Etag string `json:"etag,omitempty"`
  399. // ExponentialBackoffDefault: Enable exponential backoff for suitable
  400. // methods in the generated clients.
  401. ExponentialBackoffDefault bool `json:"exponentialBackoffDefault,omitempty"`
  402. // Features: A list of supported features for this API.
  403. Features []string `json:"features,omitempty"`
  404. // Icons: Links to 16x16 and 32x32 icons representing the API.
  405. Icons *RestDescriptionIcons `json:"icons,omitempty"`
  406. // Id: The ID of this API.
  407. Id string `json:"id,omitempty"`
  408. // Kind: The kind for this response.
  409. Kind string `json:"kind,omitempty"`
  410. // Labels: Labels for the status of this API, such as labs or
  411. // deprecated.
  412. Labels []string `json:"labels,omitempty"`
  413. // Methods: API-level methods for this API.
  414. Methods map[string]RestMethod `json:"methods,omitempty"`
  415. // Name: The name of this API.
  416. Name string `json:"name,omitempty"`
  417. // OwnerDomain: The domain of the owner of this API. Together with the
  418. // ownerName and a packagePath values, this can be used to generate a
  419. // library for this API which would have a unique fully qualified name.
  420. OwnerDomain string `json:"ownerDomain,omitempty"`
  421. // OwnerName: The name of the owner of this API. See ownerDomain.
  422. OwnerName string `json:"ownerName,omitempty"`
  423. // PackagePath: The package of the owner of this API. See ownerDomain.
  424. PackagePath string `json:"packagePath,omitempty"`
  425. // Parameters: Common parameters that apply across all apis.
  426. Parameters map[string]JsonSchema `json:"parameters,omitempty"`
  427. // Protocol: The protocol described by this document.
  428. Protocol string `json:"protocol,omitempty"`
  429. // Resources: The resources in this API.
  430. Resources map[string]RestResource `json:"resources,omitempty"`
  431. // Revision: The version of this API.
  432. Revision string `json:"revision,omitempty"`
  433. // RootUrl: The root URL under which all API services live.
  434. RootUrl string `json:"rootUrl,omitempty"`
  435. // Schemas: The schemas for this API.
  436. Schemas map[string]JsonSchema `json:"schemas,omitempty"`
  437. // ServicePath: The base path for all REST requests.
  438. ServicePath string `json:"servicePath,omitempty"`
  439. // Title: The title of this API.
  440. Title string `json:"title,omitempty"`
  441. // Version: The version of this API.
  442. Version string `json:"version,omitempty"`
  443. VersionModule bool `json:"version_module,omitempty"`
  444. // ServerResponse contains the HTTP response code and headers from the
  445. // server.
  446. googleapi.ServerResponse `json:"-"`
  447. // ForceSendFields is a list of field names (e.g. "Auth") to
  448. // unconditionally include in API requests. By default, fields with
  449. // empty values are omitted from API requests. However, any non-pointer,
  450. // non-interface field appearing in ForceSendFields will be sent to the
  451. // server regardless of whether the field is empty or not. This may be
  452. // used to include empty fields in Patch requests.
  453. ForceSendFields []string `json:"-"`
  454. // NullFields is a list of field names (e.g. "Auth") to include in API
  455. // requests with the JSON null value. By default, fields with empty
  456. // values are omitted from API requests. However, any field with an
  457. // empty value appearing in NullFields will be sent to the server as
  458. // null. It is an error if a field in this list has a non-empty value.
  459. // This may be used to include null fields in Patch requests.
  460. NullFields []string `json:"-"`
  461. }
  462. func (s *RestDescription) MarshalJSON() ([]byte, error) {
  463. type NoMethod RestDescription
  464. raw := NoMethod(*s)
  465. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  466. }
  467. // RestDescriptionAuth: Authentication information.
  468. type RestDescriptionAuth struct {
  469. // Oauth2: OAuth 2.0 authentication information.
  470. Oauth2 *RestDescriptionAuthOauth2 `json:"oauth2,omitempty"`
  471. // ForceSendFields is a list of field names (e.g. "Oauth2") to
  472. // unconditionally include in API requests. By default, fields with
  473. // empty values are omitted from API requests. However, any non-pointer,
  474. // non-interface field appearing in ForceSendFields will be sent to the
  475. // server regardless of whether the field is empty or not. This may be
  476. // used to include empty fields in Patch requests.
  477. ForceSendFields []string `json:"-"`
  478. // NullFields is a list of field names (e.g. "Oauth2") to include in API
  479. // requests with the JSON null value. By default, fields with empty
  480. // values are omitted from API requests. However, any field with an
  481. // empty value appearing in NullFields will be sent to the server as
  482. // null. It is an error if a field in this list has a non-empty value.
  483. // This may be used to include null fields in Patch requests.
  484. NullFields []string `json:"-"`
  485. }
  486. func (s *RestDescriptionAuth) MarshalJSON() ([]byte, error) {
  487. type NoMethod RestDescriptionAuth
  488. raw := NoMethod(*s)
  489. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  490. }
  491. // RestDescriptionAuthOauth2: OAuth 2.0 authentication information.
  492. type RestDescriptionAuthOauth2 struct {
  493. // Scopes: Available OAuth 2.0 scopes.
  494. Scopes map[string]RestDescriptionAuthOauth2Scopes `json:"scopes,omitempty"`
  495. // ForceSendFields is a list of field names (e.g. "Scopes") to
  496. // unconditionally include in API requests. By default, fields with
  497. // empty values are omitted from API requests. However, any non-pointer,
  498. // non-interface field appearing in ForceSendFields will be sent to the
  499. // server regardless of whether the field is empty or not. This may be
  500. // used to include empty fields in Patch requests.
  501. ForceSendFields []string `json:"-"`
  502. // NullFields is a list of field names (e.g. "Scopes") to include in API
  503. // requests with the JSON null value. By default, fields with empty
  504. // values are omitted from API requests. However, any field with an
  505. // empty value appearing in NullFields will be sent to the server as
  506. // null. It is an error if a field in this list has a non-empty value.
  507. // This may be used to include null fields in Patch requests.
  508. NullFields []string `json:"-"`
  509. }
  510. func (s *RestDescriptionAuthOauth2) MarshalJSON() ([]byte, error) {
  511. type NoMethod RestDescriptionAuthOauth2
  512. raw := NoMethod(*s)
  513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  514. }
  515. // RestDescriptionAuthOauth2Scopes: The scope value.
  516. type RestDescriptionAuthOauth2Scopes struct {
  517. // Description: Description of scope.
  518. Description string `json:"description,omitempty"`
  519. // ForceSendFields is a list of field names (e.g. "Description") to
  520. // unconditionally include in API requests. By default, fields with
  521. // empty values are omitted from API requests. However, any non-pointer,
  522. // non-interface field appearing in ForceSendFields will be sent to the
  523. // server regardless of whether the field is empty or not. This may be
  524. // used to include empty fields in Patch requests.
  525. ForceSendFields []string `json:"-"`
  526. // NullFields is a list of field names (e.g. "Description") to include
  527. // in API requests with the JSON null value. By default, fields with
  528. // empty values are omitted from API requests. However, any field with
  529. // an empty value appearing in NullFields will be sent to the server as
  530. // null. It is an error if a field in this list has a non-empty value.
  531. // This may be used to include null fields in Patch requests.
  532. NullFields []string `json:"-"`
  533. }
  534. func (s *RestDescriptionAuthOauth2Scopes) MarshalJSON() ([]byte, error) {
  535. type NoMethod RestDescriptionAuthOauth2Scopes
  536. raw := NoMethod(*s)
  537. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  538. }
  539. // RestDescriptionIcons: Links to 16x16 and 32x32 icons representing the
  540. // API.
  541. type RestDescriptionIcons struct {
  542. // X16: The URL of the 16x16 icon.
  543. X16 string `json:"x16,omitempty"`
  544. // X32: The URL of the 32x32 icon.
  545. X32 string `json:"x32,omitempty"`
  546. // ForceSendFields is a list of field names (e.g. "X16") to
  547. // unconditionally include in API requests. By default, fields with
  548. // empty values are omitted from API requests. However, any non-pointer,
  549. // non-interface field appearing in ForceSendFields will be sent to the
  550. // server regardless of whether the field is empty or not. This may be
  551. // used to include empty fields in Patch requests.
  552. ForceSendFields []string `json:"-"`
  553. // NullFields is a list of field names (e.g. "X16") to include in API
  554. // requests with the JSON null value. By default, fields with empty
  555. // values are omitted from API requests. However, any field with an
  556. // empty value appearing in NullFields will be sent to the server as
  557. // null. It is an error if a field in this list has a non-empty value.
  558. // This may be used to include null fields in Patch requests.
  559. NullFields []string `json:"-"`
  560. }
  561. func (s *RestDescriptionIcons) MarshalJSON() ([]byte, error) {
  562. type NoMethod RestDescriptionIcons
  563. raw := NoMethod(*s)
  564. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  565. }
  566. type RestMethod struct {
  567. // Description: Description of this method.
  568. Description string `json:"description,omitempty"`
  569. // EtagRequired: Whether this method requires an ETag to be specified.
  570. // The ETag is sent as an HTTP If-Match or If-None-Match header.
  571. EtagRequired bool `json:"etagRequired,omitempty"`
  572. // HttpMethod: HTTP method used by this method.
  573. HttpMethod string `json:"httpMethod,omitempty"`
  574. // Id: A unique ID for this method. This property can be used to match
  575. // methods between different versions of Discovery.
  576. Id string `json:"id,omitempty"`
  577. // MediaUpload: Media upload parameters.
  578. MediaUpload *RestMethodMediaUpload `json:"mediaUpload,omitempty"`
  579. // ParameterOrder: Ordered list of required parameters, serves as a hint
  580. // to clients on how to structure their method signatures. The array is
  581. // ordered such that the "most-significant" parameter appears first.
  582. ParameterOrder []string `json:"parameterOrder,omitempty"`
  583. // Parameters: Details for all parameters in this method.
  584. Parameters map[string]JsonSchema `json:"parameters,omitempty"`
  585. // Path: The URI path of this REST method. Should be used in conjunction
  586. // with the basePath property at the api-level.
  587. Path string `json:"path,omitempty"`
  588. // Request: The schema for the request.
  589. Request *RestMethodRequest `json:"request,omitempty"`
  590. // Response: The schema for the response.
  591. Response *RestMethodResponse `json:"response,omitempty"`
  592. // Scopes: OAuth 2.0 scopes applicable to this method.
  593. Scopes []string `json:"scopes,omitempty"`
  594. // SupportsMediaDownload: Whether this method supports media downloads.
  595. SupportsMediaDownload bool `json:"supportsMediaDownload,omitempty"`
  596. // SupportsMediaUpload: Whether this method supports media uploads.
  597. SupportsMediaUpload bool `json:"supportsMediaUpload,omitempty"`
  598. // SupportsSubscription: Whether this method supports subscriptions.
  599. SupportsSubscription bool `json:"supportsSubscription,omitempty"`
  600. // UseMediaDownloadService: Indicates that downloads from this method
  601. // should use the download service URL (i.e. "/download"). Only applies
  602. // if the method supports media download.
  603. UseMediaDownloadService bool `json:"useMediaDownloadService,omitempty"`
  604. // ForceSendFields is a list of field names (e.g. "Description") to
  605. // unconditionally include in API requests. By default, fields with
  606. // empty values are omitted from API requests. However, any non-pointer,
  607. // non-interface field appearing in ForceSendFields will be sent to the
  608. // server regardless of whether the field is empty or not. This may be
  609. // used to include empty fields in Patch requests.
  610. ForceSendFields []string `json:"-"`
  611. // NullFields is a list of field names (e.g. "Description") to include
  612. // in API requests with the JSON null value. By default, fields with
  613. // empty values are omitted from API requests. However, any field with
  614. // an empty value appearing in NullFields will be sent to the server as
  615. // null. It is an error if a field in this list has a non-empty value.
  616. // This may be used to include null fields in Patch requests.
  617. NullFields []string `json:"-"`
  618. }
  619. func (s *RestMethod) MarshalJSON() ([]byte, error) {
  620. type NoMethod RestMethod
  621. raw := NoMethod(*s)
  622. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  623. }
  624. // RestMethodMediaUpload: Media upload parameters.
  625. type RestMethodMediaUpload struct {
  626. // Accept: MIME Media Ranges for acceptable media uploads to this
  627. // method.
  628. Accept []string `json:"accept,omitempty"`
  629. // MaxSize: Maximum size of a media upload, such as "1MB", "2GB" or
  630. // "3TB".
  631. MaxSize string `json:"maxSize,omitempty"`
  632. // Protocols: Supported upload protocols.
  633. Protocols *RestMethodMediaUploadProtocols `json:"protocols,omitempty"`
  634. // ForceSendFields is a list of field names (e.g. "Accept") to
  635. // unconditionally include in API requests. By default, fields with
  636. // empty values are omitted from API requests. However, any non-pointer,
  637. // non-interface field appearing in ForceSendFields will be sent to the
  638. // server regardless of whether the field is empty or not. This may be
  639. // used to include empty fields in Patch requests.
  640. ForceSendFields []string `json:"-"`
  641. // NullFields is a list of field names (e.g. "Accept") to include in API
  642. // requests with the JSON null value. By default, fields with empty
  643. // values are omitted from API requests. However, any field with an
  644. // empty value appearing in NullFields will be sent to the server as
  645. // null. It is an error if a field in this list has a non-empty value.
  646. // This may be used to include null fields in Patch requests.
  647. NullFields []string `json:"-"`
  648. }
  649. func (s *RestMethodMediaUpload) MarshalJSON() ([]byte, error) {
  650. type NoMethod RestMethodMediaUpload
  651. raw := NoMethod(*s)
  652. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  653. }
  654. // RestMethodMediaUploadProtocols: Supported upload protocols.
  655. type RestMethodMediaUploadProtocols struct {
  656. // Resumable: Supports the Resumable Media Upload protocol.
  657. Resumable *RestMethodMediaUploadProtocolsResumable `json:"resumable,omitempty"`
  658. // Simple: Supports uploading as a single HTTP request.
  659. Simple *RestMethodMediaUploadProtocolsSimple `json:"simple,omitempty"`
  660. // ForceSendFields is a list of field names (e.g. "Resumable") to
  661. // unconditionally include in API requests. By default, fields with
  662. // empty values are omitted from API requests. However, any non-pointer,
  663. // non-interface field appearing in ForceSendFields will be sent to the
  664. // server regardless of whether the field is empty or not. This may be
  665. // used to include empty fields in Patch requests.
  666. ForceSendFields []string `json:"-"`
  667. // NullFields is a list of field names (e.g. "Resumable") to include in
  668. // API requests with the JSON null value. By default, fields with empty
  669. // values are omitted from API requests. However, any field with an
  670. // empty value appearing in NullFields will be sent to the server as
  671. // null. It is an error if a field in this list has a non-empty value.
  672. // This may be used to include null fields in Patch requests.
  673. NullFields []string `json:"-"`
  674. }
  675. func (s *RestMethodMediaUploadProtocols) MarshalJSON() ([]byte, error) {
  676. type NoMethod RestMethodMediaUploadProtocols
  677. raw := NoMethod(*s)
  678. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  679. }
  680. // RestMethodMediaUploadProtocolsResumable: Supports the Resumable Media
  681. // Upload protocol.
  682. type RestMethodMediaUploadProtocolsResumable struct {
  683. // Multipart: True if this endpoint supports uploading multipart media.
  684. //
  685. // Default: true
  686. Multipart *bool `json:"multipart,omitempty"`
  687. // Path: The URI path to be used for upload. Should be used in
  688. // conjunction with the basePath property at the api-level.
  689. Path string `json:"path,omitempty"`
  690. // ForceSendFields is a list of field names (e.g. "Multipart") to
  691. // unconditionally include in API requests. By default, fields with
  692. // empty values are omitted from API requests. However, any non-pointer,
  693. // non-interface field appearing in ForceSendFields will be sent to the
  694. // server regardless of whether the field is empty or not. This may be
  695. // used to include empty fields in Patch requests.
  696. ForceSendFields []string `json:"-"`
  697. // NullFields is a list of field names (e.g. "Multipart") to include in
  698. // API requests with the JSON null value. By default, fields with empty
  699. // values are omitted from API requests. However, any field with an
  700. // empty value appearing in NullFields will be sent to the server as
  701. // null. It is an error if a field in this list has a non-empty value.
  702. // This may be used to include null fields in Patch requests.
  703. NullFields []string `json:"-"`
  704. }
  705. func (s *RestMethodMediaUploadProtocolsResumable) MarshalJSON() ([]byte, error) {
  706. type NoMethod RestMethodMediaUploadProtocolsResumable
  707. raw := NoMethod(*s)
  708. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  709. }
  710. // RestMethodMediaUploadProtocolsSimple: Supports uploading as a single
  711. // HTTP request.
  712. type RestMethodMediaUploadProtocolsSimple struct {
  713. // Multipart: True if this endpoint supports upload multipart media.
  714. //
  715. // Default: true
  716. Multipart *bool `json:"multipart,omitempty"`
  717. // Path: The URI path to be used for upload. Should be used in
  718. // conjunction with the basePath property at the api-level.
  719. Path string `json:"path,omitempty"`
  720. // ForceSendFields is a list of field names (e.g. "Multipart") to
  721. // unconditionally include in API requests. By default, fields with
  722. // empty values are omitted from API requests. However, any non-pointer,
  723. // non-interface field appearing in ForceSendFields will be sent to the
  724. // server regardless of whether the field is empty or not. This may be
  725. // used to include empty fields in Patch requests.
  726. ForceSendFields []string `json:"-"`
  727. // NullFields is a list of field names (e.g. "Multipart") to include in
  728. // API requests with the JSON null value. By default, fields with empty
  729. // values are omitted from API requests. However, any field with an
  730. // empty value appearing in NullFields will be sent to the server as
  731. // null. It is an error if a field in this list has a non-empty value.
  732. // This may be used to include null fields in Patch requests.
  733. NullFields []string `json:"-"`
  734. }
  735. func (s *RestMethodMediaUploadProtocolsSimple) MarshalJSON() ([]byte, error) {
  736. type NoMethod RestMethodMediaUploadProtocolsSimple
  737. raw := NoMethod(*s)
  738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  739. }
  740. // RestMethodRequest: The schema for the request.
  741. type RestMethodRequest struct {
  742. // Ref: Schema ID for the request schema.
  743. Ref string `json:"$ref,omitempty"`
  744. // ParameterName: parameter name.
  745. ParameterName string `json:"parameterName,omitempty"`
  746. // ForceSendFields is a list of field names (e.g. "Ref") to
  747. // unconditionally include in API requests. By default, fields with
  748. // empty values are omitted from API requests. However, any non-pointer,
  749. // non-interface field appearing in ForceSendFields will be sent to the
  750. // server regardless of whether the field is empty or not. This may be
  751. // used to include empty fields in Patch requests.
  752. ForceSendFields []string `json:"-"`
  753. // NullFields is a list of field names (e.g. "Ref") to include in API
  754. // requests with the JSON null value. By default, fields with empty
  755. // values are omitted from API requests. However, any field with an
  756. // empty value appearing in NullFields will be sent to the server as
  757. // null. It is an error if a field in this list has a non-empty value.
  758. // This may be used to include null fields in Patch requests.
  759. NullFields []string `json:"-"`
  760. }
  761. func (s *RestMethodRequest) MarshalJSON() ([]byte, error) {
  762. type NoMethod RestMethodRequest
  763. raw := NoMethod(*s)
  764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  765. }
  766. // RestMethodResponse: The schema for the response.
  767. type RestMethodResponse struct {
  768. // Ref: Schema ID for the response schema.
  769. Ref string `json:"$ref,omitempty"`
  770. // ForceSendFields is a list of field names (e.g. "Ref") to
  771. // unconditionally include in API requests. By default, fields with
  772. // empty values are omitted from API requests. However, any non-pointer,
  773. // non-interface field appearing in ForceSendFields will be sent to the
  774. // server regardless of whether the field is empty or not. This may be
  775. // used to include empty fields in Patch requests.
  776. ForceSendFields []string `json:"-"`
  777. // NullFields is a list of field names (e.g. "Ref") to include in API
  778. // requests with the JSON null value. By default, fields with empty
  779. // values are omitted from API requests. However, any field with an
  780. // empty value appearing in NullFields will be sent to the server as
  781. // null. It is an error if a field in this list has a non-empty value.
  782. // This may be used to include null fields in Patch requests.
  783. NullFields []string `json:"-"`
  784. }
  785. func (s *RestMethodResponse) MarshalJSON() ([]byte, error) {
  786. type NoMethod RestMethodResponse
  787. raw := NoMethod(*s)
  788. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  789. }
  790. type RestResource struct {
  791. // Methods: Methods on this resource.
  792. Methods map[string]RestMethod `json:"methods,omitempty"`
  793. // Resources: Sub-resources on this resource.
  794. Resources map[string]RestResource `json:"resources,omitempty"`
  795. // ForceSendFields is a list of field names (e.g. "Methods") to
  796. // unconditionally include in API requests. By default, fields with
  797. // empty values are omitted from API requests. However, any non-pointer,
  798. // non-interface field appearing in ForceSendFields will be sent to the
  799. // server regardless of whether the field is empty or not. This may be
  800. // used to include empty fields in Patch requests.
  801. ForceSendFields []string `json:"-"`
  802. // NullFields is a list of field names (e.g. "Methods") to include in
  803. // API requests with the JSON null value. By default, fields with empty
  804. // values are omitted from API requests. However, any field with an
  805. // empty value appearing in NullFields will be sent to the server as
  806. // null. It is an error if a field in this list has a non-empty value.
  807. // This may be used to include null fields in Patch requests.
  808. NullFields []string `json:"-"`
  809. }
  810. func (s *RestResource) MarshalJSON() ([]byte, error) {
  811. type NoMethod RestResource
  812. raw := NoMethod(*s)
  813. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  814. }
  815. // method id "discovery.apis.getRest":
  816. type ApisGetRestCall struct {
  817. s *Service
  818. api string
  819. version string
  820. urlParams_ gensupport.URLParams
  821. ifNoneMatch_ string
  822. ctx_ context.Context
  823. header_ http.Header
  824. }
  825. // GetRest: Retrieve the description of a particular version of an api.
  826. func (r *ApisService) GetRest(api string, version string) *ApisGetRestCall {
  827. c := &ApisGetRestCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  828. c.api = api
  829. c.version = version
  830. return c
  831. }
  832. // Fields allows partial responses to be retrieved. See
  833. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  834. // for more information.
  835. func (c *ApisGetRestCall) Fields(s ...googleapi.Field) *ApisGetRestCall {
  836. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  837. return c
  838. }
  839. // IfNoneMatch sets the optional parameter which makes the operation
  840. // fail if the object's ETag matches the given value. This is useful for
  841. // getting updates only after the object has changed since the last
  842. // request. Use googleapi.IsNotModified to check whether the response
  843. // error from Do is the result of In-None-Match.
  844. func (c *ApisGetRestCall) IfNoneMatch(entityTag string) *ApisGetRestCall {
  845. c.ifNoneMatch_ = entityTag
  846. return c
  847. }
  848. // Context sets the context to be used in this call's Do method. Any
  849. // pending HTTP request will be aborted if the provided context is
  850. // canceled.
  851. func (c *ApisGetRestCall) Context(ctx context.Context) *ApisGetRestCall {
  852. c.ctx_ = ctx
  853. return c
  854. }
  855. // Header returns an http.Header that can be modified by the caller to
  856. // add HTTP headers to the request.
  857. func (c *ApisGetRestCall) Header() http.Header {
  858. if c.header_ == nil {
  859. c.header_ = make(http.Header)
  860. }
  861. return c.header_
  862. }
  863. func (c *ApisGetRestCall) doRequest(alt string) (*http.Response, error) {
  864. reqHeaders := make(http.Header)
  865. for k, v := range c.header_ {
  866. reqHeaders[k] = v
  867. }
  868. reqHeaders.Set("User-Agent", c.s.userAgent())
  869. if c.ifNoneMatch_ != "" {
  870. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  871. }
  872. var body io.Reader = nil
  873. c.urlParams_.Set("alt", alt)
  874. c.urlParams_.Set("prettyPrint", "false")
  875. urls := googleapi.ResolveRelative(c.s.BasePath, "apis/{api}/{version}/rest")
  876. urls += "?" + c.urlParams_.Encode()
  877. req, err := http.NewRequest("GET", urls, body)
  878. if err != nil {
  879. return nil, err
  880. }
  881. req.Header = reqHeaders
  882. googleapi.Expand(req.URL, map[string]string{
  883. "api": c.api,
  884. "version": c.version,
  885. })
  886. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  887. }
  888. // Do executes the "discovery.apis.getRest" call.
  889. // Exactly one of *RestDescription or error will be non-nil. Any non-2xx
  890. // status code is an error. Response headers are in either
  891. // *RestDescription.ServerResponse.Header or (if a response was returned
  892. // at all) in error.(*googleapi.Error).Header. Use
  893. // googleapi.IsNotModified to check whether the returned error was
  894. // because http.StatusNotModified was returned.
  895. func (c *ApisGetRestCall) Do(opts ...googleapi.CallOption) (*RestDescription, error) {
  896. gensupport.SetOptions(c.urlParams_, opts...)
  897. res, err := c.doRequest("json")
  898. if res != nil && res.StatusCode == http.StatusNotModified {
  899. if res.Body != nil {
  900. res.Body.Close()
  901. }
  902. return nil, &googleapi.Error{
  903. Code: res.StatusCode,
  904. Header: res.Header,
  905. }
  906. }
  907. if err != nil {
  908. return nil, err
  909. }
  910. defer googleapi.CloseBody(res)
  911. if err := googleapi.CheckResponse(res); err != nil {
  912. return nil, err
  913. }
  914. ret := &RestDescription{
  915. ServerResponse: googleapi.ServerResponse{
  916. Header: res.Header,
  917. HTTPStatusCode: res.StatusCode,
  918. },
  919. }
  920. target := &ret
  921. if err := gensupport.DecodeResponse(target, res); err != nil {
  922. return nil, err
  923. }
  924. return ret, nil
  925. // {
  926. // "description": "Retrieve the description of a particular version of an api.",
  927. // "httpMethod": "GET",
  928. // "id": "discovery.apis.getRest",
  929. // "parameterOrder": [
  930. // "api",
  931. // "version"
  932. // ],
  933. // "parameters": {
  934. // "api": {
  935. // "description": "The name of the API.",
  936. // "location": "path",
  937. // "required": true,
  938. // "type": "string"
  939. // },
  940. // "version": {
  941. // "description": "The version of the API.",
  942. // "location": "path",
  943. // "required": true,
  944. // "type": "string"
  945. // }
  946. // },
  947. // "path": "apis/{api}/{version}/rest",
  948. // "response": {
  949. // "$ref": "RestDescription"
  950. // }
  951. // }
  952. }
  953. // method id "discovery.apis.list":
  954. type ApisListCall struct {
  955. s *Service
  956. urlParams_ gensupport.URLParams
  957. ifNoneMatch_ string
  958. ctx_ context.Context
  959. header_ http.Header
  960. }
  961. // List: Retrieve the list of APIs supported at this endpoint.
  962. func (r *ApisService) List() *ApisListCall {
  963. c := &ApisListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  964. return c
  965. }
  966. // Name sets the optional parameter "name": Only include APIs with the
  967. // given name.
  968. func (c *ApisListCall) Name(name string) *ApisListCall {
  969. c.urlParams_.Set("name", name)
  970. return c
  971. }
  972. // Preferred sets the optional parameter "preferred": Return only the
  973. // preferred version of an API.
  974. func (c *ApisListCall) Preferred(preferred bool) *ApisListCall {
  975. c.urlParams_.Set("preferred", fmt.Sprint(preferred))
  976. return c
  977. }
  978. // Fields allows partial responses to be retrieved. See
  979. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  980. // for more information.
  981. func (c *ApisListCall) Fields(s ...googleapi.Field) *ApisListCall {
  982. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  983. return c
  984. }
  985. // IfNoneMatch sets the optional parameter which makes the operation
  986. // fail if the object's ETag matches the given value. This is useful for
  987. // getting updates only after the object has changed since the last
  988. // request. Use googleapi.IsNotModified to check whether the response
  989. // error from Do is the result of In-None-Match.
  990. func (c *ApisListCall) IfNoneMatch(entityTag string) *ApisListCall {
  991. c.ifNoneMatch_ = entityTag
  992. return c
  993. }
  994. // Context sets the context to be used in this call's Do method. Any
  995. // pending HTTP request will be aborted if the provided context is
  996. // canceled.
  997. func (c *ApisListCall) Context(ctx context.Context) *ApisListCall {
  998. c.ctx_ = ctx
  999. return c
  1000. }
  1001. // Header returns an http.Header that can be modified by the caller to
  1002. // add HTTP headers to the request.
  1003. func (c *ApisListCall) Header() http.Header {
  1004. if c.header_ == nil {
  1005. c.header_ = make(http.Header)
  1006. }
  1007. return c.header_
  1008. }
  1009. func (c *ApisListCall) doRequest(alt string) (*http.Response, error) {
  1010. reqHeaders := make(http.Header)
  1011. for k, v := range c.header_ {
  1012. reqHeaders[k] = v
  1013. }
  1014. reqHeaders.Set("User-Agent", c.s.userAgent())
  1015. if c.ifNoneMatch_ != "" {
  1016. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1017. }
  1018. var body io.Reader = nil
  1019. c.urlParams_.Set("alt", alt)
  1020. c.urlParams_.Set("prettyPrint", "false")
  1021. urls := googleapi.ResolveRelative(c.s.BasePath, "apis")
  1022. urls += "?" + c.urlParams_.Encode()
  1023. req, err := http.NewRequest("GET", urls, body)
  1024. if err != nil {
  1025. return nil, err
  1026. }
  1027. req.Header = reqHeaders
  1028. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1029. }
  1030. // Do executes the "discovery.apis.list" call.
  1031. // Exactly one of *DirectoryList or error will be non-nil. Any non-2xx
  1032. // status code is an error. Response headers are in either
  1033. // *DirectoryList.ServerResponse.Header or (if a response was returned
  1034. // at all) in error.(*googleapi.Error).Header. Use
  1035. // googleapi.IsNotModified to check whether the returned error was
  1036. // because http.StatusNotModified was returned.
  1037. func (c *ApisListCall) Do(opts ...googleapi.CallOption) (*DirectoryList, error) {
  1038. gensupport.SetOptions(c.urlParams_, opts...)
  1039. res, err := c.doRequest("json")
  1040. if res != nil && res.StatusCode == http.StatusNotModified {
  1041. if res.Body != nil {
  1042. res.Body.Close()
  1043. }
  1044. return nil, &googleapi.Error{
  1045. Code: res.StatusCode,
  1046. Header: res.Header,
  1047. }
  1048. }
  1049. if err != nil {
  1050. return nil, err
  1051. }
  1052. defer googleapi.CloseBody(res)
  1053. if err := googleapi.CheckResponse(res); err != nil {
  1054. return nil, err
  1055. }
  1056. ret := &DirectoryList{
  1057. ServerResponse: googleapi.ServerResponse{
  1058. Header: res.Header,
  1059. HTTPStatusCode: res.StatusCode,
  1060. },
  1061. }
  1062. target := &ret
  1063. if err := gensupport.DecodeResponse(target, res); err != nil {
  1064. return nil, err
  1065. }
  1066. return ret, nil
  1067. // {
  1068. // "description": "Retrieve the list of APIs supported at this endpoint.",
  1069. // "httpMethod": "GET",
  1070. // "id": "discovery.apis.list",
  1071. // "parameters": {
  1072. // "name": {
  1073. // "description": "Only include APIs with the given name.",
  1074. // "location": "query",
  1075. // "type": "string"
  1076. // },
  1077. // "preferred": {
  1078. // "default": "false",
  1079. // "description": "Return only the preferred version of an API.",
  1080. // "location": "query",
  1081. // "type": "boolean"
  1082. // }
  1083. // },
  1084. // "path": "apis",
  1085. // "response": {
  1086. // "$ref": "DirectoryList"
  1087. // }
  1088. // }
  1089. }