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.
 
 
 

1911 lines
68 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 poly provides access to the Poly API.
  6. //
  7. // For product documentation, see: https://developers.google.com/poly/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/poly/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // polyService, err := poly.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. // polyService, err := poly.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. // polyService, err := poly.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 poly // import "google.golang.org/api/poly/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 = "poly:v1"
  67. const apiName = "poly"
  68. const apiVersion = "v1"
  69. const basePath = "https://poly.googleapis.com/"
  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.Assets = NewAssetsService(s)
  96. s.Users = NewUsersService(s)
  97. return s, nil
  98. }
  99. type Service struct {
  100. client *http.Client
  101. BasePath string // API endpoint base URL
  102. UserAgent string // optional additional User-Agent fragment
  103. Assets *AssetsService
  104. Users *UsersService
  105. }
  106. func (s *Service) userAgent() string {
  107. if s.UserAgent == "" {
  108. return googleapi.UserAgent
  109. }
  110. return googleapi.UserAgent + " " + s.UserAgent
  111. }
  112. func NewAssetsService(s *Service) *AssetsService {
  113. rs := &AssetsService{s: s}
  114. return rs
  115. }
  116. type AssetsService struct {
  117. s *Service
  118. }
  119. func NewUsersService(s *Service) *UsersService {
  120. rs := &UsersService{s: s}
  121. rs.Assets = NewUsersAssetsService(s)
  122. rs.Likedassets = NewUsersLikedassetsService(s)
  123. return rs
  124. }
  125. type UsersService struct {
  126. s *Service
  127. Assets *UsersAssetsService
  128. Likedassets *UsersLikedassetsService
  129. }
  130. func NewUsersAssetsService(s *Service) *UsersAssetsService {
  131. rs := &UsersAssetsService{s: s}
  132. return rs
  133. }
  134. type UsersAssetsService struct {
  135. s *Service
  136. }
  137. func NewUsersLikedassetsService(s *Service) *UsersLikedassetsService {
  138. rs := &UsersLikedassetsService{s: s}
  139. return rs
  140. }
  141. type UsersLikedassetsService struct {
  142. s *Service
  143. }
  144. // Asset: Represents and describes an asset in the Poly library. An
  145. // asset is a 3D model
  146. // or scene created using [Tilt
  147. // Brush](//www.tiltbrush.com),
  148. // [Blocks](//vr.google.com/blocks/), or any 3D program that produces a
  149. // file
  150. // that can be upload to Poly.
  151. type Asset struct {
  152. // AuthorName: The author's publicly visible name. Use this name when
  153. // giving credit to the
  154. // author. For more information, see
  155. // [Licensing](/poly/discover/licensing).
  156. AuthorName string `json:"authorName,omitempty"`
  157. // CreateTime: For published assets, the time when the asset was
  158. // published.
  159. // For unpublished assets, the time when the asset was created.
  160. CreateTime string `json:"createTime,omitempty"`
  161. // Description: The human-readable description, set by the asset's
  162. // author.
  163. Description string `json:"description,omitempty"`
  164. // DisplayName: The human-readable name, set by the asset's author.
  165. DisplayName string `json:"displayName,omitempty"`
  166. // Formats: A list of Formats where each
  167. // format describes one representation of the asset.
  168. Formats []*Format `json:"formats,omitempty"`
  169. // IsCurated: Whether this asset has been curated by the Poly team.
  170. IsCurated bool `json:"isCurated,omitempty"`
  171. // License: The license under which the author has made the asset
  172. // available
  173. // for use, if any.
  174. //
  175. // Possible values:
  176. // "UNKNOWN" - Unknown license value.
  177. // "CREATIVE_COMMONS_BY" - Creative Commons CC-BY 3.0.
  178. // https://creativecommons.org/licenses/by/3.0/
  179. // "ALL_RIGHTS_RESERVED" - Unlicensed: All Rights Reserved by the
  180. // author. Unlicensed assets are
  181. // **not** returned by List Assets.
  182. License string `json:"license,omitempty"`
  183. // Metadata: Application-defined opaque metadata for this asset. This
  184. // field is only
  185. // returned when querying for the signed-in user's own assets, not for
  186. // public
  187. // assets. This string is limited to 1K chars. It is up to the creator
  188. // of
  189. // the asset to define the format for this string (for example, JSON).
  190. Metadata string `json:"metadata,omitempty"`
  191. // Name: The unique identifier for the asset in the
  192. // form:
  193. // `assets/{ASSET_ID}`.
  194. Name string `json:"name,omitempty"`
  195. // PresentationParams: Hints for displaying the asset. Note that these
  196. // parameters are not
  197. // immutable; the author of an asset may change them post-publication.
  198. PresentationParams *PresentationParams `json:"presentationParams,omitempty"`
  199. // RemixInfo: The remix info for the asset.
  200. RemixInfo *RemixInfo `json:"remixInfo,omitempty"`
  201. // Thumbnail: The thumbnail image for the asset.
  202. Thumbnail *File `json:"thumbnail,omitempty"`
  203. // UpdateTime: The time when the asset was last modified. For published
  204. // assets, whose
  205. // contents are immutable, the update time changes only when
  206. // metadata
  207. // properties, such as visibility, are updated.
  208. UpdateTime string `json:"updateTime,omitempty"`
  209. // Visibility: The visibility of the asset and who can access it.
  210. //
  211. // Possible values:
  212. // "VISIBILITY_UNSPECIFIED" - Unknown (and invalid) visibility.
  213. // "PRIVATE" - Access to the asset and its underlying files and
  214. // resources is restricted to
  215. // the author.
  216. // **Authentication:** You must supply an OAuth token that corresponds
  217. // to the
  218. // author's account.
  219. // "UNLISTED" - Access to the asset and its underlying files and
  220. // resources is available to
  221. // anyone with the asset's name. Unlisted assets are **not**
  222. // returned by List Assets.
  223. // "PUBLIC" - Access to the asset and its underlying files and
  224. // resources is available
  225. // to anyone.
  226. Visibility string `json:"visibility,omitempty"`
  227. // ServerResponse contains the HTTP response code and headers from the
  228. // server.
  229. googleapi.ServerResponse `json:"-"`
  230. // ForceSendFields is a list of field names (e.g. "AuthorName") to
  231. // unconditionally include in API requests. By default, fields with
  232. // empty values are omitted from API requests. However, any non-pointer,
  233. // non-interface field appearing in ForceSendFields will be sent to the
  234. // server regardless of whether the field is empty or not. This may be
  235. // used to include empty fields in Patch requests.
  236. ForceSendFields []string `json:"-"`
  237. // NullFields is a list of field names (e.g. "AuthorName") to include in
  238. // API requests with the JSON null value. By default, fields with empty
  239. // values are omitted from API requests. However, any field with an
  240. // empty value appearing in NullFields will be sent to the server as
  241. // null. It is an error if a field in this list has a non-empty value.
  242. // This may be used to include null fields in Patch requests.
  243. NullFields []string `json:"-"`
  244. }
  245. func (s *Asset) MarshalJSON() ([]byte, error) {
  246. type NoMethod Asset
  247. raw := NoMethod(*s)
  248. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  249. }
  250. // AssetImportMessage: A message generated by the asset import process.
  251. type AssetImportMessage struct {
  252. // Code: The code associated with this message.
  253. //
  254. // Possible values:
  255. // "CODE_UNSPECIFIED" - Unknown error code.
  256. // "NO_IMPORTABLE_FILE" - The asset import did not include any file
  257. // that we can import (i.e. an OBJ
  258. // file).
  259. // "EMPTY_MODEL" - When generating the preview for the import, no
  260. // geometry was found.
  261. // "OBJ_PARSE_ERROR" - A problem was encountered while parsing the OBJ
  262. // file. The converter makes
  263. // a 'best effort' attempt to continue when encountering such issues.
  264. // In
  265. // some cases the resulting preview model may still be acceptable.
  266. // The
  267. // details can be found in the parse error message.
  268. // "EXPIRED" - The importer was not able to import the model before
  269. // the expiration time.
  270. // "IMAGE_ERROR" - The importer encountered a problem reading an image
  271. // file.
  272. // "EXTRA_FILES_WITH_ARCHIVE" - Multiple files were encountered in
  273. // addition to a ZIP archive. When
  274. // uploading an archive only one file is permitted.
  275. // "DEFAULT_MATERIALS" - Default materials are used in the model. This
  276. // means that one or more
  277. // faces is using default materials either because no usemtl statement
  278. // was
  279. // specified or because the requested material was not found due to
  280. // a
  281. // missing material file or bad material name. This does not cover the
  282. // case
  283. // of missing textures.
  284. // "FATAL_ERROR" - The importer encountered a fatal error and was
  285. // unable to import the
  286. // model.
  287. // "INVALID_ELEMENT_TYPE" - The import includes a file of an
  288. // unsupported element type. The file path
  289. // is specified.
  290. Code string `json:"code,omitempty"`
  291. // FilePath: An optional file path. Only present for those error codes
  292. // that specify it.
  293. FilePath string `json:"filePath,omitempty"`
  294. // ImageError: An optional image error. Only present for
  295. // INVALID_IMAGE_FILE.
  296. ImageError *ImageError `json:"imageError,omitempty"`
  297. // ObjParseError: An optional OBJ parse error. Only present for
  298. // OBJ_PARSE_ERROR.
  299. ObjParseError *ObjParseError `json:"objParseError,omitempty"`
  300. // ForceSendFields is a list of field names (e.g. "Code") to
  301. // unconditionally include in API requests. By default, fields with
  302. // empty values are omitted from API requests. However, any non-pointer,
  303. // non-interface field appearing in ForceSendFields will be sent to the
  304. // server regardless of whether the field is empty or not. This may be
  305. // used to include empty fields in Patch requests.
  306. ForceSendFields []string `json:"-"`
  307. // NullFields is a list of field names (e.g. "Code") to include in API
  308. // requests with the JSON null value. By default, fields with empty
  309. // values are omitted from API requests. However, any field with an
  310. // empty value appearing in NullFields will be sent to the server as
  311. // null. It is an error if a field in this list has a non-empty value.
  312. // This may be used to include null fields in Patch requests.
  313. NullFields []string `json:"-"`
  314. }
  315. func (s *AssetImportMessage) MarshalJSON() ([]byte, error) {
  316. type NoMethod AssetImportMessage
  317. raw := NoMethod(*s)
  318. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  319. }
  320. // File: Represents a file in Poly, which can be a root,
  321. // resource, or thumbnail file.
  322. type File struct {
  323. // ContentType: The MIME content-type, such as `image/png`.
  324. // For more information,
  325. // see
  326. // [MIME
  327. // types](//developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of
  328. // _HTTP/MIME_types).
  329. ContentType string `json:"contentType,omitempty"`
  330. // RelativePath: The path of the resource file relative to the
  331. // root file. For root or thumbnail files,
  332. // this is just the filename.
  333. RelativePath string `json:"relativePath,omitempty"`
  334. // Url: The URL where the file data can be retrieved.
  335. Url string `json:"url,omitempty"`
  336. // ForceSendFields is a list of field names (e.g. "ContentType") to
  337. // unconditionally include in API requests. By default, fields with
  338. // empty values are omitted from API requests. However, any non-pointer,
  339. // non-interface field appearing in ForceSendFields will be sent to the
  340. // server regardless of whether the field is empty or not. This may be
  341. // used to include empty fields in Patch requests.
  342. ForceSendFields []string `json:"-"`
  343. // NullFields is a list of field names (e.g. "ContentType") to include
  344. // in API requests with the JSON null value. By default, fields with
  345. // empty values are omitted from API requests. However, any field with
  346. // an empty value appearing in NullFields will be sent to the server as
  347. // null. It is an error if a field in this list has a non-empty value.
  348. // This may be used to include null fields in Patch requests.
  349. NullFields []string `json:"-"`
  350. }
  351. func (s *File) MarshalJSON() ([]byte, error) {
  352. type NoMethod File
  353. raw := NoMethod(*s)
  354. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  355. }
  356. // Format: The same asset can be represented in different formats, for
  357. // example,
  358. // a [WaveFront .obj](//en.wikipedia.org/wiki/Wavefront_.obj_file) file
  359. // with its
  360. // corresponding .mtl file or a [Khronos glTF](//www.khronos.org/gltf)
  361. // file
  362. // with its corresponding .glb binary data. A format refers to a
  363. // specific
  364. // representation of an asset and contains all information needed
  365. // to
  366. // retrieve and describe this representation.
  367. type Format struct {
  368. // FormatComplexity: Complexity stats about this representation of the
  369. // asset.
  370. FormatComplexity *FormatComplexity `json:"formatComplexity,omitempty"`
  371. // FormatType: A short string that identifies the format type of this
  372. // representation.
  373. // Possible values are: `FBX`, `GLTF`, `GLTF2`, `OBJ`, and `TILT`.
  374. FormatType string `json:"formatType,omitempty"`
  375. // Resources: A list of dependencies of the root element. May include,
  376. // but is not
  377. // limited to, materials, textures, and shader programs.
  378. Resources []*File `json:"resources,omitempty"`
  379. // Root: The root of the file hierarchy. This will always be
  380. // populated.
  381. // For some format_types - such as `TILT`, which are
  382. // self-contained - this is all of the data.
  383. //
  384. // Other types - such as `OBJ` - often reference other data
  385. // elements.
  386. // These are contained in the resources field.
  387. Root *File `json:"root,omitempty"`
  388. // ForceSendFields is a list of field names (e.g. "FormatComplexity") to
  389. // unconditionally include in API requests. By default, fields with
  390. // empty values are omitted from API requests. However, any non-pointer,
  391. // non-interface field appearing in ForceSendFields will be sent to the
  392. // server regardless of whether the field is empty or not. This may be
  393. // used to include empty fields in Patch requests.
  394. ForceSendFields []string `json:"-"`
  395. // NullFields is a list of field names (e.g. "FormatComplexity") to
  396. // include in API requests with the JSON null value. By default, fields
  397. // with empty values are omitted from API requests. However, any field
  398. // with an empty value appearing in NullFields will be sent to the
  399. // server as null. It is an error if a field in this list has a
  400. // non-empty value. This may be used to include null fields in Patch
  401. // requests.
  402. NullFields []string `json:"-"`
  403. }
  404. func (s *Format) MarshalJSON() ([]byte, error) {
  405. type NoMethod Format
  406. raw := NoMethod(*s)
  407. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  408. }
  409. // FormatComplexity: Information on the complexity of this Format.
  410. type FormatComplexity struct {
  411. // LodHint: A non-negative integer that represents the level of detail
  412. // (LOD) of this
  413. // format relative to other formats of the same asset with the
  414. // same
  415. // format_type.
  416. // This hint allows you to sort formats from the most-detailed (0)
  417. // to
  418. // least-detailed (integers greater than 0).
  419. LodHint int64 `json:"lodHint,omitempty"`
  420. // TriangleCount: The estimated number of triangles.
  421. TriangleCount int64 `json:"triangleCount,omitempty,string"`
  422. // ForceSendFields is a list of field names (e.g. "LodHint") to
  423. // unconditionally include in API requests. By default, fields with
  424. // empty values are omitted from API requests. However, any non-pointer,
  425. // non-interface field appearing in ForceSendFields will be sent to the
  426. // server regardless of whether the field is empty or not. This may be
  427. // used to include empty fields in Patch requests.
  428. ForceSendFields []string `json:"-"`
  429. // NullFields is a list of field names (e.g. "LodHint") to include in
  430. // API requests with the JSON null value. By default, fields with empty
  431. // values are omitted from API requests. However, any field with an
  432. // empty value appearing in NullFields will be sent to the server as
  433. // null. It is an error if a field in this list has a non-empty value.
  434. // This may be used to include null fields in Patch requests.
  435. NullFields []string `json:"-"`
  436. }
  437. func (s *FormatComplexity) MarshalJSON() ([]byte, error) {
  438. type NoMethod FormatComplexity
  439. raw := NoMethod(*s)
  440. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  441. }
  442. // ImageError: A message resulting from reading an image file.
  443. type ImageError struct {
  444. // Code: The type of image error encountered. Optional for older image
  445. // errors.
  446. //
  447. // Possible values:
  448. // "CODE_UNSPECIFIED" - Unknown error code.
  449. // "INVALID_IMAGE" - We were unable to read the image file.
  450. // "IMAGE_TOO_BIG" - The image size is too large.
  451. // "WRONG_IMAGE_TYPE" - The image data does not match the expected
  452. // MIME type of the image.
  453. Code string `json:"code,omitempty"`
  454. // FilePath: The file path in the import of the image that was rejected.
  455. FilePath string `json:"filePath,omitempty"`
  456. // ForceSendFields is a list of field names (e.g. "Code") to
  457. // unconditionally include in API requests. By default, fields with
  458. // empty values are omitted from API requests. However, any non-pointer,
  459. // non-interface field appearing in ForceSendFields will be sent to the
  460. // server regardless of whether the field is empty or not. This may be
  461. // used to include empty fields in Patch requests.
  462. ForceSendFields []string `json:"-"`
  463. // NullFields is a list of field names (e.g. "Code") to include in API
  464. // requests with the JSON null value. By default, fields with empty
  465. // values are omitted from API requests. However, any field with an
  466. // empty value appearing in NullFields will be sent to the server as
  467. // null. It is an error if a field in this list has a non-empty value.
  468. // This may be used to include null fields in Patch requests.
  469. NullFields []string `json:"-"`
  470. }
  471. func (s *ImageError) MarshalJSON() ([]byte, error) {
  472. type NoMethod ImageError
  473. raw := NoMethod(*s)
  474. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  475. }
  476. // ListAssetsResponse: A response message from a request to list.
  477. type ListAssetsResponse struct {
  478. // Assets: A list of assets that match the criteria specified in the
  479. // request.
  480. Assets []*Asset `json:"assets,omitempty"`
  481. // NextPageToken: The continuation token for retrieving the next page.
  482. // If empty,
  483. // indicates that there are no more pages. To get the next page, submit
  484. // the
  485. // same request specifying this value as the
  486. // page_token.
  487. NextPageToken string `json:"nextPageToken,omitempty"`
  488. // TotalSize: The total number of assets in the list, without
  489. // pagination.
  490. TotalSize int64 `json:"totalSize,omitempty"`
  491. // ServerResponse contains the HTTP response code and headers from the
  492. // server.
  493. googleapi.ServerResponse `json:"-"`
  494. // ForceSendFields is a list of field names (e.g. "Assets") to
  495. // unconditionally include in API requests. By default, fields with
  496. // empty values are omitted from API requests. However, any non-pointer,
  497. // non-interface field appearing in ForceSendFields will be sent to the
  498. // server regardless of whether the field is empty or not. This may be
  499. // used to include empty fields in Patch requests.
  500. ForceSendFields []string `json:"-"`
  501. // NullFields is a list of field names (e.g. "Assets") to include in API
  502. // requests with the JSON null value. By default, fields with empty
  503. // values are omitted from API requests. However, any field with an
  504. // empty value appearing in NullFields will be sent to the server as
  505. // null. It is an error if a field in this list has a non-empty value.
  506. // This may be used to include null fields in Patch requests.
  507. NullFields []string `json:"-"`
  508. }
  509. func (s *ListAssetsResponse) MarshalJSON() ([]byte, error) {
  510. type NoMethod ListAssetsResponse
  511. raw := NoMethod(*s)
  512. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  513. }
  514. // ListLikedAssetsResponse: A response message from a request to list.
  515. type ListLikedAssetsResponse struct {
  516. // Assets: A list of assets that match the criteria specified in the
  517. // request.
  518. Assets []*Asset `json:"assets,omitempty"`
  519. // NextPageToken: The continuation token for retrieving the next page.
  520. // If empty,
  521. // indicates that there are no more pages. To get the next page, submit
  522. // the
  523. // same request specifying this value as the
  524. // page_token.
  525. NextPageToken string `json:"nextPageToken,omitempty"`
  526. // TotalSize: The total number of assets in the list, without
  527. // pagination.
  528. TotalSize int64 `json:"totalSize,omitempty"`
  529. // ServerResponse contains the HTTP response code and headers from the
  530. // server.
  531. googleapi.ServerResponse `json:"-"`
  532. // ForceSendFields is a list of field names (e.g. "Assets") to
  533. // unconditionally include in API requests. By default, fields with
  534. // empty values are omitted from API requests. However, any non-pointer,
  535. // non-interface field appearing in ForceSendFields will be sent to the
  536. // server regardless of whether the field is empty or not. This may be
  537. // used to include empty fields in Patch requests.
  538. ForceSendFields []string `json:"-"`
  539. // NullFields is a list of field names (e.g. "Assets") to include in API
  540. // requests with the JSON null value. By default, fields with empty
  541. // values are omitted from API requests. However, any field with an
  542. // empty value appearing in NullFields will be sent to the server as
  543. // null. It is an error if a field in this list has a non-empty value.
  544. // This may be used to include null fields in Patch requests.
  545. NullFields []string `json:"-"`
  546. }
  547. func (s *ListLikedAssetsResponse) MarshalJSON() ([]byte, error) {
  548. type NoMethod ListLikedAssetsResponse
  549. raw := NoMethod(*s)
  550. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  551. }
  552. // ListUserAssetsResponse: A response message from a request to list.
  553. type ListUserAssetsResponse struct {
  554. // NextPageToken: The continuation token for retrieving the next page.
  555. // If empty,
  556. // indicates that there are no more pages. To get the next page, submit
  557. // the
  558. // same request specifying this value as the
  559. // page_token.
  560. NextPageToken string `json:"nextPageToken,omitempty"`
  561. // TotalSize: The total number of assets in the list, without
  562. // pagination.
  563. TotalSize int64 `json:"totalSize,omitempty"`
  564. // UserAssets: A list of UserAssets matching the request.
  565. UserAssets []*UserAsset `json:"userAssets,omitempty"`
  566. // ServerResponse contains the HTTP response code and headers from the
  567. // server.
  568. googleapi.ServerResponse `json:"-"`
  569. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  570. // unconditionally include in API requests. By default, fields with
  571. // empty values are omitted from API requests. However, any non-pointer,
  572. // non-interface field appearing in ForceSendFields will be sent to the
  573. // server regardless of whether the field is empty or not. This may be
  574. // used to include empty fields in Patch requests.
  575. ForceSendFields []string `json:"-"`
  576. // NullFields is a list of field names (e.g. "NextPageToken") to include
  577. // in API requests with the JSON null value. By default, fields with
  578. // empty values are omitted from API requests. However, any field with
  579. // an empty value appearing in NullFields will be sent to the server as
  580. // null. It is an error if a field in this list has a non-empty value.
  581. // This may be used to include null fields in Patch requests.
  582. NullFields []string `json:"-"`
  583. }
  584. func (s *ListUserAssetsResponse) MarshalJSON() ([]byte, error) {
  585. type NoMethod ListUserAssetsResponse
  586. raw := NoMethod(*s)
  587. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  588. }
  589. // ObjParseError: Details of an error resulting from parsing an OBJ file
  590. type ObjParseError struct {
  591. // Code: The type of problem found (required).
  592. //
  593. // Possible values:
  594. // "CODE_UNSPECIFIED" - Unknown error code.
  595. // "INCONSISTENT_VERTEX_REFS" - Vertex references are specified in an
  596. // inconsistent style for a face (e.g.
  597. // some vertices specify texture vertices but some don't).
  598. // "INVALID_COMMAND" - The command is invalid.
  599. // "INVALID_NUMBER" - A invalid number was specified.
  600. // "INVALID_VERTEX_REF" - An invalid vertex reference was specified.
  601. // "MISSING_GEOMETRIC_VERTEX" - A vertex reference does not specify a
  602. // geometric vertex.
  603. // "MISSING_TOKEN" - An expected token was not found.
  604. // "TOO_FEW_DIMENSIONS" - The vertex specified too few dimensions for
  605. // its usage.
  606. // "TOO_FEW_VERTICES" - The face specified too few vertices.
  607. // "TOO_MANY_DIMENSIONS" - The vertex specified too many dimensions
  608. // for its usage.
  609. // "UNSUPPORTED_COMMAND" - This command is a valid OBJ command but is
  610. // not supported. This error is
  611. // only generated for the first instance of such a command.
  612. // "UNUSED_TOKENS" - This line ended with unparsed token characters.
  613. // "VERTEX_NOT_FOUND" - The specified vertex was not found.
  614. // "NUMBER_OUT_OF_RANGE" - The specified number was too large or small
  615. // for its usage.
  616. // "INVALID_VALUE" - The specified parameter value was not recognized.
  617. // "INVALID_TEXTURE_OPTION" - The specified texture option is not
  618. // valid.
  619. // "TOO_MANY_PROBLEMS" - The maximum number of problems to report was
  620. // reached. Parsing continues,
  621. // but further problems will be ignored.
  622. // "MISSING_FILE_NAME" - An expected file name was not specified.
  623. // "FILE_NOT_FOUND" - The specified file was not found in the import.
  624. // "UNKNOWN_MATERIAL" - The specified material was not found in any
  625. // material definition in the
  626. // import.
  627. // "NO_MATERIAL_DEFINED" - Material parameters were specified before
  628. // the first material definition.
  629. // "INVALID_SMOOTHING_GROUP" - The smoothing group is not valid.
  630. // "MISSING_VERTEX_COLORS" - Vertex colors were specified for only
  631. // some vertices of a face.
  632. // "FILE_SUBSTITUTION" - A missing file was found at a different file
  633. // path.
  634. // "LINE_TOO_LONG" - A line in an OBJ or MTL file exceeded the maximum
  635. // line length.
  636. // "INVALID_FILE_PATH" - The file path was invalid. Only relative
  637. // paths are supported.
  638. Code string `json:"code,omitempty"`
  639. // EndIndex: The ending character index at which the problem was found.
  640. EndIndex int64 `json:"endIndex,omitempty"`
  641. // FilePath: The file path in which the problem was found.
  642. FilePath string `json:"filePath,omitempty"`
  643. // Line: The text of the line. Note that this may be truncated if the
  644. // line was very
  645. // long. This may not include the error if it occurs after line
  646. // truncation.
  647. Line string `json:"line,omitempty"`
  648. // LineNumber: Line number at which the problem was found.
  649. LineNumber int64 `json:"lineNumber,omitempty"`
  650. // StartIndex: The starting character index at which the problem was
  651. // found.
  652. StartIndex int64 `json:"startIndex,omitempty"`
  653. // ForceSendFields is a list of field names (e.g. "Code") to
  654. // unconditionally include in API requests. By default, fields with
  655. // empty values are omitted from API requests. However, any non-pointer,
  656. // non-interface field appearing in ForceSendFields will be sent to the
  657. // server regardless of whether the field is empty or not. This may be
  658. // used to include empty fields in Patch requests.
  659. ForceSendFields []string `json:"-"`
  660. // NullFields is a list of field names (e.g. "Code") to include in API
  661. // requests with the JSON null value. By default, fields with empty
  662. // values are omitted from API requests. However, any field with an
  663. // empty value appearing in NullFields will be sent to the server as
  664. // null. It is an error if a field in this list has a non-empty value.
  665. // This may be used to include null fields in Patch requests.
  666. NullFields []string `json:"-"`
  667. }
  668. func (s *ObjParseError) MarshalJSON() ([]byte, error) {
  669. type NoMethod ObjParseError
  670. raw := NoMethod(*s)
  671. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  672. }
  673. // PresentationParams: Hints for displaying the asset, based on
  674. // information available when the asset
  675. // was uploaded.
  676. type PresentationParams struct {
  677. // BackgroundColor: A background color which could be used for
  678. // displaying the 3D asset in a
  679. // 'thumbnail' or 'palette' style view. Authors have the option to set
  680. // this
  681. // background color when publishing or editing their asset.
  682. //
  683. // This is represented as a six-digit hexademical triplet specifying
  684. // the
  685. // RGB components of the background color, e.g. #FF0000 for Red.
  686. BackgroundColor string `json:"backgroundColor,omitempty"`
  687. // ColorSpace: The materials' diffuse/albedo color. This does not apply
  688. // to vertex colors
  689. // or texture maps.
  690. //
  691. // Possible values:
  692. // "UNKNOWN" - Invalid color value.
  693. // "LINEAR" - Linear color values. Default.
  694. // "GAMMA" - Colors should be converted to linear by assuming gamma =
  695. // 2.0.
  696. ColorSpace string `json:"colorSpace,omitempty"`
  697. // OrientingRotation: A rotation that should be applied to the object
  698. // root to make it upright.
  699. // More precisely, this quaternion transforms from "object space" (the
  700. // space
  701. // in which the object is defined) to "presentation space", a
  702. // coordinate
  703. // system where +Y is up, +X is right, -Z is forward. For example,
  704. // if
  705. // the object is the Eiffel Tower, in its local coordinate system
  706. // the
  707. // object might be laid out such that the base of the tower is on the
  708. // YZ plane and the tip of the tower is towards positive X. In this
  709. // case
  710. // this quaternion would specify a rotation (of 90 degrees about the
  711. // Z
  712. // axis) such that in the presentation space the base of the tower
  713. // is
  714. // aligned with the XZ plane, and the tip of the tower lies towards
  715. // +Y.
  716. //
  717. // This rotation is unrelated to the object's pose in the web
  718. // preview,
  719. // which is just a camera position setting and is *not* reflected in
  720. // this
  721. // rotation.
  722. //
  723. // Please note: this is applicable only to the gLTF.
  724. OrientingRotation *Quaternion `json:"orientingRotation,omitempty"`
  725. // ForceSendFields is a list of field names (e.g. "BackgroundColor") to
  726. // unconditionally include in API requests. By default, fields with
  727. // empty values are omitted from API requests. However, any non-pointer,
  728. // non-interface field appearing in ForceSendFields will be sent to the
  729. // server regardless of whether the field is empty or not. This may be
  730. // used to include empty fields in Patch requests.
  731. ForceSendFields []string `json:"-"`
  732. // NullFields is a list of field names (e.g. "BackgroundColor") to
  733. // include in API requests with the JSON null value. By default, fields
  734. // with empty values are omitted from API requests. However, any field
  735. // with an empty value appearing in NullFields will be sent to the
  736. // server as null. It is an error if a field in this list has a
  737. // non-empty value. This may be used to include null fields in Patch
  738. // requests.
  739. NullFields []string `json:"-"`
  740. }
  741. func (s *PresentationParams) MarshalJSON() ([]byte, error) {
  742. type NoMethod PresentationParams
  743. raw := NoMethod(*s)
  744. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  745. }
  746. // Quaternion: A [Quaternion](//en.wikipedia.org/wiki/Quaternion).
  747. // Please note: if in the
  748. // response you see "w: 1" and nothing else this is the default value
  749. // of
  750. // [0, 0, 0, 1] where x,y, and z are 0.
  751. type Quaternion struct {
  752. // W: The scalar component.
  753. W float64 `json:"w,omitempty"`
  754. // X: The x component.
  755. X float64 `json:"x,omitempty"`
  756. // Y: The y component.
  757. Y float64 `json:"y,omitempty"`
  758. // Z: The z component.
  759. Z float64 `json:"z,omitempty"`
  760. // ForceSendFields is a list of field names (e.g. "W") to
  761. // unconditionally include in API requests. By default, fields with
  762. // empty values are omitted from API requests. However, any non-pointer,
  763. // non-interface field appearing in ForceSendFields will be sent to the
  764. // server regardless of whether the field is empty or not. This may be
  765. // used to include empty fields in Patch requests.
  766. ForceSendFields []string `json:"-"`
  767. // NullFields is a list of field names (e.g. "W") to include in API
  768. // requests with the JSON null value. By default, fields with empty
  769. // values are omitted from API requests. However, any field with an
  770. // empty value appearing in NullFields will be sent to the server as
  771. // null. It is an error if a field in this list has a non-empty value.
  772. // This may be used to include null fields in Patch requests.
  773. NullFields []string `json:"-"`
  774. }
  775. func (s *Quaternion) MarshalJSON() ([]byte, error) {
  776. type NoMethod Quaternion
  777. raw := NoMethod(*s)
  778. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  779. }
  780. func (s *Quaternion) UnmarshalJSON(data []byte) error {
  781. type NoMethod Quaternion
  782. var s1 struct {
  783. W gensupport.JSONFloat64 `json:"w"`
  784. X gensupport.JSONFloat64 `json:"x"`
  785. Y gensupport.JSONFloat64 `json:"y"`
  786. Z gensupport.JSONFloat64 `json:"z"`
  787. *NoMethod
  788. }
  789. s1.NoMethod = (*NoMethod)(s)
  790. if err := json.Unmarshal(data, &s1); err != nil {
  791. return err
  792. }
  793. s.W = float64(s1.W)
  794. s.X = float64(s1.X)
  795. s.Y = float64(s1.Y)
  796. s.Z = float64(s1.Z)
  797. return nil
  798. }
  799. // RemixInfo: Info about the sources of this asset (i.e. assets that
  800. // were remixed to
  801. // create this asset).
  802. type RemixInfo struct {
  803. // SourceAsset: Resource ids for the sources of this remix, of the
  804. // form:
  805. // `assets/{ASSET_ID}`
  806. SourceAsset []string `json:"sourceAsset,omitempty"`
  807. // ForceSendFields is a list of field names (e.g. "SourceAsset") to
  808. // unconditionally include in API requests. By default, fields with
  809. // empty values are omitted from API requests. However, any non-pointer,
  810. // non-interface field appearing in ForceSendFields will be sent to the
  811. // server regardless of whether the field is empty or not. This may be
  812. // used to include empty fields in Patch requests.
  813. ForceSendFields []string `json:"-"`
  814. // NullFields is a list of field names (e.g. "SourceAsset") to include
  815. // in API requests with the JSON null value. By default, fields with
  816. // empty values are omitted from API requests. However, any field with
  817. // an empty value appearing in NullFields will be sent to the server as
  818. // null. It is an error if a field in this list has a non-empty value.
  819. // This may be used to include null fields in Patch requests.
  820. NullFields []string `json:"-"`
  821. }
  822. func (s *RemixInfo) MarshalJSON() ([]byte, error) {
  823. type NoMethod RemixInfo
  824. raw := NoMethod(*s)
  825. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  826. }
  827. // StartAssetImportResponse: A response message from a request to
  828. // startImport.
  829. // This is returned in the response field of the Operation.
  830. type StartAssetImportResponse struct {
  831. // AssetId: The id of newly created asset. If this is empty when the
  832. // operation is
  833. // complete it means the import failed. Please refer to
  834. // the
  835. // assetImportMessages field to understand what went wrong.
  836. AssetId string `json:"assetId,omitempty"`
  837. // AssetImportId: The id of the asset import.
  838. AssetImportId string `json:"assetImportId,omitempty"`
  839. // AssetImportMessages: The message from the asset import. This will
  840. // contain any warnings
  841. // (or - in the case of failure - errors) that occurred during import.
  842. AssetImportMessages []*AssetImportMessage `json:"assetImportMessages,omitempty"`
  843. // PublishUrl: The publish URL for the asset.
  844. PublishUrl string `json:"publishUrl,omitempty"`
  845. // ForceSendFields is a list of field names (e.g. "AssetId") to
  846. // unconditionally include in API requests. By default, fields with
  847. // empty values are omitted from API requests. However, any non-pointer,
  848. // non-interface field appearing in ForceSendFields will be sent to the
  849. // server regardless of whether the field is empty or not. This may be
  850. // used to include empty fields in Patch requests.
  851. ForceSendFields []string `json:"-"`
  852. // NullFields is a list of field names (e.g. "AssetId") to include in
  853. // API requests with the JSON null value. By default, fields with empty
  854. // values are omitted from API requests. However, any field with an
  855. // empty value appearing in NullFields will be sent to the server as
  856. // null. It is an error if a field in this list has a non-empty value.
  857. // This may be used to include null fields in Patch requests.
  858. NullFields []string `json:"-"`
  859. }
  860. func (s *StartAssetImportResponse) MarshalJSON() ([]byte, error) {
  861. type NoMethod StartAssetImportResponse
  862. raw := NoMethod(*s)
  863. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  864. }
  865. // UserAsset: Data about the user's asset.
  866. type UserAsset struct {
  867. // Asset: An Asset.
  868. Asset *Asset `json:"asset,omitempty"`
  869. // ForceSendFields is a list of field names (e.g. "Asset") to
  870. // unconditionally include in API requests. By default, fields with
  871. // empty values are omitted from API requests. However, any non-pointer,
  872. // non-interface field appearing in ForceSendFields will be sent to the
  873. // server regardless of whether the field is empty or not. This may be
  874. // used to include empty fields in Patch requests.
  875. ForceSendFields []string `json:"-"`
  876. // NullFields is a list of field names (e.g. "Asset") to include in API
  877. // requests with the JSON null value. By default, fields with empty
  878. // values are omitted from API requests. However, any field with an
  879. // empty value appearing in NullFields will be sent to the server as
  880. // null. It is an error if a field in this list has a non-empty value.
  881. // This may be used to include null fields in Patch requests.
  882. NullFields []string `json:"-"`
  883. }
  884. func (s *UserAsset) MarshalJSON() ([]byte, error) {
  885. type NoMethod UserAsset
  886. raw := NoMethod(*s)
  887. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  888. }
  889. // method id "poly.assets.get":
  890. type AssetsGetCall struct {
  891. s *Service
  892. name string
  893. urlParams_ gensupport.URLParams
  894. ifNoneMatch_ string
  895. ctx_ context.Context
  896. header_ http.Header
  897. }
  898. // Get: Returns detailed information about an asset given its
  899. // name.
  900. // PRIVATE assets are returned only if
  901. // the currently authenticated user (via OAuth token) is the author of
  902. // the asset.
  903. func (r *AssetsService) Get(name string) *AssetsGetCall {
  904. c := &AssetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  905. c.name = name
  906. return c
  907. }
  908. // Fields allows partial responses to be retrieved. See
  909. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  910. // for more information.
  911. func (c *AssetsGetCall) Fields(s ...googleapi.Field) *AssetsGetCall {
  912. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  913. return c
  914. }
  915. // IfNoneMatch sets the optional parameter which makes the operation
  916. // fail if the object's ETag matches the given value. This is useful for
  917. // getting updates only after the object has changed since the last
  918. // request. Use googleapi.IsNotModified to check whether the response
  919. // error from Do is the result of In-None-Match.
  920. func (c *AssetsGetCall) IfNoneMatch(entityTag string) *AssetsGetCall {
  921. c.ifNoneMatch_ = entityTag
  922. return c
  923. }
  924. // Context sets the context to be used in this call's Do method. Any
  925. // pending HTTP request will be aborted if the provided context is
  926. // canceled.
  927. func (c *AssetsGetCall) Context(ctx context.Context) *AssetsGetCall {
  928. c.ctx_ = ctx
  929. return c
  930. }
  931. // Header returns an http.Header that can be modified by the caller to
  932. // add HTTP headers to the request.
  933. func (c *AssetsGetCall) Header() http.Header {
  934. if c.header_ == nil {
  935. c.header_ = make(http.Header)
  936. }
  937. return c.header_
  938. }
  939. func (c *AssetsGetCall) doRequest(alt string) (*http.Response, error) {
  940. reqHeaders := make(http.Header)
  941. for k, v := range c.header_ {
  942. reqHeaders[k] = v
  943. }
  944. reqHeaders.Set("User-Agent", c.s.userAgent())
  945. if c.ifNoneMatch_ != "" {
  946. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  947. }
  948. var body io.Reader = nil
  949. c.urlParams_.Set("alt", alt)
  950. c.urlParams_.Set("prettyPrint", "false")
  951. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  952. urls += "?" + c.urlParams_.Encode()
  953. req, err := http.NewRequest("GET", urls, body)
  954. if err != nil {
  955. return nil, err
  956. }
  957. req.Header = reqHeaders
  958. googleapi.Expand(req.URL, map[string]string{
  959. "name": c.name,
  960. })
  961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  962. }
  963. // Do executes the "poly.assets.get" call.
  964. // Exactly one of *Asset or error will be non-nil. Any non-2xx status
  965. // code is an error. Response headers are in either
  966. // *Asset.ServerResponse.Header or (if a response was returned at all)
  967. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  968. // check whether the returned error was because http.StatusNotModified
  969. // was returned.
  970. func (c *AssetsGetCall) Do(opts ...googleapi.CallOption) (*Asset, error) {
  971. gensupport.SetOptions(c.urlParams_, opts...)
  972. res, err := c.doRequest("json")
  973. if res != nil && res.StatusCode == http.StatusNotModified {
  974. if res.Body != nil {
  975. res.Body.Close()
  976. }
  977. return nil, &googleapi.Error{
  978. Code: res.StatusCode,
  979. Header: res.Header,
  980. }
  981. }
  982. if err != nil {
  983. return nil, err
  984. }
  985. defer googleapi.CloseBody(res)
  986. if err := googleapi.CheckResponse(res); err != nil {
  987. return nil, err
  988. }
  989. ret := &Asset{
  990. ServerResponse: googleapi.ServerResponse{
  991. Header: res.Header,
  992. HTTPStatusCode: res.StatusCode,
  993. },
  994. }
  995. target := &ret
  996. if err := gensupport.DecodeResponse(target, res); err != nil {
  997. return nil, err
  998. }
  999. return ret, nil
  1000. // {
  1001. // "description": "Returns detailed information about an asset given its name.\nPRIVATE assets are returned only if\n the currently authenticated user (via OAuth token) is the author of the asset.",
  1002. // "flatPath": "v1/assets/{assetsId}",
  1003. // "httpMethod": "GET",
  1004. // "id": "poly.assets.get",
  1005. // "parameterOrder": [
  1006. // "name"
  1007. // ],
  1008. // "parameters": {
  1009. // "name": {
  1010. // "description": "Required. An asset's name in the form `assets/{ASSET_ID}`.",
  1011. // "location": "path",
  1012. // "pattern": "^assets/[^/]+$",
  1013. // "required": true,
  1014. // "type": "string"
  1015. // }
  1016. // },
  1017. // "path": "v1/{+name}",
  1018. // "response": {
  1019. // "$ref": "Asset"
  1020. // }
  1021. // }
  1022. }
  1023. // method id "poly.assets.list":
  1024. type AssetsListCall struct {
  1025. s *Service
  1026. urlParams_ gensupport.URLParams
  1027. ifNoneMatch_ string
  1028. ctx_ context.Context
  1029. header_ http.Header
  1030. }
  1031. // List: Lists all public, remixable assets. These are assets with an
  1032. // access level of
  1033. // PUBLIC and published under the
  1034. // CC-By license.
  1035. func (r *AssetsService) List() *AssetsListCall {
  1036. c := &AssetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1037. return c
  1038. }
  1039. // Category sets the optional parameter "category": Filter assets based
  1040. // on the specified category. Supported values are:
  1041. // `animals`, `architecture`, `art`, `food`, `nature`, `objects`,
  1042. // `people`, `scenes`,
  1043. // `technology`, and `transport`.
  1044. func (c *AssetsListCall) Category(category string) *AssetsListCall {
  1045. c.urlParams_.Set("category", category)
  1046. return c
  1047. }
  1048. // Curated sets the optional parameter "curated": Return only assets
  1049. // that have been curated by the Poly team.
  1050. func (c *AssetsListCall) Curated(curated bool) *AssetsListCall {
  1051. c.urlParams_.Set("curated", fmt.Sprint(curated))
  1052. return c
  1053. }
  1054. // Format sets the optional parameter "format": Return only assets with
  1055. // the matching format. Acceptable values are:
  1056. // `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.
  1057. func (c *AssetsListCall) Format(format string) *AssetsListCall {
  1058. c.urlParams_.Set("format", format)
  1059. return c
  1060. }
  1061. // Keywords sets the optional parameter "keywords": One or more search
  1062. // terms to be matched against all text that Poly has
  1063. // indexed for assets, which includes display_name,
  1064. // description, and tags. Multiple keywords should be
  1065. // separated by spaces.
  1066. func (c *AssetsListCall) Keywords(keywords string) *AssetsListCall {
  1067. c.urlParams_.Set("keywords", keywords)
  1068. return c
  1069. }
  1070. // MaxComplexity sets the optional parameter "maxComplexity": Returns
  1071. // assets that are of the specified complexity or less. Defaults
  1072. // to
  1073. // COMPLEX. For example, a request for
  1074. // MEDIUM assets also includes
  1075. // SIMPLE assets.
  1076. //
  1077. // Possible values:
  1078. // "COMPLEXITY_UNSPECIFIED"
  1079. // "COMPLEX"
  1080. // "MEDIUM"
  1081. // "SIMPLE"
  1082. func (c *AssetsListCall) MaxComplexity(maxComplexity string) *AssetsListCall {
  1083. c.urlParams_.Set("maxComplexity", maxComplexity)
  1084. return c
  1085. }
  1086. // OrderBy sets the optional parameter "orderBy": Specifies an ordering
  1087. // for assets. Acceptable values are:
  1088. // `BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks
  1089. // assets
  1090. // based on a combination of popularity and other features.
  1091. func (c *AssetsListCall) OrderBy(orderBy string) *AssetsListCall {
  1092. c.urlParams_.Set("orderBy", orderBy)
  1093. return c
  1094. }
  1095. // PageSize sets the optional parameter "pageSize": The maximum number
  1096. // of assets to be returned. This value must be between `1`
  1097. // and `100`. Defaults to `20`.
  1098. func (c *AssetsListCall) PageSize(pageSize int64) *AssetsListCall {
  1099. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1100. return c
  1101. }
  1102. // PageToken sets the optional parameter "pageToken": Specifies a
  1103. // continuation token from a previous search whose results were
  1104. // split into multiple pages. To get the next page, submit the same
  1105. // request
  1106. // specifying the value from next_page_token.
  1107. func (c *AssetsListCall) PageToken(pageToken string) *AssetsListCall {
  1108. c.urlParams_.Set("pageToken", pageToken)
  1109. return c
  1110. }
  1111. // Fields allows partial responses to be retrieved. See
  1112. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1113. // for more information.
  1114. func (c *AssetsListCall) Fields(s ...googleapi.Field) *AssetsListCall {
  1115. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1116. return c
  1117. }
  1118. // IfNoneMatch sets the optional parameter which makes the operation
  1119. // fail if the object's ETag matches the given value. This is useful for
  1120. // getting updates only after the object has changed since the last
  1121. // request. Use googleapi.IsNotModified to check whether the response
  1122. // error from Do is the result of In-None-Match.
  1123. func (c *AssetsListCall) IfNoneMatch(entityTag string) *AssetsListCall {
  1124. c.ifNoneMatch_ = entityTag
  1125. return c
  1126. }
  1127. // Context sets the context to be used in this call's Do method. Any
  1128. // pending HTTP request will be aborted if the provided context is
  1129. // canceled.
  1130. func (c *AssetsListCall) Context(ctx context.Context) *AssetsListCall {
  1131. c.ctx_ = ctx
  1132. return c
  1133. }
  1134. // Header returns an http.Header that can be modified by the caller to
  1135. // add HTTP headers to the request.
  1136. func (c *AssetsListCall) Header() http.Header {
  1137. if c.header_ == nil {
  1138. c.header_ = make(http.Header)
  1139. }
  1140. return c.header_
  1141. }
  1142. func (c *AssetsListCall) doRequest(alt string) (*http.Response, error) {
  1143. reqHeaders := make(http.Header)
  1144. for k, v := range c.header_ {
  1145. reqHeaders[k] = v
  1146. }
  1147. reqHeaders.Set("User-Agent", c.s.userAgent())
  1148. if c.ifNoneMatch_ != "" {
  1149. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1150. }
  1151. var body io.Reader = nil
  1152. c.urlParams_.Set("alt", alt)
  1153. c.urlParams_.Set("prettyPrint", "false")
  1154. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/assets")
  1155. urls += "?" + c.urlParams_.Encode()
  1156. req, err := http.NewRequest("GET", urls, body)
  1157. if err != nil {
  1158. return nil, err
  1159. }
  1160. req.Header = reqHeaders
  1161. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1162. }
  1163. // Do executes the "poly.assets.list" call.
  1164. // Exactly one of *ListAssetsResponse or error will be non-nil. Any
  1165. // non-2xx status code is an error. Response headers are in either
  1166. // *ListAssetsResponse.ServerResponse.Header or (if a response was
  1167. // returned at all) in error.(*googleapi.Error).Header. Use
  1168. // googleapi.IsNotModified to check whether the returned error was
  1169. // because http.StatusNotModified was returned.
  1170. func (c *AssetsListCall) Do(opts ...googleapi.CallOption) (*ListAssetsResponse, error) {
  1171. gensupport.SetOptions(c.urlParams_, opts...)
  1172. res, err := c.doRequest("json")
  1173. if res != nil && res.StatusCode == http.StatusNotModified {
  1174. if res.Body != nil {
  1175. res.Body.Close()
  1176. }
  1177. return nil, &googleapi.Error{
  1178. Code: res.StatusCode,
  1179. Header: res.Header,
  1180. }
  1181. }
  1182. if err != nil {
  1183. return nil, err
  1184. }
  1185. defer googleapi.CloseBody(res)
  1186. if err := googleapi.CheckResponse(res); err != nil {
  1187. return nil, err
  1188. }
  1189. ret := &ListAssetsResponse{
  1190. ServerResponse: googleapi.ServerResponse{
  1191. Header: res.Header,
  1192. HTTPStatusCode: res.StatusCode,
  1193. },
  1194. }
  1195. target := &ret
  1196. if err := gensupport.DecodeResponse(target, res); err != nil {
  1197. return nil, err
  1198. }
  1199. return ret, nil
  1200. // {
  1201. // "description": "Lists all public, remixable assets. These are assets with an access level of\nPUBLIC and published under the\nCC-By license.",
  1202. // "flatPath": "v1/assets",
  1203. // "httpMethod": "GET",
  1204. // "id": "poly.assets.list",
  1205. // "parameterOrder": [],
  1206. // "parameters": {
  1207. // "category": {
  1208. // "description": "Filter assets based on the specified category. Supported values are:\n`animals`, `architecture`, `art`, `food`, `nature`, `objects`, `people`, `scenes`,\n`technology`, and `transport`.",
  1209. // "location": "query",
  1210. // "type": "string"
  1211. // },
  1212. // "curated": {
  1213. // "description": "Return only assets that have been curated by the Poly team.",
  1214. // "location": "query",
  1215. // "type": "boolean"
  1216. // },
  1217. // "format": {
  1218. // "description": "Return only assets with the matching format. Acceptable values are:\n`BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.",
  1219. // "location": "query",
  1220. // "type": "string"
  1221. // },
  1222. // "keywords": {
  1223. // "description": "One or more search terms to be matched against all text that Poly has\nindexed for assets, which includes display_name,\ndescription, and tags. Multiple keywords should be\nseparated by spaces.",
  1224. // "location": "query",
  1225. // "type": "string"
  1226. // },
  1227. // "maxComplexity": {
  1228. // "description": "Returns assets that are of the specified complexity or less. Defaults to\nCOMPLEX. For example, a request for\nMEDIUM assets also includes\nSIMPLE assets.",
  1229. // "enum": [
  1230. // "COMPLEXITY_UNSPECIFIED",
  1231. // "COMPLEX",
  1232. // "MEDIUM",
  1233. // "SIMPLE"
  1234. // ],
  1235. // "location": "query",
  1236. // "type": "string"
  1237. // },
  1238. // "orderBy": {
  1239. // "description": "Specifies an ordering for assets. Acceptable values are:\n`BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks assets\nbased on a combination of popularity and other features.",
  1240. // "location": "query",
  1241. // "type": "string"
  1242. // },
  1243. // "pageSize": {
  1244. // "description": "The maximum number of assets to be returned. This value must be between `1`\nand `100`. Defaults to `20`.",
  1245. // "format": "int32",
  1246. // "location": "query",
  1247. // "type": "integer"
  1248. // },
  1249. // "pageToken": {
  1250. // "description": "Specifies a continuation token from a previous search whose results were\nsplit into multiple pages. To get the next page, submit the same request\nspecifying the value from next_page_token.",
  1251. // "location": "query",
  1252. // "type": "string"
  1253. // }
  1254. // },
  1255. // "path": "v1/assets",
  1256. // "response": {
  1257. // "$ref": "ListAssetsResponse"
  1258. // }
  1259. // }
  1260. }
  1261. // Pages invokes f for each page of results.
  1262. // A non-nil error returned from f will halt the iteration.
  1263. // The provided context supersedes any context provided to the Context method.
  1264. func (c *AssetsListCall) Pages(ctx context.Context, f func(*ListAssetsResponse) error) error {
  1265. c.ctx_ = ctx
  1266. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1267. for {
  1268. x, err := c.Do()
  1269. if err != nil {
  1270. return err
  1271. }
  1272. if err := f(x); err != nil {
  1273. return err
  1274. }
  1275. if x.NextPageToken == "" {
  1276. return nil
  1277. }
  1278. c.PageToken(x.NextPageToken)
  1279. }
  1280. }
  1281. // method id "poly.users.assets.list":
  1282. type UsersAssetsListCall struct {
  1283. s *Service
  1284. name string
  1285. urlParams_ gensupport.URLParams
  1286. ifNoneMatch_ string
  1287. ctx_ context.Context
  1288. header_ http.Header
  1289. }
  1290. // List: Lists assets authored by the given user. Only the value 'me',
  1291. // representing
  1292. // the currently-authenticated user, is supported. May include assets
  1293. // with an
  1294. // access level of PRIVATE or
  1295. // UNLISTED and assets which are
  1296. // All Rights Reserved for the
  1297. // currently-authenticated user.
  1298. func (r *UsersAssetsService) List(name string) *UsersAssetsListCall {
  1299. c := &UsersAssetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1300. c.name = name
  1301. return c
  1302. }
  1303. // Format sets the optional parameter "format": Return only assets with
  1304. // the matching format. Acceptable values are:
  1305. // `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, and `TILT`.
  1306. func (c *UsersAssetsListCall) Format(format string) *UsersAssetsListCall {
  1307. c.urlParams_.Set("format", format)
  1308. return c
  1309. }
  1310. // OrderBy sets the optional parameter "orderBy": Specifies an ordering
  1311. // for assets. Acceptable values are:
  1312. // `BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks
  1313. // assets
  1314. // based on a combination of popularity and other features.
  1315. func (c *UsersAssetsListCall) OrderBy(orderBy string) *UsersAssetsListCall {
  1316. c.urlParams_.Set("orderBy", orderBy)
  1317. return c
  1318. }
  1319. // PageSize sets the optional parameter "pageSize": The maximum number
  1320. // of assets to be returned. This value must be between `1`
  1321. // and `100`. Defaults to `20`.
  1322. func (c *UsersAssetsListCall) PageSize(pageSize int64) *UsersAssetsListCall {
  1323. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1324. return c
  1325. }
  1326. // PageToken sets the optional parameter "pageToken": Specifies a
  1327. // continuation token from a previous search whose results were
  1328. // split into multiple pages. To get the next page, submit the same
  1329. // request
  1330. // specifying the value from
  1331. // next_page_token.
  1332. func (c *UsersAssetsListCall) PageToken(pageToken string) *UsersAssetsListCall {
  1333. c.urlParams_.Set("pageToken", pageToken)
  1334. return c
  1335. }
  1336. // Visibility sets the optional parameter "visibility": The visibility
  1337. // of the assets to be returned.
  1338. // Defaults to VISIBILITY_UNSPECIFIED which returns all assets.
  1339. //
  1340. // Possible values:
  1341. // "VISIBILITY_UNSPECIFIED"
  1342. // "PUBLISHED"
  1343. // "PRIVATE"
  1344. func (c *UsersAssetsListCall) Visibility(visibility string) *UsersAssetsListCall {
  1345. c.urlParams_.Set("visibility", visibility)
  1346. return c
  1347. }
  1348. // Fields allows partial responses to be retrieved. See
  1349. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1350. // for more information.
  1351. func (c *UsersAssetsListCall) Fields(s ...googleapi.Field) *UsersAssetsListCall {
  1352. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1353. return c
  1354. }
  1355. // IfNoneMatch sets the optional parameter which makes the operation
  1356. // fail if the object's ETag matches the given value. This is useful for
  1357. // getting updates only after the object has changed since the last
  1358. // request. Use googleapi.IsNotModified to check whether the response
  1359. // error from Do is the result of In-None-Match.
  1360. func (c *UsersAssetsListCall) IfNoneMatch(entityTag string) *UsersAssetsListCall {
  1361. c.ifNoneMatch_ = entityTag
  1362. return c
  1363. }
  1364. // Context sets the context to be used in this call's Do method. Any
  1365. // pending HTTP request will be aborted if the provided context is
  1366. // canceled.
  1367. func (c *UsersAssetsListCall) Context(ctx context.Context) *UsersAssetsListCall {
  1368. c.ctx_ = ctx
  1369. return c
  1370. }
  1371. // Header returns an http.Header that can be modified by the caller to
  1372. // add HTTP headers to the request.
  1373. func (c *UsersAssetsListCall) Header() http.Header {
  1374. if c.header_ == nil {
  1375. c.header_ = make(http.Header)
  1376. }
  1377. return c.header_
  1378. }
  1379. func (c *UsersAssetsListCall) doRequest(alt string) (*http.Response, error) {
  1380. reqHeaders := make(http.Header)
  1381. for k, v := range c.header_ {
  1382. reqHeaders[k] = v
  1383. }
  1384. reqHeaders.Set("User-Agent", c.s.userAgent())
  1385. if c.ifNoneMatch_ != "" {
  1386. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1387. }
  1388. var body io.Reader = nil
  1389. c.urlParams_.Set("alt", alt)
  1390. c.urlParams_.Set("prettyPrint", "false")
  1391. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/assets")
  1392. urls += "?" + c.urlParams_.Encode()
  1393. req, err := http.NewRequest("GET", urls, body)
  1394. if err != nil {
  1395. return nil, err
  1396. }
  1397. req.Header = reqHeaders
  1398. googleapi.Expand(req.URL, map[string]string{
  1399. "name": c.name,
  1400. })
  1401. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1402. }
  1403. // Do executes the "poly.users.assets.list" call.
  1404. // Exactly one of *ListUserAssetsResponse or error will be non-nil. Any
  1405. // non-2xx status code is an error. Response headers are in either
  1406. // *ListUserAssetsResponse.ServerResponse.Header or (if a response was
  1407. // returned at all) in error.(*googleapi.Error).Header. Use
  1408. // googleapi.IsNotModified to check whether the returned error was
  1409. // because http.StatusNotModified was returned.
  1410. func (c *UsersAssetsListCall) Do(opts ...googleapi.CallOption) (*ListUserAssetsResponse, error) {
  1411. gensupport.SetOptions(c.urlParams_, opts...)
  1412. res, err := c.doRequest("json")
  1413. if res != nil && res.StatusCode == http.StatusNotModified {
  1414. if res.Body != nil {
  1415. res.Body.Close()
  1416. }
  1417. return nil, &googleapi.Error{
  1418. Code: res.StatusCode,
  1419. Header: res.Header,
  1420. }
  1421. }
  1422. if err != nil {
  1423. return nil, err
  1424. }
  1425. defer googleapi.CloseBody(res)
  1426. if err := googleapi.CheckResponse(res); err != nil {
  1427. return nil, err
  1428. }
  1429. ret := &ListUserAssetsResponse{
  1430. ServerResponse: googleapi.ServerResponse{
  1431. Header: res.Header,
  1432. HTTPStatusCode: res.StatusCode,
  1433. },
  1434. }
  1435. target := &ret
  1436. if err := gensupport.DecodeResponse(target, res); err != nil {
  1437. return nil, err
  1438. }
  1439. return ret, nil
  1440. // {
  1441. // "description": "Lists assets authored by the given user. Only the value 'me', representing\nthe currently-authenticated user, is supported. May include assets with an\naccess level of PRIVATE or\nUNLISTED and assets which are\nAll Rights Reserved for the\ncurrently-authenticated user.",
  1442. // "flatPath": "v1/users/{usersId}/assets",
  1443. // "httpMethod": "GET",
  1444. // "id": "poly.users.assets.list",
  1445. // "parameterOrder": [
  1446. // "name"
  1447. // ],
  1448. // "parameters": {
  1449. // "format": {
  1450. // "description": "Return only assets with the matching format. Acceptable values are:\n`BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, and `TILT`.",
  1451. // "location": "query",
  1452. // "type": "string"
  1453. // },
  1454. // "name": {
  1455. // "description": "A valid user id. Currently, only the special value 'me', representing the\ncurrently-authenticated user is supported. To use 'me', you must pass\nan OAuth token with the request.",
  1456. // "location": "path",
  1457. // "pattern": "^users/[^/]+$",
  1458. // "required": true,
  1459. // "type": "string"
  1460. // },
  1461. // "orderBy": {
  1462. // "description": "Specifies an ordering for assets. Acceptable values are:\n`BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks assets\nbased on a combination of popularity and other features.",
  1463. // "location": "query",
  1464. // "type": "string"
  1465. // },
  1466. // "pageSize": {
  1467. // "description": "The maximum number of assets to be returned. This value must be between `1`\nand `100`. Defaults to `20`.",
  1468. // "format": "int32",
  1469. // "location": "query",
  1470. // "type": "integer"
  1471. // },
  1472. // "pageToken": {
  1473. // "description": "Specifies a continuation token from a previous search whose results were\nsplit into multiple pages. To get the next page, submit the same request\nspecifying the value from\nnext_page_token.",
  1474. // "location": "query",
  1475. // "type": "string"
  1476. // },
  1477. // "visibility": {
  1478. // "description": "The visibility of the assets to be returned.\nDefaults to VISIBILITY_UNSPECIFIED which returns all assets.",
  1479. // "enum": [
  1480. // "VISIBILITY_UNSPECIFIED",
  1481. // "PUBLISHED",
  1482. // "PRIVATE"
  1483. // ],
  1484. // "location": "query",
  1485. // "type": "string"
  1486. // }
  1487. // },
  1488. // "path": "v1/{+name}/assets",
  1489. // "response": {
  1490. // "$ref": "ListUserAssetsResponse"
  1491. // }
  1492. // }
  1493. }
  1494. // Pages invokes f for each page of results.
  1495. // A non-nil error returned from f will halt the iteration.
  1496. // The provided context supersedes any context provided to the Context method.
  1497. func (c *UsersAssetsListCall) Pages(ctx context.Context, f func(*ListUserAssetsResponse) error) error {
  1498. c.ctx_ = ctx
  1499. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1500. for {
  1501. x, err := c.Do()
  1502. if err != nil {
  1503. return err
  1504. }
  1505. if err := f(x); err != nil {
  1506. return err
  1507. }
  1508. if x.NextPageToken == "" {
  1509. return nil
  1510. }
  1511. c.PageToken(x.NextPageToken)
  1512. }
  1513. }
  1514. // method id "poly.users.likedassets.list":
  1515. type UsersLikedassetsListCall struct {
  1516. s *Service
  1517. name string
  1518. urlParams_ gensupport.URLParams
  1519. ifNoneMatch_ string
  1520. ctx_ context.Context
  1521. header_ http.Header
  1522. }
  1523. // List: Lists assets that the user has liked. Only the value 'me',
  1524. // representing
  1525. // the currently-authenticated user, is supported. May include assets
  1526. // with an
  1527. // access level of UNLISTED.
  1528. func (r *UsersLikedassetsService) List(name string) *UsersLikedassetsListCall {
  1529. c := &UsersLikedassetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1530. c.name = name
  1531. return c
  1532. }
  1533. // Format sets the optional parameter "format": Return only assets with
  1534. // the matching format. Acceptable values are:
  1535. // `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.
  1536. func (c *UsersLikedassetsListCall) Format(format string) *UsersLikedassetsListCall {
  1537. c.urlParams_.Set("format", format)
  1538. return c
  1539. }
  1540. // OrderBy sets the optional parameter "orderBy": Specifies an ordering
  1541. // for assets. Acceptable values are:
  1542. // `BEST`, `NEWEST`, `OLDEST`, 'LIKED_TIME'. Defaults to `LIKED_TIME`,
  1543. // which
  1544. // ranks assets based on how recently they were liked.
  1545. func (c *UsersLikedassetsListCall) OrderBy(orderBy string) *UsersLikedassetsListCall {
  1546. c.urlParams_.Set("orderBy", orderBy)
  1547. return c
  1548. }
  1549. // PageSize sets the optional parameter "pageSize": The maximum number
  1550. // of assets to be returned. This value must be between `1`
  1551. // and `100`. Defaults to `20`.
  1552. func (c *UsersLikedassetsListCall) PageSize(pageSize int64) *UsersLikedassetsListCall {
  1553. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1554. return c
  1555. }
  1556. // PageToken sets the optional parameter "pageToken": Specifies a
  1557. // continuation token from a previous search whose results were
  1558. // split into multiple pages. To get the next page, submit the same
  1559. // request
  1560. // specifying the value from
  1561. // next_page_token.
  1562. func (c *UsersLikedassetsListCall) PageToken(pageToken string) *UsersLikedassetsListCall {
  1563. c.urlParams_.Set("pageToken", pageToken)
  1564. return c
  1565. }
  1566. // Fields allows partial responses to be retrieved. See
  1567. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1568. // for more information.
  1569. func (c *UsersLikedassetsListCall) Fields(s ...googleapi.Field) *UsersLikedassetsListCall {
  1570. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1571. return c
  1572. }
  1573. // IfNoneMatch sets the optional parameter which makes the operation
  1574. // fail if the object's ETag matches the given value. This is useful for
  1575. // getting updates only after the object has changed since the last
  1576. // request. Use googleapi.IsNotModified to check whether the response
  1577. // error from Do is the result of In-None-Match.
  1578. func (c *UsersLikedassetsListCall) IfNoneMatch(entityTag string) *UsersLikedassetsListCall {
  1579. c.ifNoneMatch_ = entityTag
  1580. return c
  1581. }
  1582. // Context sets the context to be used in this call's Do method. Any
  1583. // pending HTTP request will be aborted if the provided context is
  1584. // canceled.
  1585. func (c *UsersLikedassetsListCall) Context(ctx context.Context) *UsersLikedassetsListCall {
  1586. c.ctx_ = ctx
  1587. return c
  1588. }
  1589. // Header returns an http.Header that can be modified by the caller to
  1590. // add HTTP headers to the request.
  1591. func (c *UsersLikedassetsListCall) Header() http.Header {
  1592. if c.header_ == nil {
  1593. c.header_ = make(http.Header)
  1594. }
  1595. return c.header_
  1596. }
  1597. func (c *UsersLikedassetsListCall) doRequest(alt string) (*http.Response, error) {
  1598. reqHeaders := make(http.Header)
  1599. for k, v := range c.header_ {
  1600. reqHeaders[k] = v
  1601. }
  1602. reqHeaders.Set("User-Agent", c.s.userAgent())
  1603. if c.ifNoneMatch_ != "" {
  1604. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1605. }
  1606. var body io.Reader = nil
  1607. c.urlParams_.Set("alt", alt)
  1608. c.urlParams_.Set("prettyPrint", "false")
  1609. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/likedassets")
  1610. urls += "?" + c.urlParams_.Encode()
  1611. req, err := http.NewRequest("GET", urls, body)
  1612. if err != nil {
  1613. return nil, err
  1614. }
  1615. req.Header = reqHeaders
  1616. googleapi.Expand(req.URL, map[string]string{
  1617. "name": c.name,
  1618. })
  1619. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1620. }
  1621. // Do executes the "poly.users.likedassets.list" call.
  1622. // Exactly one of *ListLikedAssetsResponse or error will be non-nil. Any
  1623. // non-2xx status code is an error. Response headers are in either
  1624. // *ListLikedAssetsResponse.ServerResponse.Header or (if a response was
  1625. // returned at all) in error.(*googleapi.Error).Header. Use
  1626. // googleapi.IsNotModified to check whether the returned error was
  1627. // because http.StatusNotModified was returned.
  1628. func (c *UsersLikedassetsListCall) Do(opts ...googleapi.CallOption) (*ListLikedAssetsResponse, error) {
  1629. gensupport.SetOptions(c.urlParams_, opts...)
  1630. res, err := c.doRequest("json")
  1631. if res != nil && res.StatusCode == http.StatusNotModified {
  1632. if res.Body != nil {
  1633. res.Body.Close()
  1634. }
  1635. return nil, &googleapi.Error{
  1636. Code: res.StatusCode,
  1637. Header: res.Header,
  1638. }
  1639. }
  1640. if err != nil {
  1641. return nil, err
  1642. }
  1643. defer googleapi.CloseBody(res)
  1644. if err := googleapi.CheckResponse(res); err != nil {
  1645. return nil, err
  1646. }
  1647. ret := &ListLikedAssetsResponse{
  1648. ServerResponse: googleapi.ServerResponse{
  1649. Header: res.Header,
  1650. HTTPStatusCode: res.StatusCode,
  1651. },
  1652. }
  1653. target := &ret
  1654. if err := gensupport.DecodeResponse(target, res); err != nil {
  1655. return nil, err
  1656. }
  1657. return ret, nil
  1658. // {
  1659. // "description": "Lists assets that the user has liked. Only the value 'me', representing\nthe currently-authenticated user, is supported. May include assets with an\naccess level of UNLISTED.",
  1660. // "flatPath": "v1/users/{usersId}/likedassets",
  1661. // "httpMethod": "GET",
  1662. // "id": "poly.users.likedassets.list",
  1663. // "parameterOrder": [
  1664. // "name"
  1665. // ],
  1666. // "parameters": {
  1667. // "format": {
  1668. // "description": "Return only assets with the matching format. Acceptable values are:\n`BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.",
  1669. // "location": "query",
  1670. // "type": "string"
  1671. // },
  1672. // "name": {
  1673. // "description": "A valid user id. Currently, only the special value 'me', representing the\ncurrently-authenticated user is supported. To use 'me', you must pass\nan OAuth token with the request.",
  1674. // "location": "path",
  1675. // "pattern": "^users/[^/]+$",
  1676. // "required": true,
  1677. // "type": "string"
  1678. // },
  1679. // "orderBy": {
  1680. // "description": "Specifies an ordering for assets. Acceptable values are:\n`BEST`, `NEWEST`, `OLDEST`, 'LIKED_TIME'. Defaults to `LIKED_TIME`, which\nranks assets based on how recently they were liked.",
  1681. // "location": "query",
  1682. // "type": "string"
  1683. // },
  1684. // "pageSize": {
  1685. // "description": "The maximum number of assets to be returned. This value must be between `1`\nand `100`. Defaults to `20`.",
  1686. // "format": "int32",
  1687. // "location": "query",
  1688. // "type": "integer"
  1689. // },
  1690. // "pageToken": {
  1691. // "description": "Specifies a continuation token from a previous search whose results were\nsplit into multiple pages. To get the next page, submit the same request\nspecifying the value from\nnext_page_token.",
  1692. // "location": "query",
  1693. // "type": "string"
  1694. // }
  1695. // },
  1696. // "path": "v1/{+name}/likedassets",
  1697. // "response": {
  1698. // "$ref": "ListLikedAssetsResponse"
  1699. // }
  1700. // }
  1701. }
  1702. // Pages invokes f for each page of results.
  1703. // A non-nil error returned from f will halt the iteration.
  1704. // The provided context supersedes any context provided to the Context method.
  1705. func (c *UsersLikedassetsListCall) Pages(ctx context.Context, f func(*ListLikedAssetsResponse) error) error {
  1706. c.ctx_ = ctx
  1707. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1708. for {
  1709. x, err := c.Do()
  1710. if err != nil {
  1711. return err
  1712. }
  1713. if err := f(x); err != nil {
  1714. return err
  1715. }
  1716. if x.NextPageToken == "" {
  1717. return nil
  1718. }
  1719. c.PageToken(x.NextPageToken)
  1720. }
  1721. }