Shopify Shop
This page documents the Shopify Shop model.
Data Shape
Gadget's database stores Shopify Shop 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 Shop:
1export interface ShopifyShop {2 __typename: "ShopifyShop";34 /** The globally unique, unchanging identifier for this record. Assigned and managed by Shopify. */5 id: Scalars["GadgetID"];67 /** The time at which this record was first created. Set once upon record creation and never changed. Managed by Gadget. */8 createdAt: Scalars["DateTime"];910 /** 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"];1213 /** The current state this record is in. Changed by invoking actions. Managed by Gadget. */14 state: Scalars["RecordState"];1516 customers: ShopifyCustomerConnection;1718 syncs: ShopifySyncConnection;1920 gdprRequests: ShopifyGdprRequestConnection;2122 accessToken: Scalars["String"] | null;2324 address1: Scalars["String"] | null;2526 address2: Scalars["String"] | null;2728 checkoutApiSupported: Scalars["Boolean"] | null;2930 city: Scalars["String"] | null;3132 cookieConsentLevel: Scalars["String"] | null;3334 country: Scalars["String"] | null;3536 countryCode: Scalars["String"] | null;3738 countryName: Scalars["String"] | null;3940 countyTaxes: Scalars["JSON"] | null;4142 shopifyCreatedAt: Scalars["DateTime"] | null;4344 currency: Scalars["String"] | null;4546 customerEmail: Scalars["String"] | null;4748 domain: Scalars["String"] | null;4950 eligibleForCardReaderGiveaway: Scalars["Boolean"] | null;5152 eligibleForPayments: Scalars["Boolean"] | null;5354 email: Scalars["String"] | null;5556 enabledPresentmentCurrencies: Scalars["JSON"] | null;5758 finances: Scalars["Boolean"] | null;5960 forceSsl: Scalars["Boolean"] | null;6162 googleAppsDomain: Scalars["String"] | null;6364 googleAppsLoginEnabled: Scalars["Boolean"] | null;6566 grantedScopes: Scalars["JSON"] | null;6768 hasDiscounts: Scalars["Boolean"] | null;6970 hasGiftCards: Scalars["Boolean"] | null;7172 hasStorefront: Scalars["Boolean"] | null;7374 ianaTimezone: Scalars["String"] | null;7576 installedViaApiKey: Scalars["String"] | null;7778 latitude: Scalars["Float"] | null;7980 longitude: Scalars["Float"] | null;8182 moneyFormat: Scalars["String"] | null;8384 moneyInEmailsFormat: Scalars["String"] | null;8586 moneyWithCurrencyFormat: Scalars["String"] | null;8788 moneyWithCurrencyInEmailsFormat: Scalars["String"] | null;8990 multiLocationEnabled: Scalars["Boolean"] | null;9192 myshopifyDomain: Scalars["String"] | null;9394 name: Scalars["String"] | null;9596 passwordEnabled: Scalars["Boolean"] | null;9798 phone: Scalars["String"] | null;99100 planDisplayName: Scalars["String"] | null;101102 planName: Scalars["String"] | null;103104 preLaunchEnabled: Scalars["Boolean"] | null;105106 primaryLocale: Scalars["String"] | null;107108 province: Scalars["String"] | null;109110 provinceCode: Scalars["String"] | null;111112 products: ShopifyProductConnection;113114 productVariants: ShopifyProductVariantConnection;115116 registeredWebhooks: Scalars["JSON"] | null;117118 requiresExtraPaymentsAgreement: Scalars["Boolean"] | null;119120 setupRequired: Scalars["Boolean"] | null;121122 shopOwner: Scalars["String"] | null;123124 source: Scalars["String"] | null;125126 taxShipping: Scalars["Boolean"] | null;127128 taxesIncluded: Scalars["Boolean"] | null;129130 timezone: Scalars["String"] | null;131132 shopifyUpdatedAt: Scalars["DateTime"] | null;133134 weightUnit: Scalars["String"] | null;135136 zipCode: Scalars["String"] | null;137138 tasks: TaskConnection;139140 marketingSmsContentEnabledAtCheckout: Scalars["Boolean"] | null;141142 transactionalSmsDisabled: Scalars["Boolean"] | null;143144 /** Get all the fields for this record. Useful for not having to list out all the fields you want to retrieve, but slower. */145 _all: Scalars["JSONObject"];146}
1type ShopifyShop {2 """3 The globally unique, unchanging identifier for this record. Assigned and managed by Shopify.4 """5 id: GadgetID!67 """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!1112 """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!1617 """18 The current state this record is in. Changed by invoking actions. Managed by Gadget.19 """20 state: RecordState!21 customers(22 """23 Returns the items in the list that come after the specified cursor.24 """25 after: String2627 """28 Returns the first n items from the list.29 """30 first: Int3132 """33 Returns the items in the list that come before the specified cursor.34 """35 before: String3637 """38 Returns the last n items from the list.39 """40 last: Int4142 """43 A list of sort orders to return the results in44 """45 sort: [ShopifyCustomerSort!]4647 """48 A list of filters to refine the results by49 """50 filter: [ShopifyCustomerFilter!]5152 """53 A free form text search query to find records matching54 """55 search: String56 ): ShopifyCustomerConnection!57 syncs(58 """59 Returns the items in the list that come after the specified cursor.60 """61 after: String6263 """64 Returns the first n items from the list.65 """66 first: Int6768 """69 Returns the items in the list that come before the specified cursor.70 """71 before: String7273 """74 Returns the last n items from the list.75 """76 last: Int7778 """79 A list of sort orders to return the results in80 """81 sort: [ShopifySyncSort!]8283 """84 A list of filters to refine the results by85 """86 filter: [ShopifySyncFilter!]8788 """89 A free form text search query to find records matching90 """91 search: String92 ): ShopifySyncConnection!93 gdprRequests(94 """95 Returns the items in the list that come after the specified cursor.96 """97 after: String9899 """100 Returns the first n items from the list.101 """102 first: Int103104 """105 Returns the items in the list that come before the specified cursor.106 """107 before: String108109 """110 Returns the last n items from the list.111 """112 last: Int113114 """115 A list of sort orders to return the results in116 """117 sort: [ShopifyGdprRequestSort!]118119 """120 A list of filters to refine the results by121 """122 filter: [ShopifyGdprRequestFilter!]123124 """125 A free form text search query to find records matching126 """127 search: String128 ): ShopifyGdprRequestConnection!129 accessToken: String130 address1: String131 address2: String132 checkoutApiSupported: Boolean133 city: String134 cookieConsentLevel: String135 country: String136 countryCode: String137 countryName: String138 countyTaxes: JSON139 shopifyCreatedAt: DateTime140 currency: String141 customerEmail: String142 domain: String143 eligibleForCardReaderGiveaway: Boolean144 eligibleForPayments: Boolean145 email: String146 enabledPresentmentCurrencies: JSON147 finances: Boolean148 forceSsl: Boolean149 googleAppsDomain: String150 googleAppsLoginEnabled: Boolean151 grantedScopes: JSON152 hasDiscounts: Boolean153 hasGiftCards: Boolean154 hasStorefront: Boolean155 ianaTimezone: String156 installedViaApiKey: String157 latitude: Float158 longitude: Float159 moneyFormat: String160 moneyInEmailsFormat: String161 moneyWithCurrencyFormat: String162 moneyWithCurrencyInEmailsFormat: String163 multiLocationEnabled: Boolean164 myshopifyDomain: String165 name: String166 passwordEnabled: Boolean167 phone: String168 planDisplayName: String169 planName: String170 preLaunchEnabled: Boolean171 primaryLocale: String172 province: String173 provinceCode: String174 products(175 """176 Returns the items in the list that come after the specified cursor.177 """178 after: String179180 """181 Returns the first n items from the list.182 """183 first: Int184185 """186 Returns the items in the list that come before the specified cursor.187 """188 before: String189190 """191 Returns the last n items from the list.192 """193 last: Int194195 """196 A list of sort orders to return the results in197 """198 sort: [ShopifyProductSort!]199200 """201 A list of filters to refine the results by202 """203 filter: [ShopifyProductFilter!]204205 """206 A free form text search query to find records matching207 """208 search: String209 ): ShopifyProductConnection!210 productVariants(211 """212 Returns the items in the list that come after the specified cursor.213 """214 after: String215216 """217 Returns the first n items from the list.218 """219 first: Int220221 """222 Returns the items in the list that come before the specified cursor.223 """224 before: String225226 """227 Returns the last n items from the list.228 """229 last: Int230231 """232 A list of sort orders to return the results in233 """234 sort: [ShopifyProductVariantSort!]235236 """237 A list of filters to refine the results by238 """239 filter: [ShopifyProductVariantFilter!]240241 """242 A free form text search query to find records matching243 """244 search: String245 ): ShopifyProductVariantConnection!246 registeredWebhooks: JSON247 requiresExtraPaymentsAgreement: Boolean248 setupRequired: Boolean249 shopOwner: String250 source: String251 taxShipping: Boolean252 taxesIncluded: Boolean253 timezone: String254 shopifyUpdatedAt: DateTime255 weightUnit: String256 zipCode: String257 tasks(258 """259 Returns the items in the list that come after the specified cursor.260 """261 after: String262263 """264 Returns the first n items from the list.265 """266 first: Int267268 """269 Returns the items in the list that come before the specified cursor.270 """271 before: String272273 """274 Returns the last n items from the list.275 """276 last: Int277278 """279 A list of sort orders to return the results in280 """281 sort: [TaskSort!]282283 """284 A list of filters to refine the results by285 """286 filter: [TaskFilter!]287288 """289 A free form text search query to find records matching290 """291 search: String292 ): TaskConnection!293 marketingSmsContentEnabledAtCheckout: Boolean294 transactionalSmsDisabled: Boolean295296 """297 Get all the fields for this record. Useful for not having to list out all the fields you want to retrieve, but slower.298 """299 _all: JSONObject!300}
You can preview what a real record's shape looks like by fetching it using the example-app API Playground.
Any fetched Shopify Shop record will have this same ShopifyShop
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 Shop record
Individual Shopify Shop 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.
const shopifyShopRecord = await api.shopifyShop.findOne("some-id");console.log(shopifyShopRecord.id); //=> a stringconsole.log(shopifyShopRecord.createdAt); //=> a Date object
const [result, refresh] = useFindOne(api.shopifyShop, "some-id");const { data, error, fetching } = result;console.log(data?.id); //=> a stringconsole.log(data?.createdAt); //=> a Date object
1query GetOneShopifyShop($id: GadgetID!) {2 shopifyShop(id: $id) {3 __typename4 id5 state6 accessToken7 address18 address29 checkoutApiSupported10 city11 cookieConsentLevel12 country13 countryCode14 countryName15 countyTaxes16 createdAt17 currency18 customerEmail19 domain20 eligibleForCardReaderGiveaway21 eligibleForPayments22 email23 enabledPresentmentCurrencies24 finances25 forceSsl26 googleAppsDomain27 googleAppsLoginEnabled28 grantedScopes29 hasDiscounts30 hasGiftCards31 hasStorefront32 ianaTimezone33 installedViaApiKey34 latitude35 longitude36 marketingSmsContentEnabledAtCheckout37 moneyFormat38 moneyInEmailsFormat39 moneyWithCurrencyFormat40 moneyWithCurrencyInEmailsFormat41 multiLocationEnabled42 myshopifyDomain43 name44 passwordEnabled45 phone46 planDisplayName47 planName48 preLaunchEnabled49 primaryLocale50 province51 provinceCode52 registeredWebhooks53 requiresExtraPaymentsAgreement54 setupRequired55 shopOwner56 shopifyCreatedAt57 shopifyUpdatedAt58 source59 taxShipping60 taxesIncluded61 timezone62 transactionalSmsDisabled63 updatedAt64 weightUnit65 zipCode66 }67}
{ "id": "some-id" }
Retrieving the first of many Shopify Shop 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.
const shopifyShopRecord = await api.shopifyShop.findFirst();console.log(shopifyShopRecord.id); //=> a stringconsole.log(shopifyShopRecord.createdAt); //=> a Date object
const [result, refresh] = useFindFirst(api.shopifyShop);const { data, error, fetching } = result;console.log(data?.id); //=> a stringconsole.log(data?.createdAt); //=> a Date object
1query FindManyShopifyShops(2 $first: Int3 $search: String4 $sort: [ShopifyShopSort!]5 $filter: [ShopifyShopFilter!]6) {7 shopifyShops(first: $first, search: $search, sort: $sort, filter: $filter) {8 edges {9 node {10 __typename11 id12 state13 accessToken14 address115 address216 checkoutApiSupported17 city18 cookieConsentLevel19 country20 countryCode21 countryName22 countyTaxes23 createdAt24 currency25 customerEmail26 domain27 eligibleForCardReaderGiveaway28 eligibleForPayments29 email30 enabledPresentmentCurrencies31 finances32 forceSsl33 googleAppsDomain34 googleAppsLoginEnabled35 grantedScopes36 hasDiscounts37 hasGiftCards38 hasStorefront39 ianaTimezone40 installedViaApiKey41 latitude42 longitude43 marketingSmsContentEnabledAtCheckout44 moneyFormat45 moneyInEmailsFormat46 moneyWithCurrencyFormat47 moneyWithCurrencyInEmailsFormat48 multiLocationEnabled49 myshopifyDomain50 name51 passwordEnabled52 phone53 planDisplayName54 planName55 preLaunchEnabled56 primaryLocale57 province58 provinceCode59 registeredWebhooks60 requiresExtraPaymentsAgreement61 setupRequired62 shopOwner63 shopifyCreatedAt64 shopifyUpdatedAt65 source66 taxShipping67 taxesIncluded68 timezone69 transactionalSmsDisabled70 updatedAt71 weightUnit72 zipCode73 }74 }75 }76}
{ "first": 1 }
Retrieving many Shopify Shop records
Pages of Shopify Shop 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 edge
s with node
s and cursor
s) so they can be paginated. The shopifyShops
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 Shops
Fetch a page of records with the shopifyShop.findMany
JS method or the shopifyShops
GraphQL field. No options are required. The records returned will be implicitly sorted by ID ascending.
const shopifyShopRecords = await api.shopifyShop.findMany();console.log(shopifyShopRecords.length); //=> a numberconsole.log(shopifyShopRecords[0].id); //=> a string
const [result, refresh] = useFindMany(api.shopifyShop);const { data, error, fetching } = result;console.log(data?.length); //=> a numberconsole.log(data?.[0].length); //=> a string
1query FindManyShopifyShops {2 shopifyShops {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{}
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 ShopifyShopSort
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 ShopifyShopSort
instead of just one.
1input ShopifyShopSort {2 id: SortOrder3 createdAt: SortOrder4 updatedAt: SortOrder5 state: SortOrder6 accessToken: SortOrder7 address1: SortOrder8 address2: SortOrder9 checkoutApiSupported: SortOrder10 city: SortOrder11 cookieConsentLevel: SortOrder12 country: SortOrder13 countryCode: SortOrder14 countryName: SortOrder15 countyTaxes: SortOrder16 shopifyCreatedAt: SortOrder17 currency: SortOrder18 customerEmail: SortOrder19 domain: SortOrder20 eligibleForCardReaderGiveaway: SortOrder21 eligibleForPayments: SortOrder22 email: SortOrder23 enabledPresentmentCurrencies: SortOrder24 finances: SortOrder25 forceSsl: SortOrder26 googleAppsDomain: SortOrder27 googleAppsLoginEnabled: SortOrder28 grantedScopes: SortOrder29 hasDiscounts: SortOrder30 hasGiftCards: SortOrder31 hasStorefront: SortOrder32 ianaTimezone: SortOrder33 installedViaApiKey: SortOrder34 latitude: SortOrder35 longitude: SortOrder36 moneyFormat: SortOrder37 moneyInEmailsFormat: SortOrder38 moneyWithCurrencyFormat: SortOrder39 moneyWithCurrencyInEmailsFormat: SortOrder40 multiLocationEnabled: SortOrder41 myshopifyDomain: SortOrder42 name: SortOrder43 passwordEnabled: SortOrder44 phone: SortOrder45 planDisplayName: SortOrder46 planName: SortOrder47 preLaunchEnabled: SortOrder48 primaryLocale: SortOrder49 province: SortOrder50 provinceCode: SortOrder51 registeredWebhooks: SortOrder52 requiresExtraPaymentsAgreement: SortOrder53 setupRequired: SortOrder54 shopOwner: SortOrder55 source: SortOrder56 taxShipping: SortOrder57 taxesIncluded: SortOrder58 timezone: SortOrder59 shopifyUpdatedAt: SortOrder60 weightUnit: SortOrder61 zipCode: SortOrder62 marketingSmsContentEnabledAtCheckout: SortOrder63 transactionalSmsDisabled: SortOrder64}
Pass the sort
option to the JS client, or the sort
variable to a GraphQL query to sort the records returned.
const shopifyShopRecords = await api.shopifyShop.findMany({sort: { createdAt: "Descending" },});
const [result, refresh] = useFindMany(api.shopifyShop, {sort: { createdAt: "Descending" },});const { data, error, fetching } = result;
1query FindManyShopifyShops($sort: [ShopifyShopSort!]) {2 shopifyShops(sort: $sort) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "sort": { "createdAt": "Descending" } }
Sort by multiple fields by passing an array of { [field]: "Ascending" | "Descending" }
objects.
const shopifyShopRecords = await api.shopifyShop.findMany({sort: [{ state: "Descending" }, { createdAt: "Ascending" }],});
const [result, refresh] = useFindMany(api.shopifyShop, {sort: [{ state: "Descending" }, { createdAt: "Ascending" }],});const { data, error, fetching } = result;
1query FindManyShopifyShops($sort: [ShopifyShopSort!]) {2 shopifyShops(sort: $sort) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "sort": [{ "state": "Descending" }, { "createdAt": "Ascending" }] }
All primitive field types in Gadget are sortable so you are able to sort by fields you have added to a model as well.
const shopifyShopRecords = await api.shopifyShop.findMany({sort: { id: "Descending" },});
const [result, refresh] = useFindMany(api.shopifyShop, {sort: { id: "Descending" },});const { data, error, fetching } = result;
1query FindManyShopifyShops($sort: [ShopifyShopSort!]) {2 shopifyShops(sort: $sort) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "sort": { "id": "Descending" } }
Searching
Shopify Shop 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 Shops 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.
const shopifyShopRecords = await api.shopifyShop.findMany({search: "a specific phrase to search for",});
const [result, refresh] = useFindMany(api.shopifyShop, {search: "a specific phrase to search for",});const { data, error, fetching } = result;
1query FindManyShopifyShops($search: String) {2 shopifyShops(search: $search) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "search": "a specific phrase to search for" }
Filtering
Shopify Shop 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 Shops 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 ShopifyShopFilter
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 AND
ed with one another such that they all need to match for a record to be returned.
1input ShopifyShopFilter {2 AND: [ShopifyShopFilter]3 OR: [ShopifyShopFilter]4 NOT: [ShopifyShopFilter]5 id: IDFilter6 createdAt: DateTimeFilter7 updatedAt: DateTimeFilter8 state: StateFilter9 accessToken: StringFilter10 address1: StringFilter11 address2: StringFilter12 checkoutApiSupported: BooleanFilter13 city: StringFilter14 cookieConsentLevel: StringFilter15 country: StringFilter16 countryCode: StringFilter17 countryName: StringFilter18 countyTaxes: JSONFilter19 shopifyCreatedAt: DateTimeFilter20 currency: StringFilter21 customerEmail: StringFilter22 domain: StringFilter23 eligibleForCardReaderGiveaway: BooleanFilter24 eligibleForPayments: BooleanFilter25 email: StringFilter26 enabledPresentmentCurrencies: JSONFilter27 finances: BooleanFilter28 forceSsl: BooleanFilter29 googleAppsDomain: StringFilter30 googleAppsLoginEnabled: BooleanFilter31 grantedScopes: JSONFilter32 hasDiscounts: BooleanFilter33 hasGiftCards: BooleanFilter34 hasStorefront: BooleanFilter35 ianaTimezone: StringFilter36 installedViaApiKey: StringFilter37 latitude: FloatFilter38 longitude: FloatFilter39 moneyFormat: StringFilter40 moneyInEmailsFormat: StringFilter41 moneyWithCurrencyFormat: StringFilter42 moneyWithCurrencyInEmailsFormat: StringFilter43 multiLocationEnabled: BooleanFilter44 myshopifyDomain: StringFilter45 name: StringFilter46 passwordEnabled: BooleanFilter47 phone: StringFilter48 planDisplayName: StringFilter49 planName: StringFilter50 preLaunchEnabled: BooleanFilter51 primaryLocale: StringFilter52 province: StringFilter53 provinceCode: StringFilter54 registeredWebhooks: JSONFilter55 requiresExtraPaymentsAgreement: BooleanFilter56 setupRequired: BooleanFilter57 shopOwner: StringFilter58 source: StringFilter59 taxShipping: BooleanFilter60 taxesIncluded: BooleanFilter61 timezone: StringFilter62 shopifyUpdatedAt: DateTimeFilter63 weightUnit: StringFilter64 zipCode: StringFilter65 marketingSmsContentEnabledAtCheckout: BooleanFilter66 transactionalSmsDisabled: BooleanFilter67}
const yesterday = new Date(Date.now() - 864e5);const shopifyShopRecords = await api.shopifyShop.findMany({filter: { createdAt: { greaterThan: yesterday } },});
const yesterday = new Date(Date.now() - 864e5);const [result, refresh] = useFindMany(api.shopifyShop, {filter: { createdAt: { greaterThan: yesterday } },});const { data, error, fetching } = result;
1query FindManyShopifyShops($filter: [ShopifyShopFilter!]) {2 shopifyShops(filter: $filter) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "filter": { "createdAt": { "greaterThan": "2023-02-05T00:50:26.216Z" } } }
1const yesterday = new Date(Date.now() - 86400000);2const oneWeekAgo = new Date(Date.now() - 604800000);3const shopifyShopRecords = await api.shopifyShop.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.shopifyShop, {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 FindManyShopifyShops($filter: [ShopifyShopFilter!]) {2 shopifyShops(filter: $filter) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
1{2 "filter": {3 "OR": [4 { "createdAt": { "greaterThan": "2023-01-30T00:50:26.216Z" } },5 { "updated": { "greaterThan": "2023-02-05T00:50:26.217Z" } }6 ]7 }8}
Filter records that are in the installed state
const shopifyShopRecords = await api.shopifyShop.findMany({filter: {state: { inState: "created.installed" },},});
1const [result, refresh] = useFindMany(api.shopifyShop, {2 filter: {3 state: { inState: "created.installed" },4 },5});6const { data, error, fetching } = result;
1query FindManyShopifyShops($filter: [ShopifyShopFilter!]) {2 shopifyShops(filter: $filter) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "filter": { "state": { "inState": "created.installed" } } }
Most field types in Gadget are filterable, so you are able to filter by fields you have added to a model as well.
const shopifyShopRecords = await api.shopifyShop.findMany({filter: {id: { isSet: true },},});
1const [result, refresh] = useFindMany(api.shopifyShop, {2 filter: {3 id: { isSet: true },4 },5});6const { data, error, fetching } = result;
1query FindManyShopifyShops($filter: [ShopifyShopFilter!]) {2 shopifyShops(filter: $filter) {3 edges {4 node {5 __typename6 id7 state8 # ...9 createdAt10 updatedAt11 }12 }13 }14}
{ "filter": { "id": { "isSet": true } } }
Pagination
All Gadget record lists, including the top level Shopify Shop finder as well as associations to Shopify Shop, are structured as GraphQL connections. GraphQL connections are the de facto 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 Shop 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 Shop 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.
const shopifyShopRecords = await api.shopifyShop.findMany({ first: 25 });console.log(shopifyShopRecords.length); //=> no greater than 25
const [result, refresh] = useFindMany(api.shopifyShop, { first: 25 });const { data, error, fetching } = result;console.log(data?.length); //=> no greater than 25
1query FindManyShopifyShops($first: Int, $after: String) {2 shopifyShops(first: $first, after: $after) {3 edges {4 cursor5 node {6 __typename7 id8 state9 # ...10 createdAt11 updatedAt12 }13 }14 pageInfo {15 endCursor16 hasNextPage17 hasPreviousPage18 startCursor19 }20 }21}
{ "first": 25 }
The after
cursor used in this example data won't return any records if used in a real API request.
const shopifyShopRecords = await api.shopifyShop.findMany({after: "abcdefg",first: 25,});
const [result, refresh] = useFindMany(api.shopifyShop, {after: "abcdefg",first: 25,});const { data, error, fetching } = result;
1query FindManyShopifyShops($first: Int, $after: String) {2 shopifyShops(first: $first, after: $after) {3 edges {4 cursor5 node {6 __typename7 id8 state9 # ...10 createdAt11 updatedAt12 }13 }14 pageInfo {15 endCursor16 hasNextPage17 hasPreviousPage18 startCursor19 }20 }21}
{ "first": 25, "after": "abcdefg" }
Pagination Limits
Root-level record finders like shopifyShops
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 has many or has many 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, including the api
parameter in a Gadget code effect, the record lists returned from findMany 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
.
1const shopifyShopRecords = await api.shopifyShop.findMany();2if (shopifyShopRecords.hasNextPage) {3 const nextPage = await shopifyShopRecords.nextPage();4}5if (shopifyShopRecords.hasPreviousPage) {6 const prevPage = await shopifyShopRecords.previousPage();7}
When using React and paging through records, you can use cursors to get the previous or next pages of records. This is an example of a React component that pages forward and backward through 2 records at a time for props.model.name.
1import { api } from "../api"; // your Gadget project's API Client2import { useFindMany } from "@gadgetinc/react";3import { useCallback, useState } from "react";45export default function TestComponent() {6 const NUM_ON_PAGE = 2; // the number of records per page78 const [cursor, setCursor] = useState({ first: NUM_ON_PAGE });9 // using Gadget React hooks to fetch records of shopifyShop10 const [{ data, fetching, error }] = useFindMany(api.shopifyShop, {11 ...cursor,12 });1314 const getNextPage = useCallback(() => {15 // use first + after to page forwards16 setCursor({ first: NUM_ON_PAGE, after: data.endCursor });17 }, [data]);1819 const getPreviousPage = useCallback(() => {20 // use last + before to page backwards21 setCursor({ last: NUM_ON_PAGE, before: data.startCursor });22 }, [data]);2324 return (25 <div>26 <button onClick={getPreviousPage} disabled={!data?.hasPreviousPage}>27 Previous page28 </button>29 <button onClick={getNextPage} disabled={!data?.hasNextPage}>30 Next page31 </button>32 {!fetching && data.map((d) => <div>{d.id}</div>)}33 </div>34 );35}
Get all records
If you need to get all available data for Shopify Shop, you will need to paginate through all pages of data. If you have a large amount of data, this can take a long time. Make sure you need to collect all data at once before writing a pagination loop that reads all records! If you are querying records for display in a UI and cannot display all your records at once, we don't recommend fetching all the data beforehand - instead, use the cursor to read additional data when the user needs it.
If you need all data for analytics applications or to collect some statistics on your data, consider options like intermediate models and pre-defined data rollups.
If you have determined that you need all your data, you can fetch it using cursors and a loop. We also suggest using select
so that you only grab fields that are needed, in addition to applying a filter
, if possible. Using first
with the maximum allowable value will also allow you to grab the maximum number of records you can at once.
1const allRecords = []; // use allRecords to store all records2let records = await api.shopifyShop.findMany({3 first: 250,4 select: {5 id: true,6 },7 filter: {8 // add filter conditions, if possible9 },10});1112allRecords.push(...records);1314// loop through additional pages to get all protected orders15while (records.hasNextPage) {16 // paginate17 records = await records.nextPage();18 allRecords.push(...records);19}
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 Shop 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 Shop. If you don't pass a select
option to a record finder, this default selection will be used.
1// fetch only the id, state, and createdAt field2const shopifyShopRecords = await api.shopifyShop.findMany({3 select: { id: true, state: true, createdAt: true },4});5// fetch all the scalar fields for the model, but no relationship fields6const shopifyShopRecords = await api.shopifyShop.findMany();
1// fetch only the id, state, and createdAt field2const [result, refresh] = useFindMany(api.shopifyShop, {3 select: { id: true, state: true, createdAt: true },4});5const { data, error, fetching } = result;6// fetch all the scalar fields for the model, but no relationship fields7const [result, refresh] = useFindMany(api.shopifyShop);8const { 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.
1// fetch the id, state, and createdAt field, and fetch some nested fields from an example relationship field named `someRelatedObject`2const shopifyShopRecords = await api.shopifyShop.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.shopifyShop, {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.
1const shopifyShopRecords = await api.shopifyShop.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.shopifyShop, {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 FindManyShopifyShops(2 $after: String3 $before: String4 $first: Int5 $last: Int6 $search: String7 $sort: [ShopifyShopSort!]8 $filter: [ShopifyShopFilter!]9) {10 shopifyShops(11 after: $after12 before: $before13 first: $first14 last: $last15 search: $search16 sort: $sort17 filter: $filter18 ) {19 edges {20 cursor21 node {22 __typename23 id24 state25 accessToken26 address127 address228 checkoutApiSupported29 city30 cookieConsentLevel31 country32 countryCode33 countryName34 countyTaxes35 createdAt36 currency37 customerEmail38 domain39 eligibleForCardReaderGiveaway40 eligibleForPayments41 email42 enabledPresentmentCurrencies43 finances44 forceSsl45 googleAppsDomain46 googleAppsLoginEnabled47 grantedScopes48 hasDiscounts49 hasGiftCards50 hasStorefront51 ianaTimezone52 installedViaApiKey53 latitude54 longitude55 marketingSmsContentEnabledAtCheckout56 moneyFormat57 moneyInEmailsFormat58 moneyWithCurrencyFormat59 moneyWithCurrencyInEmailsFormat60 multiLocationEnabled61 myshopifyDomain62 name63 passwordEnabled64 phone65 planDisplayName66 planName67 preLaunchEnabled68 primaryLocale69 province70 provinceCode71 registeredWebhooks72 requiresExtraPaymentsAgreement73 setupRequired74 shopOwner75 shopifyCreatedAt76 shopifyUpdatedAt77 source78 taxShipping79 taxesIncluded80 timezone81 transactionalSmsDisabled82 updatedAt83 weightUnit84 zipCode85 }86 }87 pageInfo {88 endCursor89 hasNextPage90 hasPreviousPage91 startCursor92 }93 }94}
1{2 "search": "<some search query>",3 "sort": { "createdAt": "Descending" },4 "filter": { "updatedAt": { "greaterThan": "2023-02-05T00:50:26.424Z" } },5 "first": 25,6 "after": "abcdefg"7}
Invoking Actions
Shopify Shop records are changed by invoking Actions. Actions are the things that "do" stuff -- update records, make API calls, call backend code, etc. Actions with a GraphQL API trigger 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:
1import {2 GadgetOperationError,3 InvalidRecordError,4} from "@gadget-client/example-app";56// must be in an async function to use `await` syntax7const runAction = async () => {8 try {9 return await api.exampleModel.create({10 exampleModel: { name: "example record name" },11 });12 } catch (error) {13 if (error instanceof GadgetOperationError) {14 // a recognized general error has occurred, retry the operation or inspect error.code`15 console.error(error);16 } else if (error instanceof InvalidRecordError) {17 // the submitted input data for the action was invalid, inspect the invalid fields which `InvalidRecordError` exposes18 console.error(error.validationErrors);19 } else {20 // 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 ti21 throw error;22 }23 }24};
For more information on error codes, consult the Errors documentation.
Shopify Shop create
Input
create
accepts the following input parameters:
1export interface CreateShopifyShopInput {2 id?: (Scalars["GadgetID"] | null) | null;34 customers?: (ShopifyCustomerHasManyInput | null)[];56 syncs?: (ShopifySyncHasManyInput | null)[];78 gdprRequests?: (ShopifyGdprRequestHasManyInput | null)[];910 address1?: (Scalars["String"] | null) | null;1112 address2?: (Scalars["String"] | null) | null;1314 checkoutApiSupported?: (Scalars["Boolean"] | null) | null;1516 city?: (Scalars["String"] | null) | null;1718 cookieConsentLevel?: (Scalars["String"] | null) | null;1920 country?: (Scalars["String"] | null) | null;2122 countryCode?: (Scalars["String"] | null) | null;2324 countryName?: (Scalars["String"] | null) | null;2526 countyTaxes?: (Scalars["JSON"] | null) | null;2728 shopifyCreatedAt?: Date | Scalars["ISO8601DateString"] | null;2930 currency?: (Scalars["String"] | null) | null;3132 customerEmail?: (Scalars["String"] | null) | null;3334 domain?: (Scalars["String"] | null) | null;3536 eligibleForCardReaderGiveaway?: (Scalars["Boolean"] | null) | null;3738 eligibleForPayments?: (Scalars["Boolean"] | null) | null;3940 email?: (Scalars["String"] | null) | null;4142 enabledPresentmentCurrencies?: (Scalars["JSON"] | null) | null;4344 finances?: (Scalars["Boolean"] | null) | null;4546 forceSsl?: (Scalars["Boolean"] | null) | null;4748 googleAppsDomain?: (Scalars["String"] | null) | null;4950 googleAppsLoginEnabled?: (Scalars["Boolean"] | null) | null;5152 hasDiscounts?: (Scalars["Boolean"] | null) | null;5354 hasGiftCards?: (Scalars["Boolean"] | null) | null;5556 hasStorefront?: (Scalars["Boolean"] | null) | null;5758 ianaTimezone?: (Scalars["String"] | null) | null;5960 latitude?: (Scalars["Float"] | null) | null;6162 longitude?: (Scalars["Float"] | null) | null;6364 moneyFormat?: (Scalars["String"] | null) | null;6566 moneyInEmailsFormat?: (Scalars["String"] | null) | null;6768 moneyWithCurrencyFormat?: (Scalars["String"] | null) | null;6970 moneyWithCurrencyInEmailsFormat?: (Scalars["String"] | null) | null;7172 multiLocationEnabled?: (Scalars["Boolean"] | null) | null;7374 myshopifyDomain?: (Scalars["String"] | null) | null;7576 name?: (Scalars["String"] | null) | null;7778 passwordEnabled?: (Scalars["Boolean"] | null) | null;7980 phone?: (Scalars["String"] | null) | null;8182 planDisplayName?: (Scalars["String"] | null) | null;8384 planName?: (Scalars["String"] | null) | null;8586 preLaunchEnabled?: (Scalars["Boolean"] | null) | null;8788 primaryLocale?: (Scalars["String"] | null) | null;8990 province?: (Scalars["String"] | null) | null;9192 provinceCode?: (Scalars["String"] | null) | null;9394 products?: (ShopifyProductHasManyInput | null)[];9596 productVariants?: (ShopifyProductVariantHasManyInput | null)[];9798 requiresExtraPaymentsAgreement?: (Scalars["Boolean"] | null) | null;99100 setupRequired?: (Scalars["Boolean"] | null) | null;101102 shopOwner?: (Scalars["String"] | null) | null;103104 source?: (Scalars["String"] | null) | null;105106 taxShipping?: (Scalars["Boolean"] | null) | null;107108 taxesIncluded?: (Scalars["Boolean"] | null) | null;109110 timezone?: (Scalars["String"] | null) | null;111112 shopifyUpdatedAt?: Date | Scalars["ISO8601DateString"] | null;113114 weightUnit?: (Scalars["String"] | null) | null;115116 zipCode?: (Scalars["String"] | null) | null;117118 tasks?: (TaskHasManyInput | null)[];119120 marketingSmsContentEnabledAtCheckout?: (Scalars["Boolean"] | null) | null;121122 transactionalSmsDisabled?: (Scalars["Boolean"] | null) | null;123}124125export interface CreateShopifyShopArguments {126 shopifyShop?: CreateShopifyShopInput | null;127}
1input CreateShopifyShopInput {2 id: GadgetID3 customers: [ShopifyCustomerHasManyInput]4 syncs: [ShopifySyncHasManyInput]5 gdprRequests: [ShopifyGdprRequestHasManyInput]6 address1: String7 address2: String8 checkoutApiSupported: Boolean9 city: String10 cookieConsentLevel: String11 country: String12 countryCode: String13 countryName: String14 countyTaxes: JSON15 shopifyCreatedAt: DateTime16 currency: String17 customerEmail: String18 domain: String19 eligibleForCardReaderGiveaway: Boolean20 eligibleForPayments: Boolean21 email: String22 enabledPresentmentCurrencies: JSON23 finances: Boolean24 forceSsl: Boolean25 googleAppsDomain: String26 googleAppsLoginEnabled: Boolean27 hasDiscounts: Boolean28 hasGiftCards: Boolean29 hasStorefront: Boolean30 ianaTimezone: String31 latitude: Float32 longitude: Float33 moneyFormat: String34 moneyInEmailsFormat: String35 moneyWithCurrencyFormat: String36 moneyWithCurrencyInEmailsFormat: String37 multiLocationEnabled: Boolean38 myshopifyDomain: String39 name: String40 passwordEnabled: Boolean41 phone: String42 planDisplayName: String43 planName: String44 preLaunchEnabled: Boolean45 primaryLocale: String46 province: String47 provinceCode: String48 products: [ShopifyProductHasManyInput]49 productVariants: [ShopifyProductVariantHasManyInput]50 requiresExtraPaymentsAgreement: Boolean51 setupRequired: Boolean52 shopOwner: String53 source: String54 taxShipping: Boolean55 taxesIncluded: Boolean56 timezone: String57 shopifyUpdatedAt: DateTime58 weightUnit: String59 zipCode: String60 tasks: [TaskHasManyInput]61 marketingSmsContentEnabledAtCheckout: Boolean62 transactionalSmsDisabled: Boolean63}6465input CreateShopifyShopArguments {66 shopifyShop: CreateShopifyShopInput67}
1const shopifyShopRecord = await api.shopifyShop.create({2 shopifyShop: {3 // field values for Shopify Shop4 },5});6console.log(shopifyShopRecord.id); //=> a string
1const [result, createShopifyShop] = useAction(api.shopifyShop.create);2const { data, error, fetching } = result;3await createShopifyShop({4 shopifyShop: {5 // field values for Shopify Shop6 },7});8console.log(data?.id); //=> a string
1mutation ($shopifyShop: CreateShopifyShopInput) {2 createShopifyShop(shopifyShop: $shopifyShop) {3 success4 errors {5 message6 ... on InvalidRecordError {7 validationErrors {8 apiIdentifier9 message10 }11 record12 model {13 apiIdentifier14 }15 }16 }17 shopifyShop {18 __typename19 id20 state21 accessToken22 address123 address224 checkoutApiSupported25 city26 cookieConsentLevel27 country28 countryCode29 countryName30 countyTaxes31 createdAt32 currency33 customerEmail34 domain35 eligibleForCardReaderGiveaway36 eligibleForPayments37 email38 enabledPresentmentCurrencies39 finances40 forceSsl41 googleAppsDomain42 googleAppsLoginEnabled43 grantedScopes44 hasDiscounts45 hasGiftCards46 hasStorefront47 ianaTimezone48 installedViaApiKey49 latitude50 longitude51 marketingSmsContentEnabledAtCheckout52 moneyFormat53 moneyInEmailsFormat54 moneyWithCurrencyFormat55 moneyWithCurrencyInEmailsFormat56 multiLocationEnabled57 myshopifyDomain58 name59 passwordEnabled60 phone61 planDisplayName62 planName63 preLaunchEnabled64 primaryLocale65 province66 provinceCode67 registeredWebhooks68 requiresExtraPaymentsAgreement69 setupRequired70 shopOwner71 shopifyCreatedAt72 shopifyUpdatedAt73 source74 taxShipping75 taxesIncluded76 timezone77 transactionalSmsDisabled78 updatedAt79 weightUnit80 zipCode81 }82 }83}
{ "shopifyShop": {} }
Output
create
returns the Shopify Shop. 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.
type CreateShopifyShopResult {success: Boolean!errors: [ExecutionError!]shopifyShop: ShopifyShop}
Shopify Shop update
Input
update
operates on one Shopify Shop in particular, identified by the id
variable.update
accepts the following input parameters:
1export interface UpdateShopifyShopInput {2 id?: (Scalars["GadgetID"] | null) | null;34 customers?: (ShopifyCustomerHasManyInput | null)[];56 syncs?: (ShopifySyncHasManyInput | null)[];78 gdprRequests?: (ShopifyGdprRequestHasManyInput | null)[];910 address1?: (Scalars["String"] | null) | null;1112 address2?: (Scalars["String"] | null) | null;1314 checkoutApiSupported?: (Scalars["Boolean"] | null) | null;1516 city?: (Scalars["String"] | null) | null;1718 cookieConsentLevel?: (Scalars["String"] | null) | null;1920 country?: (Scalars["String"] | null) | null;2122 countryCode?: (Scalars["String"] | null) | null;2324 countryName?: (Scalars["String"] | null) | null;2526 countyTaxes?: (Scalars["JSON"] | null) | null;2728 shopifyCreatedAt?: Date | Scalars["ISO8601DateString"] | null;2930 currency?: (Scalars["String"] | null) | null;3132 customerEmail?: (Scalars["String"] | null) | null;3334 domain?: (Scalars["String"] | null) | null;3536 eligibleForCardReaderGiveaway?: (Scalars["Boolean"] | null) | null;3738 eligibleForPayments?: (Scalars["Boolean"] | null) | null;3940 email?: (Scalars["String"] | null) | null;4142 enabledPresentmentCurrencies?: (Scalars["JSON"] | null) | null;4344 finances?: (Scalars["Boolean"] | null) | null;4546 forceSsl?: (Scalars["Boolean"] | null) | null;4748 googleAppsDomain?: (Scalars["String"] | null) | null;4950 googleAppsLoginEnabled?: (Scalars["Boolean"] | null) | null;5152 hasDiscounts?: (Scalars["Boolean"] | null) | null;5354 hasGiftCards?: (Scalars["Boolean"] | null) | null;5556 hasStorefront?: (Scalars["Boolean"] | null) | null;5758 ianaTimezone?: (Scalars["String"] | null) | null;5960 latitude?: (Scalars["Float"] | null) | null;6162 longitude?: (Scalars["Float"] | null) | null;6364 moneyFormat?: (Scalars["String"] | null) | null;6566 moneyInEmailsFormat?: (Scalars["String"] | null) | null;6768 moneyWithCurrencyFormat?: (Scalars["String"] | null) | null;6970 moneyWithCurrencyInEmailsFormat?: (Scalars["String"] | null) | null;7172 multiLocationEnabled?: (Scalars["Boolean"] | null) | null;7374 myshopifyDomain?: (Scalars["String"] | null) | null;7576 name?: (Scalars["String"] | null) | null;7778 passwordEnabled?: (Scalars["Boolean"] | null) | null;7980 phone?: (Scalars["String"] | null) | null;8182 planDisplayName?: (Scalars["String"] | null) | null;8384 planName?: (Scalars["String"] | null) | null;8586 preLaunchEnabled?: (Scalars["Boolean"] | null) | null;8788 primaryLocale?: (Scalars["String"] | null) | null;8990 province?: (Scalars["String"] | null) | null;9192 provinceCode?: (Scalars["String"] | null) | null;9394 products?: (ShopifyProductHasManyInput | null)[];9596 productVariants?: (ShopifyProductVariantHasManyInput | null)[];9798 requiresExtraPaymentsAgreement?: (Scalars["Boolean"] | null) | null;99100 setupRequired?: (Scalars["Boolean"] | null) | null;101102 shopOwner?: (Scalars["String"] | null) | null;103104 source?: (Scalars["String"] | null) | null;105106 taxShipping?: (Scalars["Boolean"] | null) | null;107108 taxesIncluded?: (Scalars["Boolean"] | null) | null;109110 timezone?: (Scalars["String"] | null) | null;111112 shopifyUpdatedAt?: Date | Scalars["ISO8601DateString"] | null;113114 weightUnit?: (Scalars["String"] | null) | null;115116 zipCode?: (Scalars["String"] | null) | null;117118 tasks?: (TaskHasManyInput | null)[];119120 marketingSmsContentEnabledAtCheckout?: (Scalars["Boolean"] | null) | null;121122 transactionalSmsDisabled?: (Scalars["Boolean"] | null) | null;123}124125export interface UpdateShopifyShopArguments {126 shopifyShop?: UpdateShopifyShopInput | null;127}
1input UpdateShopifyShopInput {2 id: GadgetID3 customers: [ShopifyCustomerHasManyInput]4 syncs: [ShopifySyncHasManyInput]5 gdprRequests: [ShopifyGdprRequestHasManyInput]6 address1: String7 address2: String8 checkoutApiSupported: Boolean9 city: String10 cookieConsentLevel: String11 country: String12 countryCode: String13 countryName: String14 countyTaxes: JSON15 shopifyCreatedAt: DateTime16 currency: String17 customerEmail: String18 domain: String19 eligibleForCardReaderGiveaway: Boolean20 eligibleForPayments: Boolean21 email: String22 enabledPresentmentCurrencies: JSON23 finances: Boolean24 forceSsl: Boolean25 googleAppsDomain: String26 googleAppsLoginEnabled: Boolean27 hasDiscounts: Boolean28 hasGiftCards: Boolean29 hasStorefront: Boolean30 ianaTimezone: String31 latitude: Float32 longitude: Float33 moneyFormat: String34 moneyInEmailsFormat: String35 moneyWithCurrencyFormat: String36 moneyWithCurrencyInEmailsFormat: String37 multiLocationEnabled: Boolean38 myshopifyDomain: String39 name: String40 passwordEnabled: Boolean41 phone: String42 planDisplayName: String43 planName: String44 preLaunchEnabled: Boolean45 primaryLocale: String46 province: String47 provinceCode: String48 products: [ShopifyProductHasManyInput]49 productVariants: [ShopifyProductVariantHasManyInput]50 requiresExtraPaymentsAgreement: Boolean51 setupRequired: Boolean52 shopOwner: String53 source: String54 taxShipping: Boolean55 taxesIncluded: Boolean56 timezone: String57 shopifyUpdatedAt: DateTime58 weightUnit: String59 zipCode: String60 tasks: [TaskHasManyInput]61 marketingSmsContentEnabledAtCheckout: Boolean62 transactionalSmsDisabled: Boolean63}6465input UpdateShopifyShopArguments {66 shopifyShop: UpdateShopifyShopInput67}
1const shopifyShopRecord = await api.shopifyShop.update("some-id", {2 shopifyShop: {3 // field values for Shopify Shop4 },5});6console.log(shopifyShopRecord.id); //=> a string
1const [result, updateShopifyShop] = useAction(api.shopifyShop.update);2const { data, error, fetching } = result;3await updateShopifyShop({4 id: "some-id",5 shopifyShop: {6 // field values for Shopify Shop7 },8});9console.log(data?.id); //=> a string
1mutation ($id: GadgetID!, $shopifyShop: UpdateShopifyShopInput) {2 updateShopifyShop(id: $id, shopifyShop: $shopifyShop) {3 success4 errors {5 message6 ... on InvalidRecordError {7 validationErrors {8 apiIdentifier9 message10 }11 record12 model {13 apiIdentifier14 }15 }16 }17 shopifyShop {18 __typename19 id20 state21 accessToken22 address123 address224 checkoutApiSupported25 city26 cookieConsentLevel27 country28 countryCode29 countryName30 countyTaxes31 createdAt32 currency33 customerEmail34 domain35 eligibleForCardReaderGiveaway36 eligibleForPayments37 email38 enabledPresentmentCurrencies39 finances40 forceSsl41 googleAppsDomain42 googleAppsLoginEnabled43 grantedScopes44 hasDiscounts45 hasGiftCards46 hasStorefront47 ianaTimezone48 installedViaApiKey49 latitude50 longitude51 marketingSmsContentEnabledAtCheckout52 moneyFormat53 moneyInEmailsFormat54 moneyWithCurrencyFormat55 moneyWithCurrencyInEmailsFormat56 multiLocationEnabled57 myshopifyDomain58 name59 passwordEnabled60 phone61 planDisplayName62 planName63 preLaunchEnabled64 primaryLocale65 province66 provinceCode67 registeredWebhooks68 requiresExtraPaymentsAgreement69 setupRequired70 shopOwner71 shopifyCreatedAt72 shopifyUpdatedAt73 source74 taxShipping75 taxesIncluded76 timezone77 transactionalSmsDisabled78 updatedAt79 weightUnit80 zipCode81 }82 }83}
{ "id": "some-id", "shopifyShop": {} }
Output
update
returns the Shopify Shop. 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.
type UpdateShopifyShopResult {success: Boolean!errors: [ExecutionError!]shopifyShop: ShopifyShop}
Shopify Shop delete
The delete
action destroys the record.
Input
delete
operates on one Shopify Shop in particular, identified by the id
variable.
await api.shopifyShop.delete("some-id");
const [result, deleteShopifyShop] = useAction(api.shopifyShop.delete);const { data, error, fetching } = result;await deleteShopifyShop({id: "some-id",});
1mutation ($id: GadgetID!) {2 deleteShopifyShop(id: $id) {3 success4 errors {5 message6 ... on InvalidRecordError {7 validationErrors {8 apiIdentifier