airbyte-source-shopify 2.5.17__tar.gz → 2.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/PKG-INFO +3 -3
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/pyproject.toml +1 -1
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/scopes.py +0 -2
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/source.py +0 -4
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/streams/streams.py +1 -65
- airbyte_source_shopify-2.5.17/source_shopify/schemas/customer_saved_search.json +0 -32
- airbyte_source_shopify-2.5.17/source_shopify/schemas/products_graph_ql.json +0 -123
- airbyte_source_shopify-2.5.17/source_shopify/shopify_graphql/graphql.py +0 -65
- airbyte_source_shopify-2.5.17/source_shopify/shopify_graphql/schema.py +0 -29443
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/README.md +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/__init__.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/auth.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/config_migrations.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/http_request.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/run.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/abandoned_checkouts.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/articles.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/balance_transactions.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/blogs.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/collections.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/collects.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/countries.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/custom_collections.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/customer_address.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/customer_journey_summary.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/customers.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/discount_codes.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/disputes.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/draft_orders.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/fulfillment_orders.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/fulfillments.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/inventory_items.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/inventory_levels.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/locations.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_articles.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_blogs.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_collections.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_customers.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_draft_orders.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_locations.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_orders.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_pages.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_product_images.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_product_variants.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_products.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_shops.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/metafield_smart_collections.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/order_agreements.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/order_refunds.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/order_risks.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/orders.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/pages.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/price_rules.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/product_images.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/product_variants.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/products.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/shop.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/smart_collections.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/tender_transactions.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/schemas/transactions.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/__init__.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/exceptions.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/job.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/query.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/record.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/retry.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/status.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/shopify_graphql/bulk/tools.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/spec.json +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/streams/base_streams.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/transform.py +0 -0
- {airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/utils.py +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: airbyte-source-shopify
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.0
|
|
4
4
|
Summary: Source CDK implementation for Shopify.
|
|
5
|
-
Home-page: https://airbyte.com
|
|
6
5
|
License: ELv2
|
|
7
6
|
Author: Airbyte
|
|
8
7
|
Author-email: contact@airbyte.io
|
|
@@ -15,6 +14,7 @@ Requires-Dist: airbyte-cdk (>=6,<7)
|
|
|
15
14
|
Requires-Dist: graphql-query (>=1,<2)
|
|
16
15
|
Requires-Dist: sgqlc (==16.3)
|
|
17
16
|
Project-URL: Documentation, https://docs.airbyte.com/integrations/sources/shopify
|
|
17
|
+
Project-URL: Homepage, https://airbyte.com
|
|
18
18
|
Project-URL: Repository, https://github.com/airbytehq/airbyte
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
|
|
@@ -19,7 +19,6 @@ SCOPES_MAPPING: Mapping[str, set[str]] = {
|
|
|
19
19
|
# SCOPE: read_customers
|
|
20
20
|
"Customers": ("read_customers",),
|
|
21
21
|
"MetafieldCustomers": ("read_customers",),
|
|
22
|
-
"CustomerSavedSearch": ("read_customers",),
|
|
23
22
|
"CustomerAddress": ("read_customers",),
|
|
24
23
|
# SCOPE: read_orders
|
|
25
24
|
"OrderAgreements": ("read_orders",),
|
|
@@ -38,7 +37,6 @@ SCOPES_MAPPING: Mapping[str, set[str]] = {
|
|
|
38
37
|
"MetafieldDraftOrders": ("read_draft_orders",),
|
|
39
38
|
# SCOPE: read_products
|
|
40
39
|
"Products": ("read_products",),
|
|
41
|
-
"ProductsGraphQl": ("read_products",),
|
|
42
40
|
"MetafieldProducts": ("read_products",),
|
|
43
41
|
"ProductImages": ("read_products",),
|
|
44
42
|
"MetafieldProductImages": ("read_products",),
|
|
@@ -27,7 +27,6 @@ from .streams.streams import (
|
|
|
27
27
|
CustomerAddress,
|
|
28
28
|
CustomerJourneySummary,
|
|
29
29
|
Customers,
|
|
30
|
-
CustomerSavedSearch,
|
|
31
30
|
DiscountCodes,
|
|
32
31
|
Disputes,
|
|
33
32
|
DraftOrders,
|
|
@@ -57,7 +56,6 @@ from .streams.streams import (
|
|
|
57
56
|
PriceRules,
|
|
58
57
|
ProductImages,
|
|
59
58
|
Products,
|
|
60
|
-
ProductsGraphQl,
|
|
61
59
|
ProductVariants,
|
|
62
60
|
Shop,
|
|
63
61
|
SmartCollections,
|
|
@@ -212,13 +210,11 @@ class SourceShopify(AbstractSource):
|
|
|
212
210
|
PriceRules(config),
|
|
213
211
|
ProductImages(config),
|
|
214
212
|
Products(config),
|
|
215
|
-
ProductsGraphQl(config),
|
|
216
213
|
ProductVariants(config),
|
|
217
214
|
Shop(config),
|
|
218
215
|
SmartCollections(config),
|
|
219
216
|
TenderTransactions(config),
|
|
220
217
|
self.select_transactions_stream(config),
|
|
221
|
-
CustomerSavedSearch(config),
|
|
222
218
|
CustomerAddress(config),
|
|
223
219
|
Countries(config),
|
|
224
220
|
]
|
{airbyte_source_shopify-2.5.17 → airbyte_source_shopify-2.6.0}/source_shopify/streams/streams.py
RENAMED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
#
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Mapping, MutableMapping
|
|
7
7
|
|
|
8
|
-
import requests
|
|
9
|
-
from requests.exceptions import RequestException
|
|
10
8
|
from source_shopify.shopify_graphql.bulk.query import (
|
|
11
9
|
Collection,
|
|
12
10
|
CustomerAddresses,
|
|
@@ -30,9 +28,6 @@ from source_shopify.shopify_graphql.bulk.query import (
|
|
|
30
28
|
ProductVariant,
|
|
31
29
|
Transaction,
|
|
32
30
|
)
|
|
33
|
-
from source_shopify.shopify_graphql.graphql import get_query_products
|
|
34
|
-
from source_shopify.utils import ApiTypeEnum
|
|
35
|
-
from source_shopify.utils import ShopifyRateLimiter as limiter
|
|
36
31
|
|
|
37
32
|
from airbyte_cdk.sources.streams.core import package_name_from_class
|
|
38
33
|
from airbyte_cdk.sources.utils.schema_helpers import ResourceSchemaLoader
|
|
@@ -120,57 +115,6 @@ class Products(IncrementalShopifyGraphQlBulkStream):
|
|
|
120
115
|
bulk_query: Product = Product
|
|
121
116
|
|
|
122
117
|
|
|
123
|
-
class ProductsGraphQl(IncrementalShopifyStream):
|
|
124
|
-
filter_field = "updatedAt"
|
|
125
|
-
cursor_field = "updatedAt"
|
|
126
|
-
data_field = "graphql"
|
|
127
|
-
http_method = "POST"
|
|
128
|
-
# pin the old api_version before this stream is deprecated
|
|
129
|
-
api_version = "2023-07"
|
|
130
|
-
|
|
131
|
-
def request_params(
|
|
132
|
-
self,
|
|
133
|
-
stream_state: Optional[Mapping[str, Any]] = None,
|
|
134
|
-
next_page_token: Optional[Mapping[str, Any]] = None,
|
|
135
|
-
**kwargs,
|
|
136
|
-
) -> MutableMapping[str, Any]:
|
|
137
|
-
return {}
|
|
138
|
-
|
|
139
|
-
def request_body_json(
|
|
140
|
-
self,
|
|
141
|
-
stream_state: Mapping[str, Any],
|
|
142
|
-
stream_slice: Optional[Mapping[str, Any]] = None,
|
|
143
|
-
next_page_token: Optional[Mapping[str, Any]] = None,
|
|
144
|
-
) -> Optional[Mapping]:
|
|
145
|
-
state_value = stream_state.get(self.filter_field)
|
|
146
|
-
if state_value:
|
|
147
|
-
filter_value = state_value
|
|
148
|
-
else:
|
|
149
|
-
filter_value = self.default_filter_field_value
|
|
150
|
-
query = get_query_products(
|
|
151
|
-
first=self.limit, filter_field=self.filter_field, filter_value=filter_value, next_page_token=next_page_token
|
|
152
|
-
)
|
|
153
|
-
return {"query": query}
|
|
154
|
-
|
|
155
|
-
@staticmethod
|
|
156
|
-
def next_page_token(response: requests.Response) -> Optional[Mapping[str, Any]]:
|
|
157
|
-
page_info = response.json()["data"]["products"]["pageInfo"]
|
|
158
|
-
has_next_page = page_info["hasNextPage"]
|
|
159
|
-
if has_next_page:
|
|
160
|
-
return page_info["endCursor"]
|
|
161
|
-
else:
|
|
162
|
-
return None
|
|
163
|
-
|
|
164
|
-
@limiter.balance_rate_limit(api_type=ApiTypeEnum.graphql.value)
|
|
165
|
-
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
|
|
166
|
-
if response.status_code is requests.codes.OK:
|
|
167
|
-
try:
|
|
168
|
-
json_response = response.json()["data"]["products"]["nodes"]
|
|
169
|
-
yield from self.produce_records(json_response)
|
|
170
|
-
except RequestException as e:
|
|
171
|
-
self.logger.warning(f"Unexpected error in `parse_ersponse`: {e}, the actual response data: {response.text}")
|
|
172
|
-
|
|
173
|
-
|
|
174
118
|
class MetafieldProducts(IncrementalShopifyGraphQlBulkStream):
|
|
175
119
|
parent_stream_class = Products
|
|
176
120
|
bulk_query: MetafieldProduct = MetafieldProduct
|
|
@@ -377,14 +321,6 @@ class MetafieldShops(IncrementalShopifyStream):
|
|
|
377
321
|
data_field = "metafields"
|
|
378
322
|
|
|
379
323
|
|
|
380
|
-
class CustomerSavedSearch(IncrementalShopifyStream):
|
|
381
|
-
api_version = "2022-01"
|
|
382
|
-
cursor_field = "id"
|
|
383
|
-
order_field = "id"
|
|
384
|
-
data_field = "customer_saved_searches"
|
|
385
|
-
filter_field = "since_id"
|
|
386
|
-
|
|
387
|
-
|
|
388
324
|
class CustomerAddress(IncrementalShopifyGraphQlBulkStream):
|
|
389
325
|
parent_stream_class = Customers
|
|
390
326
|
bulk_query: CustomerAddresses = CustomerAddresses
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": ["null", "object"],
|
|
3
|
-
"additionalProperties": true,
|
|
4
|
-
"properties": {
|
|
5
|
-
"created_at": {
|
|
6
|
-
"description": "The date and time when the customer saved search was created.",
|
|
7
|
-
"type": ["null", "string"],
|
|
8
|
-
"format": "date-time"
|
|
9
|
-
},
|
|
10
|
-
"id": {
|
|
11
|
-
"description": "The unique identifier for the customer saved search.",
|
|
12
|
-
"type": ["null", "integer"]
|
|
13
|
-
},
|
|
14
|
-
"name": {
|
|
15
|
-
"description": "The name given to the customer saved search.",
|
|
16
|
-
"type": ["null", "string"]
|
|
17
|
-
},
|
|
18
|
-
"query": {
|
|
19
|
-
"description": "The search query string or parameters used for this saved search.",
|
|
20
|
-
"type": ["null", "string"]
|
|
21
|
-
},
|
|
22
|
-
"shop_url": {
|
|
23
|
-
"description": "The URL of the shop associated with this customer saved search.",
|
|
24
|
-
"type": ["null", "string"]
|
|
25
|
-
},
|
|
26
|
-
"updated_at": {
|
|
27
|
-
"description": "The date and time when the customer saved search was last updated.",
|
|
28
|
-
"type": ["null", "string"],
|
|
29
|
-
"format": "date-time"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema#",
|
|
3
|
-
"properties": {
|
|
4
|
-
"createdAt": {
|
|
5
|
-
"description": "The date and time when the product was created.",
|
|
6
|
-
"type": "string"
|
|
7
|
-
},
|
|
8
|
-
"description": {
|
|
9
|
-
"description": "The product's description.",
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"descriptionHtml": {
|
|
13
|
-
"description": "The product's description in HTML format.",
|
|
14
|
-
"type": "string"
|
|
15
|
-
},
|
|
16
|
-
"handle": {
|
|
17
|
-
"description": "The unique URL-friendly handle of the product.",
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"id": {
|
|
21
|
-
"description": "The unique identifier of the product.",
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"isGiftCard": {
|
|
25
|
-
"description": "Indicates whether the product is a gift card.",
|
|
26
|
-
"type": "boolean"
|
|
27
|
-
},
|
|
28
|
-
"legacyResourceId": {
|
|
29
|
-
"description": "The legacy resource ID of the product.",
|
|
30
|
-
"type": "string"
|
|
31
|
-
},
|
|
32
|
-
"mediaCount": {
|
|
33
|
-
"description": "The total count of media (images/videos) associated with the product.",
|
|
34
|
-
"type": "integer"
|
|
35
|
-
},
|
|
36
|
-
"onlineStorePreviewUrl": {
|
|
37
|
-
"description": "The URL for previewing the product on the online store.",
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"onlineStoreUrl": {
|
|
41
|
-
"description": "The URL of the product on the online store.",
|
|
42
|
-
"type": ["null", "string"]
|
|
43
|
-
},
|
|
44
|
-
"options": {
|
|
45
|
-
"description": "Represents various options available for the product",
|
|
46
|
-
"items": {
|
|
47
|
-
"properties": {
|
|
48
|
-
"id": {
|
|
49
|
-
"description": "The unique identifier of the option.",
|
|
50
|
-
"type": "string"
|
|
51
|
-
},
|
|
52
|
-
"name": {
|
|
53
|
-
"description": "The name of the option.",
|
|
54
|
-
"type": "string"
|
|
55
|
-
},
|
|
56
|
-
"position": {
|
|
57
|
-
"description": "The position of the option.",
|
|
58
|
-
"type": "integer"
|
|
59
|
-
},
|
|
60
|
-
"values": {
|
|
61
|
-
"description": "Contains the different values for the options",
|
|
62
|
-
"items": {
|
|
63
|
-
"description": "The possible values for the option.",
|
|
64
|
-
"type": "string"
|
|
65
|
-
},
|
|
66
|
-
"type": "array"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"type": "object"
|
|
70
|
-
},
|
|
71
|
-
"type": "array"
|
|
72
|
-
},
|
|
73
|
-
"productType": {
|
|
74
|
-
"description": "The type or category of the product.",
|
|
75
|
-
"type": "string"
|
|
76
|
-
},
|
|
77
|
-
"publishedAt": {
|
|
78
|
-
"description": "The date and time when the product was published.",
|
|
79
|
-
"type": ["null", "string"]
|
|
80
|
-
},
|
|
81
|
-
"shop_url": {
|
|
82
|
-
"description": "The URL of the shop where the product is listed.",
|
|
83
|
-
"type": "string"
|
|
84
|
-
},
|
|
85
|
-
"status": {
|
|
86
|
-
"description": "The status of the product.",
|
|
87
|
-
"type": "string"
|
|
88
|
-
},
|
|
89
|
-
"tags": {
|
|
90
|
-
"description": "Contains tags associated with the product",
|
|
91
|
-
"items": {
|
|
92
|
-
"description": "The tags associated with the product.",
|
|
93
|
-
"type": "string"
|
|
94
|
-
},
|
|
95
|
-
"type": "array"
|
|
96
|
-
},
|
|
97
|
-
"title": {
|
|
98
|
-
"description": "The title or name of the product.",
|
|
99
|
-
"type": "string"
|
|
100
|
-
},
|
|
101
|
-
"totalInventory": {
|
|
102
|
-
"description": "The total inventory count of the product.",
|
|
103
|
-
"type": "integer"
|
|
104
|
-
},
|
|
105
|
-
"totalVariants": {
|
|
106
|
-
"description": "The total number of variants available for the product.",
|
|
107
|
-
"type": "integer"
|
|
108
|
-
},
|
|
109
|
-
"tracksInventory": {
|
|
110
|
-
"description": "Indicates whether inventory tracking is enabled for the product.",
|
|
111
|
-
"type": "boolean"
|
|
112
|
-
},
|
|
113
|
-
"updatedAt": {
|
|
114
|
-
"description": "The date and time when the product was last updated.",
|
|
115
|
-
"type": "string"
|
|
116
|
-
},
|
|
117
|
-
"vendor": {
|
|
118
|
-
"description": "The vendor or manufacturer of the product.",
|
|
119
|
-
"type": "string"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"type": "object"
|
|
123
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
from typing import Optional
|
|
7
|
-
|
|
8
|
-
import sgqlc.operation
|
|
9
|
-
|
|
10
|
-
from . import schema
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
_schema = schema
|
|
14
|
-
_schema_root = _schema.shopify_schema
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# the graphql api requires the query filter to be snake case even though the column returned is camel case
|
|
18
|
-
def _camel_to_snake(camel_case: str):
|
|
19
|
-
snake_case = []
|
|
20
|
-
for char in camel_case:
|
|
21
|
-
if char.isupper():
|
|
22
|
-
snake_case.append("_" + char.lower())
|
|
23
|
-
else:
|
|
24
|
-
snake_case.append(char)
|
|
25
|
-
return "".join(snake_case).lstrip("_")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_query_products(first: int, filter_field: str, filter_value: str, next_page_token: Optional[str]):
|
|
29
|
-
op = sgqlc.operation.Operation(_schema_root.query_type)
|
|
30
|
-
snake_case_filter_field = _camel_to_snake(filter_field)
|
|
31
|
-
products_args = {
|
|
32
|
-
"first": first,
|
|
33
|
-
"query": f"{snake_case_filter_field}:>'{filter_value}'" if filter_value else None,
|
|
34
|
-
"after": next_page_token,
|
|
35
|
-
}
|
|
36
|
-
products = op.products(**products_args)
|
|
37
|
-
products.nodes.id()
|
|
38
|
-
products.nodes.title()
|
|
39
|
-
products.nodes.updated_at()
|
|
40
|
-
products.nodes.created_at()
|
|
41
|
-
products.nodes.published_at()
|
|
42
|
-
products.nodes.status()
|
|
43
|
-
products.nodes.vendor()
|
|
44
|
-
products.nodes.product_type()
|
|
45
|
-
products.nodes.tags()
|
|
46
|
-
products.nodes.options()
|
|
47
|
-
products.nodes.options().id()
|
|
48
|
-
products.nodes.options().name()
|
|
49
|
-
products.nodes.options().position()
|
|
50
|
-
products.nodes.options().values()
|
|
51
|
-
products.nodes.handle()
|
|
52
|
-
products.nodes.description()
|
|
53
|
-
products.nodes.tracks_inventory()
|
|
54
|
-
products.nodes.total_inventory()
|
|
55
|
-
products.nodes.total_variants()
|
|
56
|
-
products.nodes.online_store_url()
|
|
57
|
-
products.nodes.online_store_preview_url()
|
|
58
|
-
products.nodes.description_html()
|
|
59
|
-
products.nodes.is_gift_card()
|
|
60
|
-
products.nodes.legacy_resource_id()
|
|
61
|
-
products.nodes.media_count()
|
|
62
|
-
products.page_info()
|
|
63
|
-
products.page_info.has_next_page()
|
|
64
|
-
products.page_info.end_cursor()
|
|
65
|
-
return str(op)
|