poly

package
v0.178.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package poly provides access to the Poly API.

For product documentation, see: https://developers.google.com/poly/

Library status

These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.

When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.

Creating a client

Usage example:

import "google.golang.org/api/poly/v1"
...
ctx := context.Background()
polyService, err := poly.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication. For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use google.golang.org/api/option.WithAPIKey:

polyService, err := poly.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow, use google.golang.org/api/option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
polyService, err := poly.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See google.golang.org/api/option.ClientOption for details on options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	// AuthorName: The author's publicly visible name. Use this name when giving
	// credit to the author. For more information, see Licensing
	// (/poly/discover/licensing).
	AuthorName string `json:"authorName,omitempty"`
	// CreateTime: For published assets, the time when the asset was published. For
	// unpublished assets, the time when the asset was created.
	CreateTime string `json:"createTime,omitempty"`
	// Description: The human-readable description, set by the asset's author.
	Description string `json:"description,omitempty"`
	// DisplayName: The human-readable name, set by the asset's author.
	DisplayName string `json:"displayName,omitempty"`
	// Formats: A list of Formats where each format describes one representation of
	// the asset.
	Formats []*Format `json:"formats,omitempty"`
	// IsCurated: Whether this asset has been curated by the Poly team.
	IsCurated bool `json:"isCurated,omitempty"`
	// License: The license under which the author has made the asset available for
	// use, if any.
	//
	// Possible values:
	//   "UNKNOWN" - Unknown license value.
	//   "CREATIVE_COMMONS_BY" - Creative Commons CC-BY 3.0.
	// https://creativecommons.org/licenses/by/3.0/
	//   "ALL_RIGHTS_RESERVED" - Unlicensed: All Rights Reserved by the author.
	// Unlicensed assets are **not** returned by List Assets.
	License string `json:"license,omitempty"`
	// Metadata: Application-defined opaque metadata for this asset. This field is
	// only returned when querying for the signed-in user's own assets, not for
	// public assets. This string is limited to 1K chars. It is up to the creator
	// of the asset to define the format for this string (for example, JSON).
	Metadata string `json:"metadata,omitempty"`
	// Name: The unique identifier for the asset in the form: `assets/{ASSET_ID}`.
	Name string `json:"name,omitempty"`
	// PresentationParams: Hints for displaying the asset. Note that these
	// parameters are not immutable; the author of an asset may change them
	// post-publication.
	PresentationParams *PresentationParams `json:"presentationParams,omitempty"`
	// RemixInfo: The remix info for the asset.
	RemixInfo *RemixInfo `json:"remixInfo,omitempty"`
	// Thumbnail: The thumbnail image for the asset.
	Thumbnail *File `json:"thumbnail,omitempty"`
	// UpdateTime: The time when the asset was last modified. For published assets,
	// whose contents are immutable, the update time changes only when metadata
	// properties, such as visibility, are updated.
	UpdateTime string `json:"updateTime,omitempty"`
	// Visibility: The visibility of the asset and who can access it.
	//
	// Possible values:
	//   "VISIBILITY_UNSPECIFIED" - Unknown (and invalid) visibility.
	//   "PRIVATE" - Access to the asset and its underlying files and resources is
	// restricted to the author. **Authentication:** You must supply an OAuth token
	// that corresponds to the author's account.
	//   "UNLISTED" - Access to the asset and its underlying files and resources is
	// available to anyone with the asset's name. Unlisted assets are **not**
	// returned by List Assets.
	//   "PUBLIC" - Access to the asset and its underlying files and resources is
	// available to anyone.
	Visibility string `json:"visibility,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "AuthorName") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "AuthorName") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

Asset: Represents and describes an asset in the Poly library. An asset is a 3D model or scene created using Tilt Brush (//www.tiltbrush.com), Blocks (//vr.google.com/blocks/), or any 3D program that produces a file that can be upload to Poly.

func (*Asset) MarshalJSON

func (s *Asset) MarshalJSON() ([]byte, error)

type AssetImportMessage

type AssetImportMessage struct {
	// Code: The code associated with this message.
	//
	// Possible values:
	//   "CODE_UNSPECIFIED" - Unknown error code.
	//   "NO_IMPORTABLE_FILE" - The asset import did not include any file that we
	// can import (i.e. an OBJ file).
	//   "EMPTY_MODEL" - When generating the preview for the import, no geometry
	// was found.
	//   "OBJ_PARSE_ERROR" - A problem was encountered while parsing the OBJ file.
	// The converter makes a 'best effort' attempt to continue when encountering
	// such issues. In some cases the resulting preview model may still be
	// acceptable. The details can be found in the parse error message.
	//   "EXPIRED" - The importer was not able to import the model before the
	// expiration time.
	//   "IMAGE_ERROR" - The importer encountered a problem reading an image file.
	//   "EXTRA_FILES_WITH_ARCHIVE" - Multiple files were encountered in addition
	// to a ZIP archive. When uploading an archive only one file is permitted.
	//   "DEFAULT_MATERIALS" - Default materials are used in the model. This means
	// that one or more faces is using default materials either because no usemtl
	// statement was specified or because the requested material was not found due
	// to a missing material file or bad material name. This does not cover the
	// case of missing textures.
	//   "FATAL_ERROR" - The importer encountered a fatal error and was unable to
	// import the model.
	//   "INVALID_ELEMENT_TYPE" - The import includes a file of an unsupported
	// element type. The file path is specified.
	Code string `json:"code,omitempty"`
	// FilePath: An optional file path. Only present for those error codes that
	// specify it.
	FilePath string `json:"filePath,omitempty"`
	// ImageError: An optional image error. Only present for INVALID_IMAGE_FILE.
	ImageError *ImageError `json:"imageError,omitempty"`
	// ObjParseError: An optional OBJ parse error. Only present for
	// OBJ_PARSE_ERROR.
	ObjParseError *ObjParseError `json:"objParseError,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Code") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

AssetImportMessage: A message generated by the asset import process.

func (*AssetImportMessage) MarshalJSON

func (s *AssetImportMessage) MarshalJSON() ([]byte, error)

type AssetsGetCall

type AssetsGetCall struct {
	// contains filtered or unexported fields
}

func (*AssetsGetCall) Context

func (c *AssetsGetCall) Context(ctx context.Context) *AssetsGetCall

Context sets the context to be used in this call's Do method.

func (*AssetsGetCall) Do

func (c *AssetsGetCall) Do(opts ...googleapi.CallOption) (*Asset, error)

Do executes the "poly.assets.get" call. Any non-2xx status code is an error. Response headers are in either *Asset.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*AssetsGetCall) Fields

func (c *AssetsGetCall) Fields(s ...googleapi.Field) *AssetsGetCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*AssetsGetCall) Header

func (c *AssetsGetCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*AssetsGetCall) IfNoneMatch

func (c *AssetsGetCall) IfNoneMatch(entityTag string) *AssetsGetCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

type AssetsListCall

type AssetsListCall struct {
	// contains filtered or unexported fields
}

func (*AssetsListCall) Category

func (c *AssetsListCall) Category(category string) *AssetsListCall

Category sets the optional parameter "category": Filter assets based on the specified category. Supported values are: `animals`, `architecture`, `art`, `food`, `nature`, `objects`, `people`, `scenes`, `technology`, and `transport`.

func (*AssetsListCall) Context

func (c *AssetsListCall) Context(ctx context.Context) *AssetsListCall

Context sets the context to be used in this call's Do method.

func (*AssetsListCall) Curated

func (c *AssetsListCall) Curated(curated bool) *AssetsListCall

Curated sets the optional parameter "curated": Return only assets that have been curated by the Poly team.

func (*AssetsListCall) Do

Do executes the "poly.assets.list" call. Any non-2xx status code is an error. Response headers are in either *ListAssetsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*AssetsListCall) Fields

func (c *AssetsListCall) Fields(s ...googleapi.Field) *AssetsListCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*AssetsListCall) Format

func (c *AssetsListCall) Format(format string) *AssetsListCall

Format sets the optional parameter "format": Return only assets with the matching format. Acceptable values are: `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.

func (*AssetsListCall) Header

func (c *AssetsListCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*AssetsListCall) IfNoneMatch

func (c *AssetsListCall) IfNoneMatch(entityTag string) *AssetsListCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

func (*AssetsListCall) Keywords

func (c *AssetsListCall) Keywords(keywords string) *AssetsListCall

Keywords sets the optional parameter "keywords": One or more search terms to be matched against all text that Poly has indexed for assets, which includes display_name, description, and tags. Multiple keywords should be separated by spaces.

func (*AssetsListCall) MaxComplexity

func (c *AssetsListCall) MaxComplexity(maxComplexity string) *AssetsListCall

MaxComplexity sets the optional parameter "maxComplexity": Returns assets that are of the specified complexity or less. Defaults to COMPLEX. For example, a request for MEDIUM assets also includes SIMPLE assets.

Possible values:

"COMPLEXITY_UNSPECIFIED" - No complexity specified. This is equivalent to

omitting the filter.

"COMPLEX" - Highly-complex.
"MEDIUM" - Averagely-complex.
"SIMPLE" - Simple.

func (*AssetsListCall) OrderBy

func (c *AssetsListCall) OrderBy(orderBy string) *AssetsListCall

OrderBy sets the optional parameter "orderBy": Specifies an ordering for assets. Acceptable values are: `BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks assets based on a combination of popularity and other features.

func (*AssetsListCall) PageSize

func (c *AssetsListCall) PageSize(pageSize int64) *AssetsListCall

PageSize sets the optional parameter "pageSize": The maximum number of assets to be returned. This value must be between `1` and `100`. Defaults to `20`.

func (*AssetsListCall) PageToken

func (c *AssetsListCall) PageToken(pageToken string) *AssetsListCall

PageToken sets the optional parameter "pageToken": Specifies a continuation token from a previous search whose results were split into multiple pages. To get the next page, submit the same request specifying the value from next_page_token.

func (*AssetsListCall) Pages

func (c *AssetsListCall) Pages(ctx context.Context, f func(*ListAssetsResponse) error) error

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type AssetsService

type AssetsService struct {
	// contains filtered or unexported fields
}

func NewAssetsService

func NewAssetsService(s *Service) *AssetsService

func (*AssetsService) Get

func (r *AssetsService) Get(name string) *AssetsGetCall

Get: Returns detailed information about an asset given its name. PRIVATE assets are returned only if the currently authenticated user (via OAuth token) is the author of the asset.

- name: An asset's name in the form `assets/{ASSET_ID}`.

func (*AssetsService) List

func (r *AssetsService) List() *AssetsListCall

List: Lists all public, remixable assets. These are assets with an access level of PUBLIC and published under the CC-By license.

type File

type File struct {
	// ContentType: The MIME content-type, such as `image/png`. For more
	// information, see MIME types
	// (//developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types).
	ContentType string `json:"contentType,omitempty"`
	// RelativePath: The path of the resource file relative to the root file. For
	// root or thumbnail files, this is just the filename.
	RelativePath string `json:"relativePath,omitempty"`
	// Url: The URL where the file data can be retrieved.
	Url string `json:"url,omitempty"`
	// ForceSendFields is a list of field names (e.g. "ContentType") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "ContentType") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

File: Represents a file in Poly, which can be a root, resource, or thumbnail file.

func (*File) MarshalJSON

func (s *File) MarshalJSON() ([]byte, error)

type Format

type Format struct {
	// FormatComplexity: Complexity stats about this representation of the asset.
	FormatComplexity *FormatComplexity `json:"formatComplexity,omitempty"`
	// FormatType: A short string that identifies the format type of this
	// representation. Possible values are: `FBX`, `GLTF`, `GLTF2`, `OBJ`, and
	// `TILT`.
	FormatType string `json:"formatType,omitempty"`
	// Resources: A list of dependencies of the root element. May include, but is
	// not limited to, materials, textures, and shader programs.
	Resources []*File `json:"resources,omitempty"`
	// Root: The root of the file hierarchy. This will always be populated. For
	// some format_types - such as `TILT`, which are self-contained - this is all
	// of the data. Other types - such as `OBJ` - often reference other data
	// elements. These are contained in the resources field.
	Root *File `json:"root,omitempty"`
	// ForceSendFields is a list of field names (e.g. "FormatComplexity") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "FormatComplexity") to include in
	// API requests with the JSON null value. By default, fields with empty values
	// are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

Format: The same asset can be represented in different formats, for example, a WaveFront .obj (//en.wikipedia.org/wiki/Wavefront_.obj_file) file with its corresponding .mtl file or a Khronos glTF (//www.khronos.org/gltf) file with its corresponding .glb binary data. A format refers to a specific representation of an asset and contains all information needed to retrieve and describe this representation.

func (*Format) MarshalJSON

func (s *Format) MarshalJSON() ([]byte, error)

type FormatComplexity

type FormatComplexity struct {
	// LodHint: A non-negative integer that represents the level of detail (LOD) of
	// this format relative to other formats of the same asset with the same
	// format_type. This hint allows you to sort formats from the most-detailed (0)
	// to least-detailed (integers greater than 0).
	LodHint int64 `json:"lodHint,omitempty"`
	// TriangleCount: The estimated number of triangles.
	TriangleCount int64 `json:"triangleCount,omitempty,string"`
	// ForceSendFields is a list of field names (e.g. "LodHint") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "LodHint") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

FormatComplexity: Information on the complexity of this Format.

func (*FormatComplexity) MarshalJSON

func (s *FormatComplexity) MarshalJSON() ([]byte, error)

type ImageError

type ImageError struct {
	// Code: The type of image error encountered. Optional for older image errors.
	//
	// Possible values:
	//   "CODE_UNSPECIFIED" - Unknown error code.
	//   "INVALID_IMAGE" - We were unable to read the image file.
	//   "IMAGE_TOO_BIG" - The image size is too large.
	//   "WRONG_IMAGE_TYPE" - The image data does not match the expected MIME type
	// of the image.
	Code string `json:"code,omitempty"`
	// FilePath: The file path in the import of the image that was rejected.
	FilePath string `json:"filePath,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Code") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ImageError: A message resulting from reading an image file.

func (*ImageError) MarshalJSON

func (s *ImageError) MarshalJSON() ([]byte, error)

type ListAssetsResponse

type ListAssetsResponse struct {
	// Assets: A list of assets that match the criteria specified in the request.
	Assets []*Asset `json:"assets,omitempty"`
	// NextPageToken: The continuation token for retrieving the next page. If
	// empty, indicates that there are no more pages. To get the next page, submit
	// the same request specifying this value as the page_token.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// TotalSize: The total number of assets in the list, without pagination.
	TotalSize int64 `json:"totalSize,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Assets") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Assets") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ListAssetsResponse: A response message from a request to list.

func (*ListAssetsResponse) MarshalJSON

func (s *ListAssetsResponse) MarshalJSON() ([]byte, error)

type ListLikedAssetsResponse

type ListLikedAssetsResponse struct {
	// Assets: A list of assets that match the criteria specified in the request.
	Assets []*Asset `json:"assets,omitempty"`
	// NextPageToken: The continuation token for retrieving the next page. If
	// empty, indicates that there are no more pages. To get the next page, submit
	// the same request specifying this value as the page_token.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// TotalSize: The total number of assets in the list, without pagination.
	TotalSize int64 `json:"totalSize,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Assets") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Assets") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ListLikedAssetsResponse: A response message from a request to list.

func (*ListLikedAssetsResponse) MarshalJSON

func (s *ListLikedAssetsResponse) MarshalJSON() ([]byte, error)

type ListUserAssetsResponse

type ListUserAssetsResponse struct {
	// NextPageToken: The continuation token for retrieving the next page. If
	// empty, indicates that there are no more pages. To get the next page, submit
	// the same request specifying this value as the page_token.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// TotalSize: The total number of assets in the list, without pagination.
	TotalSize int64 `json:"totalSize,omitempty"`
	// UserAssets: A list of UserAssets matching the request.
	UserAssets []*UserAsset `json:"userAssets,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ListUserAssetsResponse: A response message from a request to list.

func (*ListUserAssetsResponse) MarshalJSON

func (s *ListUserAssetsResponse) MarshalJSON() ([]byte, error)

type ObjParseError

type ObjParseError struct {
	// Code: The type of problem found (required).
	//
	// Possible values:
	//   "CODE_UNSPECIFIED" - Unknown error code.
	//   "INCONSISTENT_VERTEX_REFS" - Vertex references are specified in an
	// inconsistent style for a face (e.g. some vertices specify texture vertices
	// but some don't).
	//   "INVALID_COMMAND" - The command is invalid.
	//   "INVALID_NUMBER" - A invalid number was specified.
	//   "INVALID_VERTEX_REF" - An invalid vertex reference was specified.
	//   "MISSING_GEOMETRIC_VERTEX" - A vertex reference does not specify a
	// geometric vertex.
	//   "MISSING_TOKEN" - An expected token was not found.
	//   "TOO_FEW_DIMENSIONS" - The vertex specified too few dimensions for its
	// usage.
	//   "TOO_FEW_VERTICES" - The face specified too few vertices.
	//   "TOO_MANY_DIMENSIONS" - The vertex specified too many dimensions for its
	// usage.
	//   "UNSUPPORTED_COMMAND" - This command is a valid OBJ command but is not
	// supported. This error is only generated for the first instance of such a
	// command.
	//   "UNUSED_TOKENS" - This line ended with unparsed token characters.
	//   "VERTEX_NOT_FOUND" - The specified vertex was not found.
	//   "NUMBER_OUT_OF_RANGE" - The specified number was too large or small for
	// its usage.
	//   "INVALID_VALUE" - The specified parameter value was not recognized.
	//   "INVALID_TEXTURE_OPTION" - The specified texture option is not valid.
	//   "TOO_MANY_PROBLEMS" - The maximum number of problems to report was
	// reached. Parsing continues, but further problems will be ignored.
	//   "MISSING_FILE_NAME" - An expected file name was not specified.
	//   "FILE_NOT_FOUND" - The specified file was not found in the import.
	//   "UNKNOWN_MATERIAL" - The specified material was not found in any material
	// definition in the import.
	//   "NO_MATERIAL_DEFINED" - Material parameters were specified before the
	// first material definition.
	//   "INVALID_SMOOTHING_GROUP" - The smoothing group is not valid.
	//   "MISSING_VERTEX_COLORS" - Vertex colors were specified for only some
	// vertices of a face.
	//   "FILE_SUBSTITUTION" - A missing file was found at a different file path.
	//   "LINE_TOO_LONG" - A line in an OBJ or MTL file exceeded the maximum line
	// length.
	//   "INVALID_FILE_PATH" - The file path was invalid. Only relative paths are
	// supported.
	Code string `json:"code,omitempty"`
	// EndIndex: The ending character index at which the problem was found.
	EndIndex int64 `json:"endIndex,omitempty"`
	// FilePath: The file path in which the problem was found.
	FilePath string `json:"filePath,omitempty"`
	// Line: The text of the line. Note that this may be truncated if the line was
	// very long. This may not include the error if it occurs after line
	// truncation.
	Line string `json:"line,omitempty"`
	// LineNumber: Line number at which the problem was found.
	LineNumber int64 `json:"lineNumber,omitempty"`
	// StartIndex: The starting character index at which the problem was found.
	StartIndex int64 `json:"startIndex,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Code") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ObjParseError: Details of an error resulting from parsing an OBJ file

func (*ObjParseError) MarshalJSON

func (s *ObjParseError) MarshalJSON() ([]byte, error)

type PresentationParams

type PresentationParams struct {
	// BackgroundColor: A background color which could be used for displaying the
	// 3D asset in a 'thumbnail' or 'palette' style view. Authors have the option
	// to set this background color when publishing or editing their asset. This is
	// represented as a six-digit hexademical triplet specifying the RGB components
	// of the background color, e.g. #FF0000 for Red.
	BackgroundColor string `json:"backgroundColor,omitempty"`
	// ColorSpace: The materials' diffuse/albedo color. This does not apply to
	// vertex colors or texture maps.
	//
	// Possible values:
	//   "UNKNOWN" - Invalid color value.
	//   "LINEAR" - Linear color values. Default.
	//   "GAMMA" - Colors should be converted to linear by assuming gamma = 2.0.
	ColorSpace string `json:"colorSpace,omitempty"`
	// OrientingRotation: A rotation that should be applied to the object root to
	// make it upright. More precisely, this quaternion transforms from "object
	// space" (the space in which the object is defined) to "presentation space", a
	// coordinate system where +Y is up, +X is right, -Z is forward. For example,
	// if the object is the Eiffel Tower, in its local coordinate system the object
	// might be laid out such that the base of the tower is on the YZ plane and the
	// tip of the tower is towards positive X. In this case this quaternion would
	// specify a rotation (of 90 degrees about the Z axis) such that in the
	// presentation space the base of the tower is aligned with the XZ plane, and
	// the tip of the tower lies towards +Y. This rotation is unrelated to the
	// object's pose in the web preview, which is just a camera position setting
	// and is *not* reflected in this rotation. Please note: this is applicable
	// only to the gLTF.
	OrientingRotation *Quaternion `json:"orientingRotation,omitempty"`
	// ForceSendFields is a list of field names (e.g. "BackgroundColor") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "BackgroundColor") to include in
	// API requests with the JSON null value. By default, fields with empty values
	// are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

PresentationParams: Hints for displaying the asset, based on information available when the asset was uploaded.

func (*PresentationParams) MarshalJSON

func (s *PresentationParams) MarshalJSON() ([]byte, error)

type Quaternion

type Quaternion struct {
	// W: The scalar component.
	W float64 `json:"w,omitempty"`
	// X: The x component.
	X float64 `json:"x,omitempty"`
	// Y: The y component.
	Y float64 `json:"y,omitempty"`
	// Z: The z component.
	Z float64 `json:"z,omitempty"`
	// ForceSendFields is a list of field names (e.g. "W") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "W") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

Quaternion: A Quaternion (//en.wikipedia.org/wiki/Quaternion). Please note: if in the response you see "w: 1" and nothing else this is the default value of [0, 0, 0, 1] where x,y, and z are 0.

func (*Quaternion) MarshalJSON

func (s *Quaternion) MarshalJSON() ([]byte, error)

func (*Quaternion) UnmarshalJSON

func (s *Quaternion) UnmarshalJSON(data []byte) error

type RemixInfo

type RemixInfo struct {
	// SourceAsset: Resource ids for the sources of this remix, of the form:
	// `assets/{ASSET_ID}`
	SourceAsset []string `json:"sourceAsset,omitempty"`
	// ForceSendFields is a list of field names (e.g. "SourceAsset") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "SourceAsset") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

RemixInfo: Info about the sources of this asset (i.e. assets that were remixed to create this asset).

func (*RemixInfo) MarshalJSON

func (s *RemixInfo) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Assets *AssetsService

	Users *UsersService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService added in v0.3.0

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type StartAssetImportResponse

type StartAssetImportResponse struct {
	// AssetId: The id of newly created asset. If this is empty when the operation
	// is complete it means the import failed. Please refer to the
	// assetImportMessages field to understand what went wrong.
	AssetId string `json:"assetId,omitempty"`
	// AssetImportId: The id of the asset import.
	AssetImportId string `json:"assetImportId,omitempty"`
	// AssetImportMessages: The message from the asset import. This will contain
	// any warnings (or - in the case of failure - errors) that occurred during
	// import.
	AssetImportMessages []*AssetImportMessage `json:"assetImportMessages,omitempty"`
	// PublishUrl: The publish URL for the asset.
	PublishUrl string `json:"publishUrl,omitempty"`
	// ForceSendFields is a list of field names (e.g. "AssetId") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "AssetId") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

StartAssetImportResponse: A response message from a request to startImport. This is returned in the response field of the Operation.

func (*StartAssetImportResponse) MarshalJSON

func (s *StartAssetImportResponse) MarshalJSON() ([]byte, error)

type UserAsset

type UserAsset struct {
	// Asset: An Asset.
	Asset *Asset `json:"asset,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Asset") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Asset") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

UserAsset: Data about the user's asset.

func (*UserAsset) MarshalJSON

func (s *UserAsset) MarshalJSON() ([]byte, error)

type UsersAssetsListCall

type UsersAssetsListCall struct {
	// contains filtered or unexported fields
}

func (*UsersAssetsListCall) Context

Context sets the context to be used in this call's Do method.

func (*UsersAssetsListCall) Do

Do executes the "poly.users.assets.list" call. Any non-2xx status code is an error. Response headers are in either *ListUserAssetsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*UsersAssetsListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*UsersAssetsListCall) Format

func (c *UsersAssetsListCall) Format(format string) *UsersAssetsListCall

Format sets the optional parameter "format": Return only assets with the matching format. Acceptable values are: `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, and `TILT`.

func (*UsersAssetsListCall) Header

func (c *UsersAssetsListCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*UsersAssetsListCall) IfNoneMatch

func (c *UsersAssetsListCall) IfNoneMatch(entityTag string) *UsersAssetsListCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

func (*UsersAssetsListCall) OrderBy

func (c *UsersAssetsListCall) OrderBy(orderBy string) *UsersAssetsListCall

OrderBy sets the optional parameter "orderBy": Specifies an ordering for assets. Acceptable values are: `BEST`, `NEWEST`, `OLDEST`. Defaults to `BEST`, which ranks assets based on a combination of popularity and other features.

func (*UsersAssetsListCall) PageSize

func (c *UsersAssetsListCall) PageSize(pageSize int64) *UsersAssetsListCall

PageSize sets the optional parameter "pageSize": The maximum number of assets to be returned. This value must be between `1` and `100`. Defaults to `20`.

func (*UsersAssetsListCall) PageToken

func (c *UsersAssetsListCall) PageToken(pageToken string) *UsersAssetsListCall

PageToken sets the optional parameter "pageToken": Specifies a continuation token from a previous search whose results were split into multiple pages. To get the next page, submit the same request specifying the value from next_page_token.

func (*UsersAssetsListCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

func (*UsersAssetsListCall) Visibility

func (c *UsersAssetsListCall) Visibility(visibility string) *UsersAssetsListCall

Visibility sets the optional parameter "visibility": The visibility of the assets to be returned. Defaults to VISIBILITY_UNSPECIFIED which returns all assets.

Possible values:

"VISIBILITY_UNSPECIFIED" - No visibility specified. Returns all assets.
"PUBLISHED" - Returns only published assets.
"PRIVATE" - Returns only private assets.

type UsersAssetsService

type UsersAssetsService struct {
	// contains filtered or unexported fields
}

func NewUsersAssetsService

func NewUsersAssetsService(s *Service) *UsersAssetsService

func (*UsersAssetsService) List

List: Lists assets authored by the given user. Only the value 'me', representing the currently-authenticated user, is supported. May include assets with an access level of PRIVATE or UNLISTED and assets which are All Rights Reserved for the currently-authenticated user.

  • name: A valid user id. Currently, only the special value 'me', representing the currently-authenticated user is supported. To use 'me', you must pass an OAuth token with the request.

type UsersLikedassetsListCall

type UsersLikedassetsListCall struct {
	// contains filtered or unexported fields
}

func (*UsersLikedassetsListCall) Context

Context sets the context to be used in this call's Do method.

func (*UsersLikedassetsListCall) Do

Do executes the "poly.users.likedassets.list" call. Any non-2xx status code is an error. Response headers are in either *ListLikedAssetsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*UsersLikedassetsListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*UsersLikedassetsListCall) Format

Format sets the optional parameter "format": Return only assets with the matching format. Acceptable values are: `BLOCKS`, `FBX`, `GLTF`, `GLTF2`, `OBJ`, `TILT`.

func (*UsersLikedassetsListCall) Header

func (c *UsersLikedassetsListCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*UsersLikedassetsListCall) IfNoneMatch

func (c *UsersLikedassetsListCall) IfNoneMatch(entityTag string) *UsersLikedassetsListCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

func (*UsersLikedassetsListCall) OrderBy

OrderBy sets the optional parameter "orderBy": Specifies an ordering for assets. Acceptable values are: `BEST`, `NEWEST`, `OLDEST`, 'LIKED_TIME'. Defaults to `LIKED_TIME`, which ranks assets based on how recently they were liked.

func (*UsersLikedassetsListCall) PageSize

PageSize sets the optional parameter "pageSize": The maximum number of assets to be returned. This value must be between `1` and `100`. Defaults to `20`.

func (*UsersLikedassetsListCall) PageToken

func (c *UsersLikedassetsListCall) PageToken(pageToken string) *UsersLikedassetsListCall

PageToken sets the optional parameter "pageToken": Specifies a continuation token from a previous search whose results were split into multiple pages. To get the next page, submit the same request specifying the value from next_page_token.

func (*UsersLikedassetsListCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type UsersLikedassetsService

type UsersLikedassetsService struct {
	// contains filtered or unexported fields
}

func NewUsersLikedassetsService

func NewUsersLikedassetsService(s *Service) *UsersLikedassetsService

func (*UsersLikedassetsService) List

List: Lists assets that the user has liked. Only the value 'me', representing the currently-authenticated user, is supported. May include assets with an access level of UNLISTED.

  • name: A valid user id. Currently, only the special value 'me', representing the currently-authenticated user is supported. To use 'me', you must pass an OAuth token with the request.

type UsersService

type UsersService struct {
	Assets *UsersAssetsService

	Likedassets *UsersLikedassetsService
	// contains filtered or unexported fields
}

func NewUsersService

func NewUsersService(s *Service) *UsersService

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL