discovery-gen.go 36 KB

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