Shopify Product Image

This page documents the Shopify Product Image model.

Data Shape

Gadget's database stores Shopify Product Image records by storing and retrieving each of the fields defined on the model in the Gadget Editor to a managed database. Gadget has generated a GraphQL type matching the configured fields for Shopify Product Image:

Shopify Product Image Schema
1export interface ShopifyProductImage {
2 __typename: "ShopifyProductImage";
3
4 /** The globally unique, unchanging identifier for this record. Assigned and managed by Gadget. */
5 id: Scalars["GadgetID"];
6
7 /** The time at which this record was first created. Set once upon record creation and never changed. Managed by Gadget. */
8 createdAt: Scalars["DateTime"];
9
10 /** The time at which this record was last changed. Set each time the record is successfully acted upon by an action. Managed by Gadget. */
11 updatedAt: Scalars["DateTime"];
12
13 /** The current state this record is in. Changed by invoking actions. Managed by Gadget. */
14 state: Scalars["RecordState"];
15
16 height: Scalars["Float"] | null;
17
18 position: Scalars["Float"] | null;
19
20 product: ShopifyProduct | null;
21
22 productId: Scalars["GadgetID"] | null;
23
24 shopifyCreatedAt: Scalars["DateTime"] | null;
25
26 source: Scalars["String"] | null;
27
28 shopifyUpdatedAt: Scalars["DateTime"] | null;
29
30 variants: ShopifyProductVariantConnection;
31
32 width: Scalars["Float"] | null;
33
34 shop: ShopifyShop | null;
35
36 shopId: Scalars["GadgetID"] | null;
37
38 /** Get all the fields for this record. Useful for not having to list out all the fields you want to retrieve, but slower. */
39 _all: Scalars["JSONObject"];
40}
1type ShopifyProductImage {
2 """
3 The globally unique, unchanging identifier for this record. Assigned and managed by Gadget.
4 """
5 id: GadgetID!
6
7 """
8 The time at which this record was first created. Set once upon record creation and never changed. Managed by Gadget.
9 """
10 createdAt: DateTime!
11
12 """
13 The time at which this record was last changed. Set each time the record is successfully acted upon by an action. Managed by Gadget.
14 """
15 updatedAt: DateTime!
16
17 """
18 The current state this record is in. Changed by invoking actions. Managed by Gadget.
19 """
20 state: RecordState!
21 height: Float
22 position: Float
23 product: ShopifyProduct
24 productId: GadgetID
25 shopifyCreatedAt: DateTime
26 source: String
27 shopifyUpdatedAt: DateTime
28 variants(
29 """
30 Returns the items in the list that come after the specified cursor.
31 """
32 after: String
33
34 """
35 Returns the first n items from the list.
36 """
37 first: Int
38
39 """
40 Returns the items in the list that come before the specified cursor.
41 """
42 before: String
43
44 """
45 Returns the last n items from the list.
46 """
47 last: Int
48
49 """
50 A list of sort orders to return the results in
51 """
52 sort: [ShopifyProductVariantSort!]
53
54 """
55 A list of filters to refine the results by
56 """
57 filter: [ShopifyProductVariantFilter!]
58
59 """
60 A free form text search query to find records matching
61 """
62 search: String
63 ): ShopifyProductVariantConnection!
64 width: Float
65 shop: ShopifyShop
66 shopId: GadgetID
67
68 """
69 Get all the fields for this record. Useful for not having to list out all the fields you want to retrieve, but slower.
70 """
71 _all: JSONObject!
72}

You can preview what a real record's shape looks like by fetching it using the alida-quiz-app-2 API Playground.

Any fetched Shopify Product Image record will have this same ShopifyProductImage type, and expose the same data by default, regardless of if it's fetched by ID or as part of a findMany. This means you can select any of the record's fields wherever you like in a GraphQL query according to the use case at hand.

Retrieving one Shopify Product Image record

Individual Shopify Product Image records can be retrieved using the "find by ID" API endpoint. You can also return only some fields, or extra fields beyond what Gadget retrieves by default, using the select option.

The findOne function throws an error if no matching record is found, which you will need to catch and handle. Alternatively, you can use the maybeFindOne function, which returns null if no record is found, without throwing an error.

Similarly, the useFindOne React hook returns (but does not throw) an error when no matching record is found, while the useMaybeFindOne hook simply returns null if no record is found, without also returning an error.

Get one Shopify Product Image
const shopifyProductImageRecord = await api.shopifyProductImage.findOne("some-id");
console.log(shopifyProductImageRecord.id); //=> a string
console.log(shopifyProductImageRecord.createdAt); //=> a Date object
const [result, refresh] = useFindOne(api.shopifyProductImage, "some-id");
const { data, error, fetching } = result;
console.log(data?.id); //=> a string
console.log(data?.createdAt); //=> a Date object
1query GetOneShopifyProductImage($id: GadgetID!) {
2 shopifyProductImage(id: $id) {
3 __typename
4 id
5 state
6 createdAt
7 height
8 position
9 product {
10 id
11 state
12 body
13 createdAt
14 handle
15 productType
16 publishedAt
17 publishedScope
18 shop {
19 id
20 state
21 accessToken
22 address1
23 address2
24 checkoutApiSupported
25 city
26 cookieConsentLevel
27 country
28 countryCode
29 countryName
30 countyTaxes
31 createdAt
32 currency
33 customerEmail
34 domain
35 eligibleForCardReaderGiveaway
36 eligibleForPayments
37 email
38 enabledPresentmentCurrencies
39 finances
40 forceSsl
41 googleAppsDomain
42 googleAppsLoginEnabled
43 grantedScopes
44 hasDiscounts
45 hasGiftCards
46 hasStorefront
47 ianaTimezone
48 installedViaApiKey
49 latitude
50 longitude
51 moneyFormat
52 moneyInEmailsFormat
53 moneyWithCurrencyFormat
54 moneyWithCurrencyInEmailsFormat
55 multiLocationEnabled
56 myshopifyDomain
57 name
58 passwordEnabled
59 phone
60 planDisplayName
61 planName
62 preLaunchEnabled
63 primaryLocale
64 province
65 provinceCode
66 registeredWebhooks
67 requiresExtraPaymentsAgreement
68 setupRequired
69 shopOwner
70 shopifyCreatedAt
71 shopifyUpdatedAt
72 source
73 taxShipping
74 taxesIncluded
75 timezone
76 updatedAt
77 weightUnit
78 zipCode
79 }
80 shopifyCreatedAt
81 shopifyUpdatedAt
82 tags
83 templateSuffix
84 title
85 updatedAt
86 vendor
87 }
88 shop {
89 id
90 state
91 accessToken
92 address1
93 address2
94 checkoutApiSupported
95 city
96 cookieConsentLevel
97 country
98 countryCode
99 countryName
100 countyTaxes
101 createdAt
102 currency
103 customerEmail
104 domain
105 eligibleForCardReaderGiveaway
106 eligibleForPayments
107 email
108 enabledPresentmentCurrencies
109 finances
110 forceSsl
111 googleAppsDomain
112 googleAppsLoginEnabled
113 grantedScopes
114 hasDiscounts
115 hasGiftCards
116 hasStorefront
117 ianaTimezone
118 installedViaApiKey
119 latitude
120 longitude
121 moneyFormat
122 moneyInEmailsFormat
123 moneyWithCurrencyFormat
124 moneyWithCurrencyInEmailsFormat
125 multiLocationEnabled
126 myshopifyDomain
127 name
128 passwordEnabled
129 phone
130 planDisplayName
131 planName
132 preLaunchEnabled
133 primaryLocale
134 province
135 provinceCode
136 registeredWebhooks
137 requiresExtraPaymentsAgreement
138 setupRequired
139 shopOwner
140 shopifyCreatedAt
141 shopifyUpdatedAt
142 source
143 taxShipping
144 taxesIncluded
145 timezone
146 updatedAt
147 weightUnit
148 zipCode
149 }
150 shopifyCreatedAt
151 shopifyUpdatedAt
152 source
153 updatedAt
154 variants {
155 edges {
156 node {
157 id
158 state
159 barcode
160 compareAtPrice
161 createdAt
162 fulfillmentService
163 grams
164 inventoryManagement
165 inventoryPolicy
166 inventoryQuantity
167 inventoryQuantityAdjustment
168 oldInventoryQuantity
169 option1
170 option2
171 option3
172 position
173 presentmentPrices
174 price
175 product {
176 id
177 state
178 body
179 createdAt
180 handle
181 productType
182 publishedAt
183 publishedScope
184 shopifyCreatedAt
185 shopifyUpdatedAt
186 tags
187 templateSuffix
188 title
189 updatedAt
190 vendor
191 }
192 productImage {
193 id
194 state
195 createdAt
196 height
197 position
198 shopifyCreatedAt
199 shopifyUpdatedAt
200 source
201 updatedAt
202 width
203 }
204 requiresShipping
205 shop {
206 id
207 state
208 accessToken
209 address1
210 address2
211 checkoutApiSupported
212 city
213 cookieConsentLevel
214 country
215 countryCode
216 countryName
217 countyTaxes
218 createdAt
219 currency
220 customerEmail
221 domain
222 eligibleForCardReaderGiveaway
223 eligibleForPayments
224 email
225 enabledPresentmentCurrencies
226 finances
227 forceSsl
228 googleAppsDomain
229 googleAppsLoginEnabled
230 grantedScopes
231 hasDiscounts
232 hasGiftCards
233 hasStorefront
234 ianaTimezone
235 installedViaApiKey
236 latitude
237 longitude
238 moneyFormat
239 moneyInEmailsFormat
240 moneyWithCurrencyFormat
241 moneyWithCurrencyInEmailsFormat
242 multiLocationEnabled
243 myshopifyDomain
244 name
245 passwordEnabled
246 phone
247 planDisplayName
248 planName
249 preLaunchEnabled
250 primaryLocale
251 province
252 provinceCode
253 registeredWebhooks
254 requiresExtraPaymentsAgreement
255 setupRequired
256 shopOwner
257 shopifyCreatedAt
258 shopifyUpdatedAt
259 source
260 taxShipping
261 taxesIncluded
262 timezone
263 updatedAt
264 weightUnit
265 zipCode
266 }
267 shopifyCreatedAt
268 shopifyUpdatedAt
269 sku
270 taxCode
271 taxable
272 title
273 updatedAt
274 weight
275 weightUnit
276 }
277 }
278 }
279 width
280 }
281}
Variables
json
{
"id": "some-id"
}

Retrieving the first of many Shopify Product Image records

The first record from a list of records can be retrieved using the "find first" API endpoint. The source list of records can be filtered using the filter option, sorted using the sort option, searched using the search option, though no pagination options are available on this endpoint. You can also return only some fields, or extra fields beyond what Gadget retrieves by default using the select option.

The findFirst function throws an error if no matching record is found, which you will need to catch and handle. Alternatively, you can use the maybeFindFirst function, which returns null if no record is found, without throwing an error.

Similarly, the useFindFirst React hook returns (but does not throw) an error when no matching record is found, while the useMaybeFindFirst hook simply returns null if no record is found, without also returning an error.

Get one Shopify Product Image
const shopifyProductImageRecord = await api.shopifyProductImage.findFirst();
console.log(shopifyProductImageRecord.id); //=> a string
console.log(shopifyProductImageRecord.createdAt); //=> a Date object
const [result, refresh] = useFindFirst(api.shopifyProductImage);
const { data, error, fetching } = result;
console.log(data?.id); //=> a string
console.log(data?.createdAt); //=> a Date object
1query FindManyShopifyProductImages(
2 $first: Int
3 $search: String
4 $sort: [ShopifyProductImageSort!]
5 $filter: [ShopifyProductImageFilter!]
6) {
7 shopifyProductImages(
8 first: $first
9 search: $search
10 sort: $sort
11 filter: $filter
12 ) {
13 edges {
14 node {
15 __typename
16 id
17 state
18 createdAt
19 height
20 position
21 product {
22 id
23 state
24 body
25 createdAt
26 handle
27 productType
28 publishedAt
29 publishedScope
30 shop {
31 id
32 state
33 accessToken
34 address1
35 address2
36 checkoutApiSupported
37 city
38 cookieConsentLevel
39 country
40 countryCode
41 countryName
42 countyTaxes
43 createdAt
44 currency
45 customerEmail
46 domain
47 eligibleForCardReaderGiveaway
48 eligibleForPayments
49 email
50 enabledPresentmentCurrencies
51 finances
52 forceSsl
53 googleAppsDomain
54 googleAppsLoginEnabled
55 grantedScopes
56 hasDiscounts
57 hasGiftCards
58 hasStorefront
59 ianaTimezone
60 installedViaApiKey
61 latitude
62 longitude
63 moneyFormat
64 moneyInEmailsFormat
65 moneyWithCurrencyFormat
66 moneyWithCurrencyInEmailsFormat
67 multiLocationEnabled
68 myshopifyDomain
69 name
70 passwordEnabled
71 phone
72 planDisplayName
73 planName
74 preLaunchEnabled
75 primaryLocale
76 province
77 provinceCode
78 registeredWebhooks
79 requiresExtraPaymentsAgreement
80 setupRequired
81 shopOwner
82 shopifyCreatedAt
83 shopifyUpdatedAt
84 source
85 taxShipping
86 taxesIncluded
87 timezone
88 updatedAt
89 weightUnit
90 zipCode
91 }
92 shopifyCreatedAt
93 shopifyUpdatedAt
94 tags
95 templateSuffix
96 title
97 updatedAt
98 vendor
99 }
100 shop {
101 id
102 state
103 accessToken
104 address1
105 address2
106 checkoutApiSupported
107 city
108 cookieConsentLevel
109 country
110 countryCode
111 countryName
112 countyTaxes
113 createdAt
114 currency
115 customerEmail
116 domain
117 eligibleForCardReaderGiveaway
118 eligibleForPayments
119 email
120 enabledPresentmentCurrencies
121 finances
122 forceSsl
123 googleAppsDomain
124 googleAppsLoginEnabled
125 grantedScopes
126 hasDiscounts
127 hasGiftCards
128 hasStorefront
129 ianaTimezone
130 installedViaApiKey
131 latitude
132 longitude
133 moneyFormat
134 moneyInEmailsFormat
135 moneyWithCurrencyFormat
136 moneyWithCurrencyInEmailsFormat
137 multiLocationEnabled
138 myshopifyDomain
139 name
140 passwordEnabled
141 phone
142 planDisplayName
143 planName
144 preLaunchEnabled
145 primaryLocale
146 province
147 provinceCode
148 registeredWebhooks
149 requiresExtraPaymentsAgreement
150 setupRequired
151 shopOwner
152 shopifyCreatedAt
153 shopifyUpdatedAt
154 source
155 taxShipping
156 taxesIncluded
157 timezone
158 updatedAt
159 weightUnit
160 zipCode
161 }
162 shopifyCreatedAt
163 shopifyUpdatedAt
164 source
165 updatedAt
166 variants {
167 edges {
168 node {
169 id
170 state
171 barcode
172 compareAtPrice
173 createdAt
174 fulfillmentService
175 grams
176 inventoryManagement
177 inventoryPolicy
178 inventoryQuantity
179 inventoryQuantityAdjustment
180 oldInventoryQuantity
181 option1
182 option2
183 option3
184 position
185 presentmentPrices
186 price
187 product {
188 id
189 state
190 body
191 createdAt
192 handle
193 productType
194 publishedAt
195 publishedScope
196 shopifyCreatedAt
197 shopifyUpdatedAt
198 tags
199 templateSuffix
200 title
201 updatedAt
202 vendor
203 }
204 productImage {
205 id
206 state
207 createdAt
208 height
209 position
210 shopifyCreatedAt
211 shopifyUpdatedAt
212 source
213 updatedAt
214 width
215 }
216 requiresShipping
217 shop {
218 id
219 state
220 accessToken
221 address1
222 address2
223 checkoutApiSupported
224 city
225 cookieConsentLevel
226 country
227 countryCode
228 countryName
229 countyTaxes
230 createdAt
231 currency
232 customerEmail
233 domain
234 eligibleForCardReaderGiveaway
235 eligibleForPayments
236 email
237 enabledPresentmentCurrencies
238 finances
239 forceSsl
240 googleAppsDomain
241 googleAppsLoginEnabled
242 grantedScopes
243 hasDiscounts
244 hasGiftCards
245 hasStorefront
246 ianaTimezone
247 installedViaApiKey
248 latitude
249 longitude
250 moneyFormat
251 moneyInEmailsFormat
252 moneyWithCurrencyFormat
253 moneyWithCurrencyInEmailsFormat
254 multiLocationEnabled
255 myshopifyDomain
256 name
257 passwordEnabled
258 phone
259 planDisplayName
260 planName
261 preLaunchEnabled
262 primaryLocale
263 province
264 provinceCode
265 registeredWebhooks
266 requiresExtraPaymentsAgreement
267 setupRequired
268 shopOwner
269 shopifyCreatedAt
270 shopifyUpdatedAt
271 source
272 taxShipping
273 taxesIncluded
274 timezone
275 updatedAt
276 weightUnit
277 zipCode
278 }
279 shopifyCreatedAt
280 shopifyUpdatedAt
281 sku
282 taxCode
283 taxable
284 title
285 updatedAt
286 weight
287 weightUnit
288 }
289 }
290 }
291 width
292 }
293 }
294 }
295}
Variables
json
{
"first": 1
}

Retrieving many Shopify Product Image records

Pages of Shopify Product Image records can be retrieved by using the "find many" API endpoint. The returned records can be filtered using the filter option, sorted using the sort option, searched using the search option, and paginated using standard Relay-style pagination options. You can also return only some fields, or extra fields beyond what Gadget retrieves by default using the select option.

This GraphQL endpoint returns records in the Relay Connection style (as a list of edges with nodes and cursors) so they can be paginated. The shopifyProductImages GraphQL endpoint works with any Relay-compatible caching client, or you can use Gadget's JS client for pagination with the findMany function.

Find a page of Shopify Product Images

Fetch a page of records with the shopifyProductImage.findMany JS method or the shopifyProductImages GraphQL field. No options are required. The records returned will be implicitly sorted by ID ascending.

Find many Shopify Product Images
const shopifyProductImageRecords = await api.shopifyProductImage.findMany();
console.log(shopifyProductImageRecords.length); //=> a number
console.log(shopifyProductImageRecords[0].id); //=> a string
const [result, refresh] = useFindMany(api.shopifyProductImage);
const { data, error, fetching } = result;
console.log(data?.length); //=> a number
console.log(data?.[0].length); //=> a string
1query FindManyShopifyProductImages {
2 shopifyProductImages {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
{}

Sorting

Records can be sorted in the database to retrieve them in a certain order. Records are always implicitly sorted by ID ascending unless an explicit sort on the id field is defined. The GraphQL type ShopifyProductImageSort defines which fields can be sorted by.

Records can be sorted by multiple different fields and in multiple different directions by passing a list of ShopifyProductImageSort instead of just one.

GraphQL
1input ShopifyProductImageSort {
2 id: SortOrder
3 createdAt: SortOrder
4 updatedAt: SortOrder
5 state: SortOrder
6 height: SortOrder
7 position: SortOrder
8 shopifyCreatedAt: SortOrder
9 source: SortOrder
10 shopifyUpdatedAt: SortOrder
11 width: SortOrder
12}

Pass the sort option to the JS client, or the sort variable to a GraphQL query to sort the records returned.

Sort Shopify Product Image by most recently created
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
sort: { createdAt: "Descending" },
});
const [result, refresh] = useFindMany(api.shopifyProductImage, {
sort: { createdAt: "Descending" },
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($sort: [ShopifyProductImageSort!]) {
2 shopifyProductImages(sort: $sort) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
{
"sort": {
"createdAt": "Descending"
}
}

Sort by multiple fields by passing an array of { [field]: "Ascending" | "Descending" } objects.

Sort Shopify Product Image by multiple fields
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
sort: [{ state: "Descending" }, { createdAt: "Ascending" }],
});
const [result, refresh] = useFindMany(api.shopifyProductImage, {
sort: [{ state: "Descending" }, { createdAt: "Ascending" }],
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($sort: [ShopifyProductImageSort!]) {
2 shopifyProductImages(sort: $sort) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
1{
2 "sort": [
3 {
4 "state": "Descending"
5 },
6 {
7 "createdAt": "Ascending"
8 }
9 ]
10}

All primitive field types in Gadget are sortable so you are able to sort by fields you have added to a model as well.

Sort Shopify Product Images by ID descending
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
sort: { id: "Descending" },
});
const [result, refresh] = useFindMany(api.shopifyProductImage, {
sort: { id: "Descending" },
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($sort: [ShopifyProductImageSort!]) {
2 shopifyProductImages(sort: $sort) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
{
"sort": {
"id": "Descending"
}
}

Searching

Shopify Product Image records can be searched using Gadget's built in full text search functionality. Gadget search is appropriate for powering autocompletes, searchable tables, or other experiences where humans are writing search queries. It's typo tolerant, synonym aware and supports simple search operators like ! to exclude search terms.

Search Shopify Product Images by passing the search parameter with a search query string.

Search isn't field specific in Gadget -- all String or RichText field types are searched with the built in search functionality.

Full text search Shopify Product Images
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
search: "a specific phrase to search for",
});
const [result, refresh] = useFindMany(api.shopifyProductImage, {
search: "a specific phrase to search for",
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($search: String) {
2 shopifyProductImages(search: $search) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
{
"search": "a specific phrase to search for"
}

Filtering

Shopify Product Image records can be filtered to return only the appropriate records. Records can be filtered on any field, including those managed by Gadget or fields added by developers. Filters can be combined with sorts, searches and paginated using cursor based Relay pagination.

Filter Shopify Product Images by passing the filter parameter with a filter object. Filter objects are nestable boolean conditions expressed as JS objects capturing a key, an operator, and usually a value.

The GraphQL type ShopifyProductImageFilter defines which fields can be filtered on.

Records can be filtered by multiple different fields. If you want to combine filters using boolean logic, nest them under the AND, OR, or NOT keys of a parent filter. Filters can be nested deeply by passing multiple levels boolean condition filters.

You can also pass a list of filters to the filter parameter which will be implicitly ANDed with one another such that they all need to match for a record to be returned.

Available filters
GraphQL
1input ShopifyProductImageFilter {
2 AND: [ShopifyProductImageFilter]
3 OR: [ShopifyProductImageFilter]
4 NOT: [ShopifyProductImageFilter]
5 id: IDFilter
6 createdAt: DateTimeFilter
7 updatedAt: DateTimeFilter
8 state: StateFilter
9 height: FloatFilter
10 position: FloatFilter
11 product: IDFilter
12 shopifyCreatedAt: DateTimeFilter
13 source: StringFilter
14 shopifyUpdatedAt: DateTimeFilter
15 width: FloatFilter
16 shop: IDFilter
17}
Find Shopify Product Images created in the last day
const yesterday = new Date(Date.now() - 864e5);
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
filter: { createdAt: { greaterThan: yesterday } },
});
const yesterday = new Date(Date.now() - 864e5);
const [result, refresh] = useFindMany(api.shopifyProductImage, {
filter: { createdAt: { greaterThan: yesterday } },
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($filter: [ShopifyProductImageFilter!]) {
2 shopifyProductImages(filter: $filter) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
1{
2 "filter": {
3 "createdAt": {
4 "greaterThan": "2022-10-03T06:22:23.367Z"
5 }
6 }
7}
Shopify Product Images created this week or updated today
1const yesterday = new Date(Date.now() - 86400000);
2const oneWeekAgo = new Date(Date.now() - 604800000);
3const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
4 filter: {
5 OR: [
6 {
7 createdAt: { greaterThan: oneWeekAgo },
8 },
9 {
10 updated: { greaterThan: yesterday },
11 },
12 ],
13 },
14});
1const yesterday = new Date(Date.now() - 86400000);
2const oneWeekAgo = new Date(Date.now() - 604800000);
3const [result, refresh] = useFindMany(api.shopifyProductImage, {
4 filter: {
5 OR: [
6 {
7 createdAt: { greaterThan: oneWeekAgo },
8 },
9 {
10 updated: { greaterThan: yesterday },
11 },
12 ],
13 },
14});
15const { data, error, fetching } = result;
1query FindManyShopifyProductImages($filter: [ShopifyProductImageFilter!]) {
2 shopifyProductImages(filter: $filter) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
1{
2 "filter": {
3 "OR": [
4 {
5 "createdAt": {
6 "greaterThan": "2022-09-27T06:22:23.367Z"
7 }
8 },
9 {
10 "updated": {
11 "greaterThan": "2022-10-03T06:22:23.367Z"
12 }
13 }
14 ]
15 }
16}
Filter records that are in the created state
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
filter: {
state: { inState: "created" },
},
});
1const [result, refresh] = useFindMany(api.shopifyProductImage, {
2 filter: {
3 state: { inState: "created" },
4 },
5});
6const { data, error, fetching } = result;
1query FindManyShopifyProductImages($filter: [ShopifyProductImageFilter!]) {
2 shopifyProductImages(filter: $filter) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
1{
2 "filter": {
3 "state": {
4 "inState": "created"
5 }
6 }
7}

Most field types in Gadget are filterable, so you are able to filter by fields you have added to a model as well.

const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
filter: {
id: { isSet: true },
},
});
1const [result, refresh] = useFindMany(api.shopifyProductImage, {
2 filter: {
3 id: { isSet: true },
4 },
5});
6const { data, error, fetching } = result;
1query FindManyShopifyProductImages($filter: [ShopifyProductImageFilter!]) {
2 shopifyProductImages(filter: $filter) {
3 edges {
4 node {
5 __typename
6 id
7 state
8 # ...
9 createdAt
10 updatedAt
11 }
12 }
13 }
14}
Variables
json
1{
2 "filter": {
3 "id": {
4 "isSet": true
5 }
6 }
7}

Pagination

All Gadget record lists, including the top level Shopify Product Image finder as well as associations to Shopify Product Image, are structured as GraphQL connections. GraphQL connections are the defacto standard for querying lists and support cursor based forward and backward pagination. When querying via GraphQL, you must select the edges field and then the node field to get the Shopify Product Image record. When querying using a Gadget API client, the GraphQL queries are generated for you and the records are unwrapped and returned as a GadgetRecordList ready for use.

Shopify Product Image pagination supports the standard GraphQL connection pagination arguments: first + after, or last + before. Pagination is done using cursors, which you can retrieve from the edge.cursor field or the pageInfo.startCursor properties.

Get the first page of 25 Shopify Product Images
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
first: 25,
});
console.log(shopifyProductImageRecords.length); //=> no greater than 25
const [result, refresh] = useFindMany(api.shopifyProductImage, { first: 25 });
const { data, error, fetching } = result;
console.log(data?.length); //=> no greater than 25
1query FindManyShopifyProductImages($first: Int, $after: String) {
2 shopifyProductImages(first: $first, after: $after) {
3 edges {
4 cursor
5 node {
6 __typename
7 id
8 state
9 # ...
10 createdAt
11 updatedAt
12 }
13 }
14 pageInfo {
15 endCursor
16 hasNextPage
17 hasPreviousPage
18 startCursor
19 }
20 }
21}
Variables
json
{
"first": 25
}

The after cursor used in this example data won't return any records if used in a real API request.

Next 25 Shopify Product Image records after cursor
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
after: "abcdefg",
first: 25,
});
const [result, refresh] = useFindMany(api.shopifyProductImage, {
after: "abcdefg",
first: 25,
});
const { data, error, fetching } = result;
1query FindManyShopifyProductImages($first: Int, $after: String) {
2 shopifyProductImages(first: $first, after: $after) {
3 edges {
4 cursor
5 node {
6 __typename
7 id
8 state
9 # ...
10 createdAt
11 updatedAt
12 }
13 }
14 pageInfo {
15 endCursor
16 hasNextPage
17 hasPreviousPage
18 startCursor
19 }
20 }
21}
Variables
json
{
"first": 25,
"after": "abcdefg"
}

Pagination Limits

Root level record finders like shopifyProductImages support a maximum page size of 250 records, and a default page size of 50 records. The page size is controlled using the first or last GraphQL field arguments.

Related record finders that access lists of records through a HasMany or HasManyThrough field support a maximum page size of 100 records, and a default page size of 50 records.

Get the next or previous page

When using the generated JavaScript API client, the record lists returned from find many calls can be paginated using the nextPage() or previousPage() option.

Both nextPage() and previousPage() will throw an error if the corresponding hasNextPage or hasPreviousPage is false.

JavaScript
1const shopifyProductImageRecords =
2 await api.shopifyProductImage.findMany();
3if (
4 shopifyProductImageRecords.hasNextPage
5) {
6 const nextPage =
7 await shopifyProductImageRecords.nextPage();
8}
9if (
10 shopifyProductImageRecords.hasPreviousPage
11) {
12 const prevPage =
13 await shopifyProductImageRecords.previousPage();
14}

Selecting fields, and fields of fields

When using the JavaScript client, all of findOne, maybeFindOne, findMany, findFirst, maybeFindFirst, and various action functions, allow requesting specific fields of a Shopify Product Image and its relationships. The select option controls which fields are selected in the generated GraphQL query sent to the Gadget API. Pass each field you want to select in an object, with true as the value for scalar fields, and a nested object of the same shape for nested fields.

Gadget has a default selection that will retrieve all of the scalar fields for a Shopify Product Image, as well as concise representations of each of the relationships containing an id and an automatically inferred title field. If you don't pass a select option to a record finder, this default selection will be used.

Select only some Shopify Product Image fields
// fetch only the id, state, and createdAt field
const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
select: { id: true, state: true, createdAt: true },
});
// fetch only the id, state, and createdAt field
const [result, refresh] = useFindMany(api.shopifyProductImage, {
select: { id: true, state: true, createdAt: true },
});
const { data, error, fetching } = result;
Type Safety

The select option is fully type safe if you're using TypeScript. The returned GadgetRecord type will have a <Shape> exactly matching the fields and nested fields you selected. For more information, see Type Safety .

This behavior of selecting only some fields is built right into GraphQL. If you want to limit or expand what you retrieve from a GraphQL query, include or exclude those fields in your GraphQL query. For more information on executing GraphQL queries, see GraphQL.

Select nested Shopify Product Image fields
1// fetch the id, state, and createdAt field, and fetch some nested fields from an example relationship field named `someRelatedObject`
2const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
3 select: {
4 id: true,
5 state: true,
6 createdAt: true,
7 someRelatedObject: { id: true, createdAt: true },
8 },
9});
1// fetch the id, state, and createdAt field, and fetch some nested fields from an example relationship field named `someRelatedObject`
2const [result, refresh] = useFindMany(api.shopifyProductImage, {
3 select: {
4 id: true,
5 state: true,
6 createdAt: true,
7 someRelatedObject: { id: true, createdAt: true },
8 },
9});
10const { data, error, fetching } = result;

Combining parameters

Sort, search, filtering, selection, and pagination parameters can be combined to access the exact set of records needed for your use case.

Combining Parameters
1const shopifyProductImageRecords = await api.shopifyProductImage.findMany({
2 search: "<some search query>",
3 sort: { createdAt: "Descending" },
4 filter: { updatedAt: { greaterThan: new Date(Date.now() - 864e5) } },
5 select: { id: true, createdAt: true },
6 first: 25,
7 after: "abcdefg",
8});
1const [result, refresh] = useFindMany(api.shopifyProductImage, {
2 search: "<some search query>",
3 sort: { createdAt: "Descending" },
4 filter: { updatedAt: { greaterThan: new Date(Date.now() - 864e5) } },
5 select: { id: true, createdAt: true },
6 first: 25,
7 after: "abcdefg",
8});
9const { data, error, fetching } = result;
1query FindManyShopifyProductImages(
2 $after: String
3 $before: String
4 $first: Int
5 $last: Int
6 $search: String
7 $sort: [ShopifyProductImageSort!]
8 $filter: [ShopifyProductImageFilter!]
9) {
10 shopifyProductImages(
11 after: $after
12 before: $before
13 first: $first
14 last: $last
15 search: $search
16 sort: $sort
17 filter: $filter
18 ) {
19 edges {
20 cursor
21 node {
22 __typename
23 id
24 state
25 createdAt
26 height
27 position
28 product {
29 id
30 state
31 body
32 createdAt
33 handle
34 productType
35 publishedAt
36 publishedScope
37 shop {
38 id
39 state
40 accessToken
41 address1
42 address2
43 checkoutApiSupported
44 city
45 cookieConsentLevel
46 country
47 countryCode
48 countryName
49 countyTaxes
50 createdAt
51 currency
52 customerEmail
53 domain
54 eligibleForCardReaderGiveaway
55 eligibleForPayments
56 email
57 enabledPresentmentCurrencies
58 finances
59 forceSsl
60 googleAppsDomain
61 googleAppsLoginEnabled
62 grantedScopes
63 hasDiscounts
64 hasGiftCards
65 hasStorefront
66 ianaTimezone
67 installedViaApiKey
68 latitude
69 longitude
70 moneyFormat
71 moneyInEmailsFormat
72 moneyWithCurrencyFormat
73 moneyWithCurrencyInEmailsFormat
74 multiLocationEnabled
75 myshopifyDomain
76 name
77 passwordEnabled
78 phone
79 planDisplayName
80 planName
81 preLaunchEnabled
82 primaryLocale
83 province
84 provinceCode
85 registeredWebhooks
86 requiresExtraPaymentsAgreement
87 setupRequired
88 shopOwner
89 shopifyCreatedAt
90 shopifyUpdatedAt
91 source
92 taxShipping
93 taxesIncluded
94 timezone
95 updatedAt
96 weightUnit
97 zipCode
98 }
99 shopifyCreatedAt
100 shopifyUpdatedAt
101 tags
102 templateSuffix
103 title
104 updatedAt
105 vendor
106 }
107 shop {
108 id
109 state
110 accessToken
111 address1
112 address2
113 checkoutApiSupported
114 city
115 cookieConsentLevel
116 country
117 countryCode
118 countryName
119 countyTaxes
120 createdAt
121 currency
122 customerEmail
123 domain
124 eligibleForCardReaderGiveaway
125 eligibleForPayments
126 email
127 enabledPresentmentCurrencies
128 finances
129 forceSsl
130 googleAppsDomain
131 googleAppsLoginEnabled
132 grantedScopes
133 hasDiscounts
134 hasGiftCards
135 hasStorefront
136 ianaTimezone
137 installedViaApiKey
138 latitude
139 longitude
140 moneyFormat
141 moneyInEmailsFormat
142 moneyWithCurrencyFormat
143 moneyWithCurrencyInEmailsFormat
144 multiLocationEnabled
145 myshopifyDomain
146 name
147 passwordEnabled
148 phone
149 planDisplayName
150 planName
151 preLaunchEnabled
152 primaryLocale
153 province
154 provinceCode
155 registeredWebhooks
156 requiresExtraPaymentsAgreement
157 setupRequired
158 shopOwner
159 shopifyCreatedAt
160 shopifyUpdatedAt
161 source
162 taxShipping
163 taxesIncluded
164 timezone
165 updatedAt
166 weightUnit
167 zipCode
168 }
169 shopifyCreatedAt
170 shopifyUpdatedAt
171 source
172 updatedAt
173 variants {
174 edges {
175 node {
176 id
177 state
178 barcode
179 compareAtPrice
180 createdAt
181 fulfillmentService
182 grams
183 inventoryManagement
184 inventoryPolicy
185 inventoryQuantity
186 inventoryQuantityAdjustment
187 oldInventoryQuantity
188 option1
189 option2
190 option3
191 position
192 presentmentPrices
193 price
194 product {
195 id
196 state
197 body
198 createdAt
199 handle
200 productType
201 publishedAt
202 publishedScope
203 shopifyCreatedAt
204 shopifyUpdatedAt
205 tags
206 templateSuffix
207 title
208 updatedAt
209 vendor
210 }
211 productImage {
212 id
213 state
214 createdAt
215 height
216 position
217 shopifyCreatedAt
218 shopifyUpdatedAt
219 source
220 updatedAt
221 width
222 }
223 requiresShipping
224 shop {
225 id
226 state
227 accessToken
228 address1
229 address2
230 checkoutApiSupported
231 city
232 cookieConsentLevel
233 country
234 countryCode
235 countryName
236 countyTaxes
237 createdAt
238 currency
239 customerEmail
240 domain
241 eligibleForCardReaderGiveaway
242 eligibleForPayments
243 email
244 enabledPresentmentCurrencies
245 finances
246 forceSsl
247 googleAppsDomain
248 googleAppsLoginEnabled
249 grantedScopes
250 hasDiscounts
251 hasGiftCards
252 hasStorefront
253 ianaTimezone
254 installedViaApiKey
255 latitude
256 longitude
257 moneyFormat
258 moneyInEmailsFormat
259 moneyWithCurrencyFormat
260 moneyWithCurrencyInEmailsFormat
261 multiLocationEnabled
262 myshopifyDomain
263 name
264 passwordEnabled
265 phone
266 planDisplayName
267 planName
268 preLaunchEnabled
269 primaryLocale
270 province
271 provinceCode
272 registeredWebhooks
273 requiresExtraPaymentsAgreement
274 setupRequired
275 shopOwner
276 shopifyCreatedAt
277 shopifyUpdatedAt
278 source
279 taxShipping
280 taxesIncluded
281 timezone
282 updatedAt
283 weightUnit
284 zipCode
285 }
286 shopifyCreatedAt
287 shopifyUpdatedAt
288 sku
289 taxCode
290 taxable
291 title
292 updatedAt
293 weight
294 weightUnit
295 }
296 }
297 }
298 width
299 }
300 }
301 pageInfo {
302 endCursor
303 hasNextPage
304 hasPreviousPage
305 startCursor
306 }
307 }
308}
Variables
json
1{
2 "search": "<some search query>",
3 "sort": {
4 "createdAt": "Descending"
5 },
6 "filter": {
7 "updatedAt": {
8 "greaterThan": "2022-10-03T06:22:23.485Z"
9 }
10 },
11 "first": 25,
12 "after": "abcdefg"
13}

Invoking Actions

Shopify Product Image records are changed by invoking Actions. Actions are the things that "do" stuff -- update records, make API calls, call backend code, etc. Actions each have one corresponding GraphQL mutation and a corresponding function available in the API client libraries. Nested Actions can also be invoked with the API client, by providing the actions as input to any relationship fields.

Action Result format

Each API action returns results in the same format that includes a success indicator, errors, and the actual result if the action succeeded. The result is the record that was acted on for a model action, or a list of records for a bulk action, or a JSON blob for Global Actions. Model actions that delete the record don't return the record.

The success field returns a boolean indicating if the action executed as expected. Any execution errors are returned in the errors object, which will always be null if success is true or contain ExecutionError objects if success is false.

ExecutionError objects always have a message describing what error prevented the action from succeeding, as well as a code attribute that gives a stable, searchable, human readable error class code for referencing this specific error. Details on each error code can be found in the Errors documentation. All ExecutionError object types returned by the GraphQL object can be one of many types of error, where some types have extra data that is useful for remedying the error. All error types will always have message and code properties, but some, like InvalidRecordError have extra fields for use by clients.

Errors when using the generated client

The generated JavaScript client automatically interprets errors from invoking actions and throws JavaScript Error instances if the action didn't succeed. The Error objects it throws are rich, and expose extra error properties beyond just message and code if they exist.

Errors thrown by the JavaScript client are easiest to catch by using a try/catch statement around an await, like so:

JavaScript
1import {
2 GadgetOperationError,
3 InvalidRecordError,
4} from "@gadget-client/example-app";
5
6// must be in an async function to use `await` syntax
7const runAction = async () => {
8 try {
9 return await api.exampleModel.create(
10 {
11 exampleModel: {
12 name: "example record name",
13 },
14 }
15 );
16 } catch (error) {
17 if (
18 error instanceof
19 GadgetOperationError
20 ) {
21 // a recognized general error has occurred, retry the operation or inspect error.code`
22 console.error(error);
23 } else if (
24 error instanceof
25 InvalidRecordError
26 ) {
27 // the submitted input data for the action was invalid, inspect the invalid fields which `InvalidRecordError` exposes
28 console.error(
29 error.validationErrors
30 );
31 } else {
32 // an unrecognized error occurred, like an HTTP connection interrupted error or a syntax error. Re-throw it because it's not clear what to do to fix ti
33 throw error;
34 }
35 }
36};

For more information on error codes, consult the Errors documentation.

Shopify Product Image Create

The Create action transitions a Shopify Product Image from Start to Created.

Input

Create accepts the following input parameters:

Create Input Data
1export interface CreateShopifyProductImageInput {
2 id?: (Scalars["GadgetID"] | null) | null;
3
4 height?: (Scalars["Float"] | null) | null;
5
6 position?: (Scalars["Float"] | null) | null;
7
8 product?: ShopifyProductBelongsToInput | null;
9
10 shopifyCreatedAt?: Date | Scalars["ISO8601DateString"] | null;
11
12 source?: (Scalars["String"] | null) | null;
13
14 shopifyUpdatedAt?: Date | Scalars["ISO8601DateString"] | null;
15
16 variants?: (ShopifyProductVariantHasManyInput | null)[];
17
18 width?: (Scalars["Float"] | null) | null;
19
20 shop?: ShopifyShopBelongsToInput | null;
21}
22
23export interface CreateShopifyProductImageArguments {
24 shopifyProductImage?: CreateShopifyProductImageInput | null;
25}
1input CreateShopifyProductImageInput {
2 id: GadgetID
3 height: Float
4 position: Float
5 product: ShopifyProductBelongsToInput
6 shopifyCreatedAt: DateTime
7 source: String
8 shopifyUpdatedAt: DateTime
9 variants: [ShopifyProductVariantHasManyInput]
10 width: Float
11 shop: ShopifyShopBelongsToInput
12}
13
14input CreateShopifyProductImageArguments {
15 shopifyProductImage: CreateShopifyProductImageInput
16}
Example Create Invocation
1const shopifyProductImageRecord = await api.shopifyProductImage.create({
2 shopifyProductImage: {
3 // field values for Shopify Product Image
4 },
5});
6console.log(shopifyProductImageRecord.id); //=> a string
1const [result, createShopifyProductImage] = useAction(
2 api.shopifyProductImage.create
3);
4const { data, error, fetching } = result;
5await createShopifyProductImage({
6 shopifyProductImage: {
7 // field values for Shopify Product Image
8 },
9});
10console.log(data?.id); //=> a string
1mutation ($shopifyProductImage: CreateShopifyProductImageInput) {
2 createShopifyProductImage(shopifyProductImage: $shopifyProductImage) {
3 success
4 errors {
5 message
6 ... on InvalidRecordError {
7 validationErrors {
8 apiIdentifier
9 message
10 }
11 record
12 model {
13 apiIdentifier
14 }
15 }
16 }
17 shopifyProductImage {
18 __typename
19 id
20 state
21 createdAt
22 height
23 position
24 product {
25 id
26 state
27 body
28 createdAt
29 handle
30 productType
31 publishedAt
32 publishedScope
33 shop {
34 id
35 state
36 accessToken
37 address1
38 address2
39 checkoutApiSupported
40 city
41 cookieConsentLevel
42 country
43 countryCode
44 countryName
45 countyTaxes
46 createdAt
47 currency
48 customerEmail
49 domain
50 eligibleForCardReaderGiveaway
51 eligibleForPayments
52 email
53 enabledPresentmentCurrencies
54 finances
55 forceSsl
56 googleAppsDomain
57 googleAppsLoginEnabled
58 grantedScopes
59 hasDiscounts
60 hasGiftCards
61 hasStorefront
62 ianaTimezone
63 installedViaApiKey
64 latitude
65 longitude
66 moneyFormat
67 moneyInEmailsFormat
68 moneyWithCurrencyFormat
69 moneyWithCurrencyInEmailsFormat
70 multiLocationEnabled
71 myshopifyDomain
72 name
73 passwordEnabled
74 phone
75 planDisplayName
76 planName
77 preLaunchEnabled
78 primaryLocale
79 province
80 provinceCode
81 registeredWebhooks
82 requiresExtraPaymentsAgreement
83 setupRequired
84 shopOwner
85 shopifyCreatedAt
86 shopifyUpdatedAt
87 source
88 taxShipping
89 taxesIncluded
90 timezone
91 updatedAt
92 weightUnit
93 zipCode
94 }
95 shopifyCreatedAt
96 shopifyUpdatedAt
97 tags
98 templateSuffix
99 title
100 updatedAt
101 vendor
102 }
103 shop {
104 id
105 state
106 accessToken
107 address1
108 address2
109 checkoutApiSupported
110 city
111 cookieConsentLevel
112 country
113 countryCode
114 countryName
115 countyTaxes
116 createdAt
117 currency
118 customerEmail
119 domain
120 eligibleForCardReaderGiveaway
121 eligibleForPayments
122 email
123 enabledPresentmentCurrencies
124 finances
125 forceSsl
126 googleAppsDomain
127 googleAppsLoginEnabled
128 grantedScopes
129 hasDiscounts
130 hasGiftCards
131 hasStorefront
132 ianaTimezone
133 installedViaApiKey
134 latitude
135 longitude
136 moneyFormat
137 moneyInEmailsFormat
138 moneyWithCurrencyFormat
139 moneyWithCurrencyInEmailsFormat
140 multiLocationEnabled
141 myshopifyDomain
142 name
143 passwordEnabled
144 phone
145 planDisplayName
146 planName
147 preLaunchEnabled
148 primaryLocale
149 province
150 provinceCode
151 registeredWebhooks
152 requiresExtraPaymentsAgreement
153 setupRequired
154 shopOwner
155 shopifyCreatedAt
156 shopifyUpdatedAt
157 source
158 taxShipping
159 taxesIncluded
160 timezone
161 updatedAt
162 weightUnit
163 zipCode
164 }
165 shopifyCreatedAt
166 shopifyUpdatedAt
167 source
168 updatedAt
169 variants {
170 edges {
171 node {
172 id
173 state
174 barcode
175 compareAtPrice
176 createdAt
177 fulfillmentService
178 grams
179 inventoryManagement
180 inventoryPolicy
181 inventoryQuantity
182 inventoryQuantityAdjustment
183 oldInventoryQuantity
184 option1
185 option2
186 option3
187 position
188 presentmentPrices
189 price
190 product {
191 id
192 state
193 body
194 createdAt
195 handle
196 productType
197 publishedAt
198 publishedScope
199 shopifyCreatedAt
200 shopifyUpdatedAt
201 tags
202 templateSuffix
203 title
204 updatedAt
205 vendor
206 }
207 productImage {
208 id
209 state
210 createdAt
211 height
212 position
213 shopifyCreatedAt
214 shopifyUpdatedAt
215 source
216 updatedAt
217 width
218 }
219 requiresShipping
220 shop {
221 id
222 state
223 accessToken
224 address1
225 address2
226 checkoutApiSupported
227 city
228 cookieConsentLevel
229 country
230 countryCode
231 countryName
232 countyTaxes
233 createdAt
234 currency
235 customerEmail
236 domain
237 eligibleForCardReaderGiveaway
238 eligibleForPayments
239 email
240 enabledPresentmentCurrencies
241 finances
242 forceSsl
243 googleAppsDomain
244 googleAppsLoginEnabled
245 grantedScopes
246 hasDiscounts
247 hasGiftCards
248 hasStorefront
249 ianaTimezone
250 installedViaApiKey
251 latitude
252 longitude
253 moneyFormat
254 moneyInEmailsFormat
255 moneyWithCurrencyFormat
256 moneyWithCurrencyInEmailsFormat
257 multiLocationEnabled
258 myshopifyDomain
259 name
260 passwordEnabled
261 phone
262 planDisplayName
263 planName
264 preLaunchEnabled
265 primaryLocale
266 province
267 provinceCode
268 registeredWebhooks
269 requiresExtraPaymentsAgreement
270 setupRequired
271 shopOwner
272 shopifyCreatedAt
273 shopifyUpdatedAt
274 source
275 taxShipping
276 taxesIncluded
277 timezone
278 updatedAt
279 weightUnit
280 zipCode
281 }
282 shopifyCreatedAt
283 shopifyUpdatedAt
284 sku
285 taxCode
286 taxable
287 title
288 updatedAt
289 weight
290 weightUnit
291 }
292 }
293 }
294 width
295 }
296 }
297}
Variables
json
{
"shopifyProductImage": {}
}
Output

Create returns the Shopify Product Image. In the JS client, the fields returned can be controlled with the select option. In GraphQL, the return format is the action result format, which includes the record if the action was successful. You can include or exclude the fields you need right in the mutation itself.

Create Output Data
type CreateShopifyProductImageResult {
success: Boolean!
errors: [ExecutionError!]
shopifyProductImage: ShopifyProductImage
}

Shopify Product Image Delete

The Delete action destroys the record.

Input

Delete operates on one Shopify Product Image in particular, identified by the id variable.

Example Delete Invocation
await api.shopifyProductImage.delete("some-id");
1const [result, deleteShopifyProductImage] = useAction(
2 api.shopifyProductImage.delete
3);
4const { data, error, fetching } = result;
5await deleteShopifyProductImage({
6 id: "some-id",
7});
1mutation ($id: GadgetID!) {
2 deleteShopifyProductImage(id: $id) {
3 success
4 errors {
5 message
6 ... on InvalidRecordError {
7 validationErrors {
8 apiIdentifier
9 message
10 }
11 record
12 model {
13 apiIdentifier
14 }
15 }
16 }
17 }
18}
Variables
json
{
"id": "some-id"
}
Output

Delete deletes the record, so it returns void in the JS client. In GraphQL it returns only the success and errors from the action result format.

Delete Output Data
type DeleteShopifyProductImageResult {
success: Boolean!
errors: [ExecutionError!]
}

Shopify Product Image Update

The Update action transitions a Shopify Product Image from Created to Created.

Input

Update operates on one Shopify Product Image in particular, identified by the id variable. Update accepts the following input parameters:

Update Input Data
1export interface UpdateShopifyProductImageInput {
2 id?: (Scalars["GadgetID"] | null) | null;
3
4 height?: (Scalars["Float"] | null) | null;
5
6 position?: (Scalars["Float"] | null) | null;
7
8 product?: ShopifyProductBelongsToInput | null;
9
10 shopifyCreatedAt?: Date | Scalars["ISO8601DateString"] | null;
11
12 source?: (Scalars["String"] | null) | null;
13
14 shopifyUpdatedAt?: Date | Scalars["ISO8601DateString"] | null;
15
16 variants?: (ShopifyProductVariantHasManyInput | null)[];
17
18 width?: (Scalars["Float"] | null) | null;
19
20 shop?: ShopifyShopBelongsToInput | null;
21}
22
23export interface UpdateShopifyProductImageArguments {
24 shopifyProductImage?: UpdateShopifyProductImageInput | null;
25}
1input UpdateShopifyProductImageInput {
2 id: GadgetID
3 height: Float
4 position: Float
5 product: ShopifyProductBelongsToInput
6 shopifyCreatedAt: DateTime
7 source: String
8 shopifyUpdatedAt: DateTime
9 variants: [ShopifyProductVariantHasManyInput]
10 width: Float
11 shop: ShopifyShopBelongsToInput
12}
13
14input UpdateShopifyProductImageArguments {
15 shopifyProductImage: UpdateShopifyProductImageInput
16}
Example Update Invocation
1const shopifyProductImageRecord = await api.shopifyProductImage.update("some-id", {
2 shopifyProductImage: {
3 // field values for Shopify Product Image
4 },
5});
6console.log(shopifyProductImageRecord.id); //=> a string
1const [result, updateShopifyProductImage] = useAction(
2 api.shopifyProductImage.update
3);
4const { data, error, fetching } = result;
5await updateShopifyProductImage({
6 id: "some-id",
7 shopifyProductImage: {
8 // field values for Shopify Product Image
9 },
10});
11console.log(data?.id); //=> a string
1mutation ($id: GadgetID!, $shopifyProductImage: UpdateShopifyProductImageInput) {
2 updateShopifyProductImage(id: $id, shopifyProductImage: $shopifyProductImage) {
3 success
4 errors {
5 message
6 ... on InvalidRecordError {
7 validationErrors {
8 apiIdentifier
9 message
10 }
11 record
12 model {
13 apiIdentifier
14 }
15 }
16 }
17 shopifyProductImage {
18 __typename
19 id
20 state
21 createdAt
22 height
23 position
24 product {
25 id
26 state
27 body
28 createdAt
29 handle
30 productType
31 publishedAt
32 publishedScope
33 shop {
34 id
35 state
36 accessToken
37 address1
38 address2
39 checkoutApiSupported
40 city
41 cookieConsentLevel
42 country
43 countryCode
44 countryName
45 countyTaxes
46 createdAt
47 currency
48 customerEmail
49 domain
50 eligibleForCardReaderGiveaway
51 eligibleForPayments
52 email
53 enabledPresentmentCurrencies
54 finances
55 forceSsl
56 googleAppsDomain
57 googleAppsLoginEnabled
58 grantedScopes
59 hasDiscounts
60 hasGiftCards
61 hasStorefront
62 ianaTimezone
63 installedViaApiKey
64 latitude
65 longitude
66 moneyFormat
67 moneyInEmailsFormat
68 moneyWithCurrencyFormat
69 moneyWithCurrencyInEmailsFormat
70 multiLocationEnabled
71 myshopifyDomain
72 name
73 passwordEnabled
74 phone
75 planDisplayName
76 planName
77 preLaunchEnabled
78 primaryLocale
79 province
80 provinceCode
81 registeredWebhooks
82 requiresExtraPaymentsAgreement
83 setupRequired
84 shopOwner
85 shopifyCreatedAt
86 shopifyUpdatedAt
87 source
88 taxShipping
89 taxesIncluded
90 timezone
91 updatedAt
92 weightUnit
93 zipCode
94 }
95 shopifyCreatedAt
96 shopifyUpdatedAt
97 tags
98 templateSuffix
99 title
100 updatedAt
101 vendor
102 }
103 shop {
104 id
105 state
106 accessToken
107 address1
108 address2
109 checkoutApiSupported
110 city
111 cookieConsentLevel
112 country
113 countryCode
114 countryName
115 countyTaxes
116 createdAt
117 currency
118 customerEmail
119 domain
120 eligibleForCardReaderGiveaway
121 eligibleForPayments
122 email
123 enabledPresentmentCurrencies
124 finances
125 forceSsl
126 googleAppsDomain
127 googleAppsLoginEnabled
128 grantedScopes
129 hasDiscounts
130 hasGiftCards
131 hasStorefront
132 ianaTimezone
133 installedViaApiKey
134 latitude
135 longitude
136 moneyFormat
137 moneyInEmailsFormat
138 moneyWithCurrencyFormat
139 moneyWithCurrencyInEmailsFormat
140 multiLocationEnabled
141 myshopifyDomain
142 name
143 passwordEnabled
144 phone
145 planDisplayName
146 planName
147 preLaunchEnabled
148 primaryLocale
149 province
150 provinceCode
151 registeredWebhooks
152 requiresExtraPaymentsAgreement
153 setupRequired
154 shopOwner
155 shopifyCreatedAt
156 shopifyUpdatedAt
157 source
158 taxShipping
159 taxesIncluded
160 timezone
161 updatedAt
162 weightUnit
163 zipCode
164 }
165 shopifyCreatedAt
166 shopifyUpdatedAt
167 source
168 updatedAt
169 variants {
170 edges {
171 node {
172 id
173 state
174 barcode
175 compareAtPrice
176 createdAt
177 fulfillmentService
178 grams
179 inventoryManagement
180 inventoryPolicy
181 inventoryQuantity
182 inventoryQuantityAdjustment
183 oldInventoryQuantity
184 option1
185 option2
186 option3
187 position
188 presentmentPrices
189 price
190 product {
191 id
192 state
193 body
194 createdAt
195 handle
196 productType
197 publishedAt
198 publishedScope
199 shopifyCreatedAt
200 shopifyUpdatedAt
201 tags
202 templateSuffix
203 title
204 updatedAt
205 vendor
206 }
207 productImage {
208 id
209 state
210 createdAt
211 height
212 position
213 shopifyCreatedAt
214 shopifyUpdatedAt
215 source
216 updatedAt
217 width
218 }
219 requiresShipping
220 shop {
221 id
222 state
223 accessToken
224 address1
225 address2
226 checkoutApiSupported
227 city
228 cookieConsentLevel
229 country
230 countryCode
231 countryName
232 countyTaxes
233 createdAt
234 currency
235 customerEmail
236 domain
237 eligibleForCardReaderGiveaway
238 eligibleForPayments
239 email
240 enabledPresentmentCurrencies
241 finances
242 forceSsl
243 googleAppsDomain
244 googleAppsLoginEnabled
245 grantedScopes
246 hasDiscounts
247 hasGiftCards
248 hasStorefront
249 ianaTimezone
250 installedViaApiKey
251 latitude
252 longitude
253 moneyFormat
254 moneyInEmailsFormat
255 moneyWithCurrencyFormat
256 moneyWithCurrencyInEmailsFormat
257 multiLocationEnabled
258 myshopifyDomain
259 name
260 passwordEnabled
261 phone
262 planDisplayName
263 planName
264 preLaunchEnabled
265 primaryLocale
266 province
267 provinceCode
268 registeredWebhooks
269 requiresExtraPaymentsAgreement
270 setupRequired
271 shopOwner
272 shopifyCreatedAt
273 shopifyUpdatedAt
274 source
275 taxShipping
276 taxesIncluded
277 timezone
278 updatedAt
279 weightUnit
280 zipCode
281 }
282 shopifyCreatedAt
283 shopifyUpdatedAt
284 sku
285 taxCode
286 taxable
287 title
288 updatedAt
289 weight
290 weightUnit
291 }
292 }
293 }
294 width
295 }
296 }
297}
Variables
json
{