...

Source file src/google.golang.org/api/poly/v1/poly-gen.go

Documentation: google.golang.org/api/poly/v1

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

View as plain text