Shopify SDK for Unity
Public Member Functions | List of all members
Shopify.Unity.GraphQL.ImageQuery Class Reference

Represents an image resource. More...

Public Member Functions

 ImageQuery (StringBuilder query)
 ImageQuery is used to build queries. Typically ImageQuery will not be used directly but instead will be used when building queries from either QueryRootQuery or MutationQuery. More...
 
ImageQuery altText ()
 A word or phrase to share the nature or contents of an image. More...
 
ImageQuery id ()
 A unique identifier for the image. More...
 
ImageQuery originalSrc ()
 The location of the original image as a URL. More...
 
ImageQuery src ()
 The location of the image as a URL. More...
 
ImageQuery transformedSrc (long? maxWidth=null, long? maxHeight=null, CropRegion? crop=null, long? scale=null, ImageContentType? preferredContentType=null, string alias=null)
 The location of the transformed image as a URL. More...
 

Detailed Description

Represents an image resource.

Constructor & Destructor Documentation

◆ ImageQuery()

Shopify.Unity.GraphQL.ImageQuery.ImageQuery ( StringBuilder  query)
inline

ImageQuery is used to build queries. Typically ImageQuery will not be used directly but instead will be used when building queries from either QueryRootQuery or MutationQuery.

Member Function Documentation

◆ altText()

ImageQuery Shopify.Unity.GraphQL.ImageQuery.altText ( )
inline

A word or phrase to share the nature or contents of an image.

◆ id()

ImageQuery Shopify.Unity.GraphQL.ImageQuery.id ( )
inline

A unique identifier for the image.

◆ originalSrc()

ImageQuery Shopify.Unity.GraphQL.ImageQuery.originalSrc ( )
inline

The location of the original image as a URL.

If there are any existing transformations in the original source URL, they will remain and not be stripped.

◆ src()

ImageQuery Shopify.Unity.GraphQL.ImageQuery.src ( )
inline

The location of the image as a URL.

Deprecated:
Previously an image had a single src field. This could either return the original image location or a URL that contained transformations such as sizing or scale.

These transformations were specified by arguments on the parent field.

Now an image has two distinct URL fields: originalSrc and transformedSrc.

  • originalSrc - the original unmodified image URL
  • transformedSrc - the image URL with the specified transformations included

To migrate to the new fields, image transformations should be moved from the parent field to transformedSrc.

Before:

{
shop {
productImages(maxWidth: 200, scale: 2) {
edges {
node {
src
}
}
}
}
}

After:

{
shop {
productImages {
edges {
node {
transformedSrc(maxWidth: 200, scale: 2)
}
}
}
}
}

◆ transformedSrc()

ImageQuery Shopify.Unity.GraphQL.ImageQuery.transformedSrc ( long?  maxWidth = null,
long?  maxHeight = null,
CropRegion crop = null,
long?  scale = null,
ImageContentType preferredContentType = null,
string  alias = null 
)
inline

The location of the transformed image as a URL.

All transformation arguments are considered "best-effort". If they can be applied to an image, they will be. Otherwise any transformations which an image type does not support will be ignored.

Parameters
maxWidthImage width in pixels between 1 and 5760.
maxHeightImage height in pixels between 1 and 5760.
cropCrops the image according to the specified region.
scaleImage size multiplier for high-resolution retina displays. Must be between 1 and 3.
preferredContentTypeBest effort conversion of image into content type (SVG -> PNG, Anything -> JGP, Anything -> WEBP are supported).

The documentation for this class was generated from the following file: