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.
 
 
 

1810 lines
64 KiB

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