@foxtware/mineral 0.1.15 → 0.1.16
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.
- package/.creds.yml.sample +34 -0
- package/AGENTS.md +5 -0
- package/_build_scripts/createNewFunction.js +19 -19
- package/api/_example.js +6 -3
- package/api/_tools/log.js +22 -0
- package/api/algolia/docs.md +7 -0
- package/api/asana/asana.constants.js +7 -0
- package/api/asana/asana.utils.js +37 -0
- package/api/asana/asanaGet.js +150 -0
- package/api/asana/docs.md +5 -0
- package/api/athos/docs.md +9 -0
- package/api/bleckmann/bleckmannAsnsGet.js +3 -1
- package/api/clickup/clickup.constants.js +7 -0
- package/api/clickup/clickup.utils.js +36 -0
- package/api/clickup/clickupGet.js +150 -0
- package/api/clickup/docs.md +6 -0
- package/api/discord/discord.constants.js +7 -0
- package/api/discord/discord.utils.js +36 -0
- package/api/discord/discordGet.js +144 -0
- package/api/discord/docs.md +6 -0
- package/api/etsy/_example.get.js +68 -0
- package/api/etsy/etsy.constants.js +33 -0
- package/api/etsy/etsy.utils.js +208 -0
- package/api/etsy/etsyAccessTokenRefresh.js +106 -0
- package/api/etsy/etsyAccessTokenRequest.js +118 -0
- package/api/etsy/etsyAllListingFilesGet.js +69 -0
- package/api/etsy/etsyAllListingsGetActive.js +88 -0
- package/api/etsy/etsyAuthorizationCodeRequest.js +124 -0
- package/api/etsy/etsyBuyerTaxonomyNodePropertiesGet.js +62 -0
- package/api/etsy/etsyBuyerTaxonomyNodesGet.js +58 -0
- package/api/etsy/etsyDraftListingCreate.js +71 -0
- package/api/etsy/etsyFeaturedListingsByShopGet.js +78 -0
- package/api/etsy/etsyGet.js +150 -0
- package/api/etsy/etsyHolidayPreferencesGet.js +65 -0
- package/api/etsy/etsyHolidayPreferencesUpdate.js +75 -0
- package/api/etsy/etsyListingDelete.js +61 -0
- package/api/etsy/etsyListingFileDelete.js +72 -0
- package/api/etsy/etsyListingFileGet.js +73 -0
- package/api/etsy/etsyListingGet.js +62 -0
- package/api/etsy/etsyListingImageDelete.js +72 -0
- package/api/etsy/etsyListingImageGet.js +66 -0
- package/api/etsy/etsyListingImagesGet.js +62 -0
- package/api/etsy/etsyListingInventoryGet.js +62 -0
- package/api/etsy/etsyListingInventoryUpdate.js +99 -0
- package/api/etsy/etsyListingOfferingGet.js +70 -0
- package/api/etsy/etsyListingPersonalizationDelete.js +68 -0
- package/api/etsy/etsyListingPersonalizationGet.js +62 -0
- package/api/etsy/etsyListingPersonalizationUpdate.js +75 -0
- package/api/etsy/etsyListingProductGet.js +64 -0
- package/api/etsy/etsyListingPropertiesGet.js +69 -0
- package/api/etsy/etsyListingPropertyDelete.js +72 -0
- package/api/etsy/etsyListingPropertyGet.js +66 -0
- package/api/etsy/etsyListingPropertyUpdate.js +79 -0
- package/api/etsy/etsyListingTranslationCreate.js +79 -0
- package/api/etsy/etsyListingTranslationGet.js +73 -0
- package/api/etsy/etsyListingTranslationUpdate.js +79 -0
- package/api/etsy/etsyListingUpdate.js +75 -0
- package/api/etsy/etsyListingVariationImagesGet.js +69 -0
- package/api/etsy/etsyListingVideoDelete.js +72 -0
- package/api/etsy/etsyListingVideoGet.js +66 -0
- package/api/etsy/etsyListingVideosGet.js +62 -0
- package/api/etsy/etsyListingsByListingIdsGet.js +63 -0
- package/api/etsy/etsyListingsByShopReceiptGet.js +82 -0
- package/api/etsy/etsyListingsByShopReturnPolicyGet.js +69 -0
- package/api/etsy/etsyListingsInventoryByListingIdsGet.js +63 -0
- package/api/etsy/etsyListingsShippingByListingIdsGet.js +63 -0
- package/api/etsy/etsyMeGet.js +56 -0
- package/api/etsy/etsyOauthRedirectParse.js +201 -0
- package/api/etsy/etsyPaymentAccountLedgerEntryPaymentsGet.js +65 -0
- package/api/etsy/etsyPaymentsGet.js +65 -0
- package/api/etsy/etsyPing.js +51 -0
- package/api/etsy/etsyReceiptShipmentCreate.js +75 -0
- package/api/etsy/etsyReviewsByListingGet.js +76 -0
- package/api/etsy/etsyReviewsByShopGet.js +80 -0
- package/api/etsy/etsySellerTaxonomyNodePropertiesGet.js +62 -0
- package/api/etsy/etsySellerTaxonomyNodesGet.js +58 -0
- package/api/etsy/etsyShippingCarriersGet.js +63 -0
- package/api/etsy/etsyShopGet.js +65 -0
- package/api/etsy/etsyShopListingsActiveGet.js +82 -0
- package/api/etsy/etsyShopListingsGet.js +87 -0
- package/api/etsy/etsyShopPaymentAccountLedgerEntriesGet.js +80 -0
- package/api/etsy/etsyShopPaymentAccountLedgerEntryGet.js +69 -0
- package/api/etsy/etsyShopPaymentByReceiptIdGet.js +69 -0
- package/api/etsy/etsyShopProductionPartnersGet.js +65 -0
- package/api/etsy/etsyShopReadinessStateDefinitionCreate.js +71 -0
- package/api/etsy/etsyShopReadinessStateDefinitionDelete.js +68 -0
- package/api/etsy/etsyShopReadinessStateDefinitionGet.js +69 -0
- package/api/etsy/etsyShopReadinessStateDefinitionUpdate.js +75 -0
- package/api/etsy/etsyShopReadinessStateDefinitionsGet.js +78 -0
- package/api/etsy/etsyShopReceiptGet.js +67 -0
- package/api/etsy/etsyShopReceiptTransactionGet.js +69 -0
- package/api/etsy/etsyShopReceiptTransactionsByListingGet.js +82 -0
- package/api/etsy/etsyShopReceiptTransactionsByReceiptGet.js +69 -0
- package/api/etsy/etsyShopReceiptTransactionsByShopGet.js +78 -0
- package/api/etsy/etsyShopReceiptUpdate.js +75 -0
- package/api/etsy/etsyShopReceiptsGet.js +70 -0
- package/api/etsy/etsyShopReturnPoliciesConsolidate.js +75 -0
- package/api/etsy/etsyShopReturnPolicyCreate.js +71 -0
- package/api/etsy/etsyShopReturnPolicyDelete.js +68 -0
- package/api/etsy/etsyShopReturnPolicyGet.js +69 -0
- package/api/etsy/etsyShopReturnPolicyUpdate.js +75 -0
- package/api/etsy/etsyShopReturnsPoliciesGet.js +70 -0
- package/api/etsy/etsyShopSectionCreate.js +71 -0
- package/api/etsy/etsyShopSectionDelete.js +68 -0
- package/api/etsy/etsyShopSectionGet.js +69 -0
- package/api/etsy/etsyShopSectionListingsGet.js +86 -0
- package/api/etsy/etsyShopSectionUpdate.js +75 -0
- package/api/etsy/etsyShopSectionsGet.js +65 -0
- package/api/etsy/etsyShopShippingProfileCreate.js +71 -0
- package/api/etsy/etsyShopShippingProfileDelete.js +68 -0
- package/api/etsy/etsyShopShippingProfileDestinationCreate.js +75 -0
- package/api/etsy/etsyShopShippingProfileDestinationDelete.js +72 -0
- package/api/etsy/etsyShopShippingProfileDestinationUpdate.js +79 -0
- package/api/etsy/etsyShopShippingProfileDestinationsByShippingProfileGet.js +82 -0
- package/api/etsy/etsyShopShippingProfileGet.js +69 -0
- package/api/etsy/etsyShopShippingProfileUpdate.js +75 -0
- package/api/etsy/etsyShopShippingProfileUpgradeCreate.js +75 -0
- package/api/etsy/etsyShopShippingProfileUpgradeDelete.js +72 -0
- package/api/etsy/etsyShopShippingProfileUpgradeUpdate.js +79 -0
- package/api/etsy/etsyShopShippingProfileUpgradesGet.js +69 -0
- package/api/etsy/etsyShopShippingProfilesGet.js +65 -0
- package/api/etsy/etsyShopUpdate.js +69 -0
- package/api/etsy/etsyShopsGet.js +70 -0
- package/api/etsy/etsyTokenScopes.js +63 -0
- package/api/etsy/etsyUserAddressDelete.js +61 -0
- package/api/etsy/etsyUserAddressGet.js +62 -0
- package/api/etsy/etsyUserAddressesGet.js +70 -0
- package/api/etsy/etsyUserGet.js +62 -0
- package/api/etsy/etsyUserShopsGet.js +62 -0
- package/api/etsy/etsyVariationImagesUpdate.js +75 -0
- package/api/figma/docs.md +6 -0
- package/api/figma/figma.constants.js +7 -0
- package/api/figma/figma.utils.js +36 -0
- package/api/figma/figmaGet.js +107 -0
- package/api/github/githubReposGet.js +3 -1
- package/api/github/githubUserGet.js +3 -1
- package/api/google/docs.md +7 -0
- package/api/google/google.constants.js +9 -0
- package/api/google/google.utils.js +137 -0
- package/api/google/googlecalendarCalendarsGet.js +54 -0
- package/api/google/googlecalendarEventCreate.js +63 -0
- package/api/google/googlecalendarEventDelete.js +55 -0
- package/api/google/googlecalendarEventGet.js +55 -0
- package/api/google/googlecalendarEventsGet.js +65 -0
- package/api/google/googledriveFileDelete.js +53 -0
- package/api/google/googledriveFileGet.js +57 -0
- package/api/google/googledriveFileUpload.js +127 -0
- package/api/google/googledriveFilesGet.js +72 -0
- package/api/google/googlesheetsSpreadsheetGet.js +57 -0
- package/api/google/googlesheetsSpreadsheetSheetAdd.js +150 -0
- package/api/google/googlesheetsSpreadsheetSheetGetData.js +159 -0
- package/api/google/googlesheetsSpreadsheetTrim.js +239 -0
- package/api/gorgias/docs.md +7 -0
- package/api/logiwa/logiwaAuthGet.js +3 -1
- package/api/logiwa/logiwaInventoriesGet.js +3 -1
- package/api/logiwa/logiwaOrdersGet.js +3 -1
- package/api/logiwa/logiwaProductsGet.js +3 -1
- package/api/logiwa/logiwaReportGetInventorySnapshot.js +3 -1
- package/api/logiwa/logiwaReportGetTotalInventory.js +3 -1
- package/api/logiwa/logiwaWebhooksGet.js +3 -1
- package/api/loop/loopAllowlistItemsGet.js +3 -1
- package/api/loop/loopBlocklistItemsGet.js +3 -1
- package/api/loop/loopDestinationsGet.js +3 -1
- package/api/loop/loopReturnsGet.js +3 -1
- package/api/notion/docs.md +6 -0
- package/api/notion/notion.constants.js +9 -0
- package/api/notion/notion.utils.js +44 -0
- package/api/notion/notionGet.js +146 -0
- package/api/peoplevox/_example.js +4 -1
- package/api/peoplevox/peoplevox.sessions.js +29 -0
- package/api/peoplevox/peoplevox.utils.js +4 -38
- package/api/peoplevox/peoplevoxAuthGet.js +3 -1
- package/api/peoplevox/peoplevoxGetSingle.js +4 -2
- package/api/peoplevox/peoplevoxOrderEdit.js +8 -2
- package/api/peoplevox/peoplevoxOrderGet.js +6 -1
- package/api/peoplevox/peoplevoxReportGet.js +6 -2
- package/api/pipe17/docs.md +8 -0
- package/api/pipe17/pipe17.constants.js +47 -0
- package/api/pipe17/pipe17.utils.js +123 -0
- package/api/pipe17/pipe17ArrivalGet.js +78 -0
- package/api/pipe17/pipe17ArrivalUpdate.js +111 -0
- package/api/pipe17/pipe17ArrivalsGet.js +54 -0
- package/api/pipe17/pipe17FulfillmentGet.js +69 -0
- package/api/pipe17/pipe17FulfillmentsGet.js +54 -0
- package/api/pipe17/pipe17Get.js +151 -0
- package/api/pipe17/pipe17InventoryItemGet.js +57 -0
- package/api/pipe17/pipe17InventoryItemsGet.js +54 -0
- package/api/pipe17/pipe17JobCreate.js +95 -0
- package/api/pipe17/pipe17JobGet.js +70 -0
- package/api/pipe17/pipe17JobResultsGet.js +55 -0
- package/api/pipe17/pipe17LocationGet.js +57 -0
- package/api/pipe17/pipe17LocationsGet.js +54 -0
- package/api/pipe17/pipe17OrderGet.js +71 -0
- package/api/pipe17/pipe17OrdersGet.js +54 -0
- package/api/pipe17/pipe17ProductGet.js +57 -0
- package/api/pipe17/pipe17ProductsGet.js +54 -0
- package/api/pipe17/pipe17PurchaseGet.js +57 -0
- package/api/pipe17/pipe17PurchasesGet.js +54 -0
- package/api/pipe17/pipe17ReceiptGet.js +57 -0
- package/api/pipe17/pipe17ReceiptsGet.js +54 -0
- package/api/pipe17/pipe17ReturnGet.js +57 -0
- package/api/pipe17/pipe17ReturnsGet.js +54 -0
- package/api/printify/_example.get.js +67 -0
- package/api/printify/_example.js +59 -0
- package/api/printify/printify.constants.js +8 -0
- package/api/printify/printify.utils.js +41 -0
- package/api/printify/printifyBlueprintGet.js +60 -0
- package/api/printify/printifyBlueprintPrintProviderVariantsGet.js +77 -0
- package/api/printify/printifyBlueprintPrintProvidersGet.js +60 -0
- package/api/printify/printifyBlueprintsGet.js +38 -0
- package/api/printify/printifyGet.js +154 -0
- package/api/printify/printifyImageUpload.js +74 -0
- package/api/printify/printifyOrderCancel.js +70 -0
- package/api/printify/printifyOrderCreate.js +98 -0
- package/api/printify/printifyOrderGet.js +70 -0
- package/api/printify/printifyOrderSubmit.js +70 -0
- package/api/printify/printifyOrdersGet.js +72 -0
- package/api/printify/printifyProductCreate.js +96 -0
- package/api/printify/printifyProductDelete.js +70 -0
- package/api/printify/printifyProductGet.js +79 -0
- package/api/printify/printifyProductUpdate.js +81 -0
- package/api/printify/printifyProductsGet.js +67 -0
- package/api/printify/printifyShippingGet.js +70 -0
- package/api/printify/printifyShopsGet.js +56 -0
- package/api/printify/printifyWebhookCreate.js +84 -0
- package/api/printify/printifyWebhookDelete.js +70 -0
- package/api/printify/printifyWebhookUpdate.js +81 -0
- package/api/printify/printifyWebhooksGet.js +56 -0
- package/api/salesforce/docs.md +6 -0
- package/api/shopify/_example.create.js +2 -2
- package/api/shopify/_example.get.js +17 -4
- package/api/shopify/_example.getsingle.js +4 -1
- package/api/shopify/_example.js +4 -1
- package/api/shopify/_example.mutation.js +4 -1
- package/api/shopify/shopifyAbandonedCheckoutsGet.js +1 -1
- package/api/shopify/shopifyArticlesGet.js +1 -1
- package/api/shopify/shopifyBlogsGet.js +1 -1
- package/api/shopify/shopifyBulkMutationDo.js +2 -2
- package/api/shopify/shopifyBulkOperationsGet.js +1 -1
- package/api/shopify/shopifyCatalogsGet.js +17 -4
- package/api/shopify/shopifyChannelsGet.js +17 -4
- package/api/shopify/shopifyCheckoutAndAccountsConfigurationsGet.js +17 -4
- package/api/shopify/shopifyCollectionGet.js +4 -1
- package/api/shopify/shopifyCollectionsGet.js +17 -4
- package/api/shopify/shopifyCustomerCreate.js +2 -2
- package/api/shopify/shopifyCustomerGet.js +4 -1
- package/api/shopify/shopifyCustomerMarketingConsentUpdateSms.js +84 -0
- package/api/shopify/shopifyCustomersGet.js +18 -5
- package/api/shopify/shopifyDecodeSessionToken.js +2 -2
- package/api/shopify/shopifyDeliveryCustomizationsGet.js +1 -1
- package/api/shopify/shopifyDeliveryProfilesGet.js +17 -4
- package/api/shopify/shopifyDiscountNodesGet.js +1 -1
- package/api/shopify/shopifyDisputesGet.js +1 -1
- package/api/shopify/shopifyDraftOrdersGet.js +1 -1
- package/api/shopify/shopifyEventsGet.js +1 -1
- package/api/shopify/shopifyFilesGet.js +1 -1
- package/api/shopify/shopifyFulfillmentOrdersGet.js +17 -4
- package/api/shopify/shopifyGet.js +1 -1
- package/api/shopify/shopifyGiftCardCreate.js +4 -1
- package/api/shopify/shopifyGiftCardDeactivate.js +4 -1
- package/api/shopify/shopifyGiftCardsGet.js +17 -4
- package/api/shopify/shopifyInventoryItemsGet.js +17 -4
- package/api/shopify/shopifyLocationsGet.js +1 -1
- package/api/shopify/shopifyMarketingEventsGet.js +1 -1
- package/api/shopify/shopifyMarketsGet.js +1 -1
- package/api/shopify/shopifyMenusGet.js +1 -1
- package/api/shopify/shopifyMetafieldDefinitionCreate.js +111 -0
- package/api/shopify/shopifyMetafieldDefinitionsGet.js +18 -4
- package/api/shopify/shopifyMetafieldsDelete.js +78 -0
- package/api/shopify/shopifyMetaobjectDefinitionsGet.js +1 -1
- package/api/shopify/shopifyMetaobjectsGet.js +1 -1
- package/api/shopify/shopifyMutationDo.js +4 -1
- package/api/shopify/shopifyOrderGet.js +4 -1
- package/api/shopify/shopifyOrdersGet.js +3 -1
- package/api/shopify/shopifyPageDelete.js +4 -1
- package/api/shopify/shopifyPageGet.js +4 -1
- package/api/shopify/shopifyPageUpdate.js +5 -1
- package/api/shopify/shopifyPagesGet.js +1 -1
- package/api/shopify/shopifyPaymentCustomizationsGet.js +1 -1
- package/api/shopify/shopifyProductFeedsGet.js +1 -1
- package/api/shopify/shopifyProductGet.js +110 -0
- package/api/shopify/shopifyProductVariantsGet.js +1 -1
- package/api/shopify/shopifyProductsGet.js +17 -4
- package/api/shopify/shopifyPublicationsGet.js +17 -4
- package/api/shopify/shopifySegmentsGet.js +1 -1
- package/api/shopify/shopifyStoreCreditAccountCredit.js +144 -0
- package/api/shopify/shopifyStoreCreditAccountDebit.js +132 -0
- package/api/shopify/shopifyThemeDelete.js +4 -1
- package/api/shopify/shopifyThemeDuplicate.js +4 -1
- package/api/shopify/shopifyThemeGet.js +2 -2
- package/api/shopify/shopifyThemesGet.js +3 -1
- package/api/shopify/shopifyUrlRedirectsGet.js +1 -1
- package/api/shopify/shopifyWebhookSubscriptionsGet.js +17 -4
- package/api/snowflake/docs.md +8 -0
- package/api/starshipit/starshipitAddressesGet.js +3 -1
- package/api/starshipit/starshipitOrdersListShipped.js +3 -1
- package/api/starshipit/starshipitProductsGet.js +3 -1
- package/api/stripe/_example.js +4 -1
- package/api/stripe/stripeChargesGet.js +3 -1
- package/api/stripe/stripeRefundsGet.js +3 -1
- package/api/stylearcade/stylearcadeDataGet.js +14 -6
- package/api/stylearcade/stylearcadeMetadataGet.js +3 -1
- package/api/tagalys/docs.md +7 -0
- package/api/telnyx/docs.md +6 -0
- package/api/telnyx/telnyx.constants.js +7 -0
- package/api/telnyx/telnyx.utils.js +37 -0
- package/api/telnyx/telnyxAvailablePhoneNumbersGet.js +59 -0
- package/api/telnyx/telnyxBalanceGet.js +51 -0
- package/api/telnyx/telnyxGet.js +151 -0
- package/api/telnyx/telnyxMessageGet.js +59 -0
- package/api/telnyx/telnyxMessageSend.js +65 -0
- package/api/telnyx/telnyxMessagesGet.js +53 -0
- package/api/telnyx/telnyxMessagingProfileCreate.js +62 -0
- package/api/telnyx/telnyxMessagingProfileGet.js +59 -0
- package/api/telnyx/telnyxMessagingProfileUpdate.js +68 -0
- package/api/telnyx/telnyxMessagingProfilesGet.js +53 -0
- package/api/telnyx/telnyxNumberLookupGet.js +61 -0
- package/api/telnyx/telnyxNumberOrderCreate.js +64 -0
- package/api/telnyx/telnyxPhoneNumberGet.js +59 -0
- package/api/telnyx/telnyxPhoneNumberUpdate.js +68 -0
- package/api/telnyx/telnyxPhoneNumbersGet.js +53 -0
- package/api/telnyx/telnyxWebhookDeliveriesGet.js +58 -0
- package/api/threeclicks/threeclicksCollectionsGet.js +3 -1
- package/api/threeclicks/threeclicksPurchaseOrderCreate.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderCreateBulk.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderGet.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantitiesGet.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreate.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreateBulk.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderUpdate.js +5 -1
- package/api/threeclicks/threeclicksPurchaseOrdersGet.js +3 -1
- package/api/threeclicks/threeclicksShipmentCreate.js +4 -1
- package/api/threeclicks/threeclicksShipmentGet.js +4 -1
- package/api/threeclicks/threeclicksShipmentOrderAdd.js +5 -1
- package/api/threeclicks/threeclicksShipmentOrderQuantityCreate.js +5 -1
- package/api/threeclicks/threeclicksShipmentQuantityUpdate.js +5 -1
- package/api/threeclicks/threeclicksShipmentStatusUpdate.js +5 -1
- package/api/threeclicks/threeclicksShipmentsGet.js +3 -1
- package/api/threeclicks/threeclicksSignatureCalculate.js +4 -4
- package/api/threeclicks/threeclicksStyleCodesGet.js +4 -1
- package/api/threeclicks/threeclicksStyleColourDelete.js +5 -1
- package/api/threeclicks/threeclicksStyleDelete.js +4 -1
- package/api/threeclicks/threeclicksStylesGet.js +3 -1
- package/api/upstash/upstashDel.js +4 -1
- package/api/upstash/upstashExists.js +4 -1
- package/api/upstash/upstashGet.js +4 -1
- package/api/utils.js +86 -6
- package/api/workable/workableJobsGet.js +3 -1
- package/api/yotpo/yotpoCampaignsGet.js +3 -1
- package/api/yotpo/yotpoCustomersRecentGet.js +3 -1
- package/api/yotpo/yotpoRedemptionOptionsGet.js +3 -1
- package/api/yotpo/yotpoVipTiersGet.js +3 -1
- package/hosting/copyCredsToEnv.js +3 -3
- package/hosting/handlerPaths.js +3 -3
- package/package.json +2 -1
- package/server.js +8 -6
- package/server.utils.js +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// https://apidoc.pipe17.com/#/operations/fetchReturns
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { pipe17Client } = require('../pipe17/pipe17.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const pipe17ReturnsGet = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
{
|
|
14
|
+
params,
|
|
15
|
+
inspect = false,
|
|
16
|
+
fetchClient = pipe17Client,
|
|
17
|
+
} = {},
|
|
18
|
+
) => {
|
|
19
|
+
|
|
20
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
21
|
+
credsPayload,
|
|
22
|
+
});
|
|
23
|
+
if (rejectResponse) {
|
|
24
|
+
return rejectResponse;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return fetchClient.fetch({
|
|
28
|
+
requestPayload: {
|
|
29
|
+
method: 'get',
|
|
30
|
+
url: '/returns',
|
|
31
|
+
params,
|
|
32
|
+
},
|
|
33
|
+
context: { credsPayload },
|
|
34
|
+
inspect,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const funcApiConfig = {
|
|
39
|
+
argsWarden,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
pipe17ReturnsGet,
|
|
44
|
+
funcApiConfig,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
curl -X POST "http://localhost:8000/pipe17ReturnsGet" \
|
|
49
|
+
-H "Content-Type: application/json" \
|
|
50
|
+
-d '{
|
|
51
|
+
"credsPayload": { "credsPath": "pipe17" },
|
|
52
|
+
"options": { "params": { "count": 5 } }
|
|
53
|
+
}'
|
|
54
|
+
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// https://developers.printify.com/#retrieve-a-list-of-products
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyGet, printifyGetter } = require('../printify/printifyGet');
|
|
6
|
+
const { resolveShopIdFromCreds } = require('../printify/printify.utils');
|
|
7
|
+
|
|
8
|
+
const argsWarden = new ArgsWarden([
|
|
9
|
+
['credsPayload', credsValidator],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const printifyThingsGet = async (
|
|
13
|
+
returnGetter,
|
|
14
|
+
|
|
15
|
+
credsPayload,
|
|
16
|
+
{
|
|
17
|
+
shopId,
|
|
18
|
+
...getterOptions
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const shopIdResponse = await resolveShopIdFromCreds({ shopId, credsPayload });
|
|
30
|
+
if (!shopIdResponse.ok) {
|
|
31
|
+
return shopIdResponse;
|
|
32
|
+
}
|
|
33
|
+
({ data: shopId } = shopIdResponse);
|
|
34
|
+
|
|
35
|
+
const getterArgs = [
|
|
36
|
+
credsPayload,
|
|
37
|
+
`/shops/${ shopId }/products.json`,
|
|
38
|
+
{
|
|
39
|
+
...getterOptions,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return returnGetter
|
|
44
|
+
? printifyGetter(...getterArgs)
|
|
45
|
+
: printifyGet(...getterArgs);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const funcApiConfig = {
|
|
49
|
+
argsWarden,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
printifyThingsGet: (...args) => printifyThingsGet(false, ...args),
|
|
54
|
+
printifyThingsGetter: (...args) => printifyThingsGet(true, ...args),
|
|
55
|
+
funcApiConfig,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
curl -X POST "http://localhost:8000/printifyThingsGet" \
|
|
60
|
+
-H "Content-Type: application/json" \
|
|
61
|
+
-d '{
|
|
62
|
+
"credsPayload": { "credsPath": "printify" },
|
|
63
|
+
"options": {
|
|
64
|
+
"limit": 10
|
|
65
|
+
}
|
|
66
|
+
}'
|
|
67
|
+
*/
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// https://developers.printify.com/#api-reference
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient, resolveShopIdFromCreds } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['arg'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const FUNC = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
arg,
|
|
15
|
+
{
|
|
16
|
+
shopId,
|
|
17
|
+
} = {},
|
|
18
|
+
) => {
|
|
19
|
+
|
|
20
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
21
|
+
credsPayload,
|
|
22
|
+
arg,
|
|
23
|
+
});
|
|
24
|
+
if (rejectResponse) {
|
|
25
|
+
return rejectResponse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const shopIdResponse = await resolveShopIdFromCreds({ shopId, credsPayload });
|
|
29
|
+
if (!shopIdResponse.ok) {
|
|
30
|
+
return shopIdResponse;
|
|
31
|
+
}
|
|
32
|
+
({ data: shopId } = shopIdResponse);
|
|
33
|
+
|
|
34
|
+
return printifyClient.fetch({
|
|
35
|
+
requestPayload: {
|
|
36
|
+
method: 'get',
|
|
37
|
+
url: `/shops/${ shopId }/things/${ arg }.json`,
|
|
38
|
+
},
|
|
39
|
+
context: { credsPayload },
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const funcApiConfig = {
|
|
44
|
+
argsWarden,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
FUNC,
|
|
49
|
+
funcApiConfig,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
curl -X POST "http://localhost:8000/FUNC" \
|
|
54
|
+
-H "Content-Type: application/json" \
|
|
55
|
+
-d '{
|
|
56
|
+
"credsPayload": { "credsPath": "printify" },
|
|
57
|
+
"arg": "1234"
|
|
58
|
+
}'
|
|
59
|
+
*/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { BASE_URL } = require('../printify/printify.constants');
|
|
2
|
+
const { resolveCreds, useBaseUrl } = require('../pipelineSteps');
|
|
3
|
+
const { FetchClient, fetchClientCommonSteps, resolveFromCreds } = require('../utils');
|
|
4
|
+
|
|
5
|
+
const resolveShopIdFromCreds = async ({ shopId, credsPayload, creds }) => {
|
|
6
|
+
if (shopId) {
|
|
7
|
+
return { ok: true, data: shopId };
|
|
8
|
+
}
|
|
9
|
+
return resolveFromCreds('SHOP_ID')({ credsPayload, creds });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const useAuthHeaders = async (state) => {
|
|
13
|
+
const { requestPayload, context } = state;
|
|
14
|
+
const { creds } = context;
|
|
15
|
+
const { API_KEY } = creds;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
requestPayload: {
|
|
19
|
+
...requestPayload,
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${ API_KEY }`,
|
|
22
|
+
...requestPayload.headers,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const printifyClient = new FetchClient({
|
|
29
|
+
pipeline: [
|
|
30
|
+
resolveCreds,
|
|
31
|
+
useAuthHeaders,
|
|
32
|
+
useBaseUrl(BASE_URL),
|
|
33
|
+
'fetch',
|
|
34
|
+
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
printifyClient,
|
|
40
|
+
resolveShopIdFromCreds,
|
|
41
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// https://developers.printify.com/#retrieve-a-specific-blueprint
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, actionSingleOrMultiple } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['blueprintId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const printifyBlueprintGetSingle = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
blueprintId,
|
|
15
|
+
) => {
|
|
16
|
+
return printifyClient.fetch({
|
|
17
|
+
requestPayload: {
|
|
18
|
+
method: 'get',
|
|
19
|
+
url: `/catalog/blueprints/${ blueprintId }.json`,
|
|
20
|
+
},
|
|
21
|
+
context: { credsPayload },
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const printifyBlueprintGet = async (
|
|
26
|
+
credsPayload,
|
|
27
|
+
blueprintId,
|
|
28
|
+
{
|
|
29
|
+
queueRunOptions,
|
|
30
|
+
} = {},
|
|
31
|
+
) => {
|
|
32
|
+
|
|
33
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
34
|
+
credsPayload,
|
|
35
|
+
blueprintId,
|
|
36
|
+
});
|
|
37
|
+
if (rejectResponse) {
|
|
38
|
+
return rejectResponse;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return actionSingleOrMultiple(
|
|
42
|
+
blueprintId,
|
|
43
|
+
printifyBlueprintGetSingle,
|
|
44
|
+
(blueprintIdItem) => ({
|
|
45
|
+
args: [credsPayload, blueprintIdItem],
|
|
46
|
+
}),
|
|
47
|
+
{
|
|
48
|
+
...(queueRunOptions ? { queueRunOptions } : {}),
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const funcApiConfig = {
|
|
54
|
+
argsWarden,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
printifyBlueprintGet,
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://developers.printify.com/#retrieve-a-list-of-variants-for-a-blueprint-and-print-provider
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, actionSingleOrMultiple, everyIfArray, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const catalogQueryValidator = (catalogQuery) => {
|
|
8
|
+
return valueProvided(catalogQuery?.blueprintId)
|
|
9
|
+
&& valueProvided(catalogQuery?.printProviderId);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const argsWarden = new ArgsWarden([
|
|
13
|
+
['credsPayload', credsValidator],
|
|
14
|
+
['catalogQuery', (catalogQuery) => everyIfArray(catalogQueryValidator, catalogQuery)],
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
const printifyBlueprintPrintProviderVariantsGetSingle = async (
|
|
18
|
+
credsPayload,
|
|
19
|
+
catalogQuery,
|
|
20
|
+
{
|
|
21
|
+
showOutOfStock,
|
|
22
|
+
} = {},
|
|
23
|
+
) => {
|
|
24
|
+
const {
|
|
25
|
+
blueprintId,
|
|
26
|
+
printProviderId,
|
|
27
|
+
} = catalogQuery;
|
|
28
|
+
|
|
29
|
+
return printifyClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
method: 'get',
|
|
32
|
+
url: `/catalog/blueprints/${ blueprintId }/print_providers/${ printProviderId }/variants.json`,
|
|
33
|
+
params: {
|
|
34
|
+
...(showOutOfStock && { 'show-out-of-stock': showOutOfStock }),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
context: { credsPayload },
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const printifyBlueprintPrintProviderVariantsGet = async (
|
|
42
|
+
credsPayload,
|
|
43
|
+
catalogQuery,
|
|
44
|
+
{
|
|
45
|
+
showOutOfStock,
|
|
46
|
+
queueRunOptions,
|
|
47
|
+
} = {},
|
|
48
|
+
) => {
|
|
49
|
+
|
|
50
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
51
|
+
credsPayload,
|
|
52
|
+
catalogQuery,
|
|
53
|
+
});
|
|
54
|
+
if (rejectResponse) {
|
|
55
|
+
return rejectResponse;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return actionSingleOrMultiple(
|
|
59
|
+
catalogQuery,
|
|
60
|
+
printifyBlueprintPrintProviderVariantsGetSingle,
|
|
61
|
+
(catalogQueryItem) => ({
|
|
62
|
+
args: [credsPayload, catalogQueryItem, { showOutOfStock }],
|
|
63
|
+
}),
|
|
64
|
+
{
|
|
65
|
+
...(queueRunOptions ? { queueRunOptions } : {}),
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const funcApiConfig = {
|
|
71
|
+
argsWarden,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
module.exports = {
|
|
75
|
+
printifyBlueprintPrintProviderVariantsGet,
|
|
76
|
+
funcApiConfig,
|
|
77
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// https://developers.printify.com/#retrieve-a-list-of-print-providers-for-a-blueprint
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, actionSingleOrMultiple } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['blueprintId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const printifyBlueprintPrintProvidersGetSingle = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
blueprintId,
|
|
15
|
+
) => {
|
|
16
|
+
return printifyClient.fetch({
|
|
17
|
+
requestPayload: {
|
|
18
|
+
method: 'get',
|
|
19
|
+
url: `/catalog/blueprints/${ blueprintId }/print_providers.json`,
|
|
20
|
+
},
|
|
21
|
+
context: { credsPayload },
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const printifyBlueprintPrintProvidersGet = async (
|
|
26
|
+
credsPayload,
|
|
27
|
+
blueprintId,
|
|
28
|
+
{
|
|
29
|
+
queueRunOptions,
|
|
30
|
+
} = {},
|
|
31
|
+
) => {
|
|
32
|
+
|
|
33
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
34
|
+
credsPayload,
|
|
35
|
+
blueprintId,
|
|
36
|
+
});
|
|
37
|
+
if (rejectResponse) {
|
|
38
|
+
return rejectResponse;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return actionSingleOrMultiple(
|
|
42
|
+
blueprintId,
|
|
43
|
+
printifyBlueprintPrintProvidersGetSingle,
|
|
44
|
+
(blueprintIdItem) => ({
|
|
45
|
+
args: [credsPayload, blueprintIdItem],
|
|
46
|
+
}),
|
|
47
|
+
{
|
|
48
|
+
...(queueRunOptions ? { queueRunOptions } : {}),
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const funcApiConfig = {
|
|
54
|
+
argsWarden,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
printifyBlueprintPrintProvidersGet,
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// https://developers.printify.com/#retrieve-a-list-of-available-blueprints
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const printifyBlueprintsGet = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
) => {
|
|
14
|
+
|
|
15
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
16
|
+
credsPayload,
|
|
17
|
+
});
|
|
18
|
+
if (rejectResponse) {
|
|
19
|
+
return rejectResponse;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return printifyClient.fetch({
|
|
23
|
+
requestPayload: {
|
|
24
|
+
method: 'get',
|
|
25
|
+
url: '/catalog/blueprints.json',
|
|
26
|
+
},
|
|
27
|
+
context: { credsPayload },
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const funcApiConfig = {
|
|
32
|
+
argsWarden,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
printifyBlueprintsGet,
|
|
37
|
+
funcApiConfig,
|
|
38
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
const { ArgsWarden, Getter } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
4
|
+
const { MAX_PER_PAGE } = require('../printify/printify.constants');
|
|
5
|
+
|
|
6
|
+
const argsWarden = new ArgsWarden([
|
|
7
|
+
['credsPayload', credsValidator],
|
|
8
|
+
['url'],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const printifyGetPacket = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
url,
|
|
14
|
+
{
|
|
15
|
+
params,
|
|
16
|
+
perPage = MAX_PER_PAGE,
|
|
17
|
+
} = {},
|
|
18
|
+
) => {
|
|
19
|
+
const {
|
|
20
|
+
page = 1,
|
|
21
|
+
...restParams
|
|
22
|
+
} = params ?? {};
|
|
23
|
+
|
|
24
|
+
return printifyClient.fetch({
|
|
25
|
+
requestPayload: {
|
|
26
|
+
method: 'get',
|
|
27
|
+
url,
|
|
28
|
+
params: {
|
|
29
|
+
page,
|
|
30
|
+
limit: perPage,
|
|
31
|
+
...restParams,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
context: { credsPayload },
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const printifyGetPaginator = async (currentParams, response) => {
|
|
39
|
+
if (!response?.ok) {
|
|
40
|
+
return [true];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const body = response.data;
|
|
44
|
+
const {
|
|
45
|
+
current_page: currentPage,
|
|
46
|
+
last_page: lastPage,
|
|
47
|
+
} = body ?? {};
|
|
48
|
+
|
|
49
|
+
if (!currentPage || !lastPage) {
|
|
50
|
+
return [true];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const done = currentPage >= lastPage;
|
|
54
|
+
if (done) {
|
|
55
|
+
return [true];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { args, options } = currentParams;
|
|
59
|
+
|
|
60
|
+
return [false, {
|
|
61
|
+
args,
|
|
62
|
+
options: {
|
|
63
|
+
...options,
|
|
64
|
+
params: {
|
|
65
|
+
...options.params,
|
|
66
|
+
page: currentPage + 1,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const printifyGetDigester = (response) => {
|
|
73
|
+
if (!response?.ok) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const body = response.data;
|
|
78
|
+
|
|
79
|
+
if (Array.isArray(body)) {
|
|
80
|
+
return body;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return body?.data ?? [];
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const printifyGet = async (
|
|
87
|
+
returnGetter,
|
|
88
|
+
|
|
89
|
+
credsPayload,
|
|
90
|
+
url,
|
|
91
|
+
{
|
|
92
|
+
params,
|
|
93
|
+
perPage = MAX_PER_PAGE,
|
|
94
|
+
...getterOptions
|
|
95
|
+
} = {},
|
|
96
|
+
) => {
|
|
97
|
+
|
|
98
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
99
|
+
credsPayload,
|
|
100
|
+
url,
|
|
101
|
+
});
|
|
102
|
+
if (rejectResponse) {
|
|
103
|
+
return rejectResponse;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const getter = new Getter(
|
|
107
|
+
{
|
|
108
|
+
args: [credsPayload, url],
|
|
109
|
+
options: {
|
|
110
|
+
params,
|
|
111
|
+
perPage,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
func: printifyGetPacket,
|
|
116
|
+
digester: printifyGetDigester,
|
|
117
|
+
paginator: printifyGetPaginator,
|
|
118
|
+
...getterOptions,
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (returnGetter) {
|
|
123
|
+
return getter;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const data = await getter.run({ returnAll: true });
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
ok: true,
|
|
130
|
+
data,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const funcApiConfig = {
|
|
135
|
+
argsWarden,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
module.exports = {
|
|
139
|
+
printifyGet: (...args) => printifyGet(false, ...args),
|
|
140
|
+
printifyGetter: (...args) => printifyGet(true, ...args),
|
|
141
|
+
funcApiConfig,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/*
|
|
145
|
+
curl -X POST "http://localhost:8000/printifyGet" \
|
|
146
|
+
-H "Content-Type: application/json" \
|
|
147
|
+
-d '{
|
|
148
|
+
"credsPayload": { "credsPath": "printify" },
|
|
149
|
+
"url": "/shops.json",
|
|
150
|
+
"options": {
|
|
151
|
+
"limit": 10
|
|
152
|
+
}
|
|
153
|
+
}'
|
|
154
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// https://developers.printify.com/#upload-a-new-image
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, actionSingleOrMultiple, everyIfArray, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { printifyClient } = require('../printify/printify.utils');
|
|
6
|
+
|
|
7
|
+
const uploadPayloadValidator = (uploadPayload) => {
|
|
8
|
+
return valueProvided(uploadPayload?.imageUrl)
|
|
9
|
+
&& valueProvided(uploadPayload?.filename);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const argsWarden = new ArgsWarden([
|
|
13
|
+
['credsPayload', credsValidator],
|
|
14
|
+
['uploadPayload', (uploadPayload) => everyIfArray(uploadPayloadValidator, uploadPayload)],
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
const printifyImageUploadSingle = async (
|
|
18
|
+
credsPayload,
|
|
19
|
+
uploadPayload,
|
|
20
|
+
) => {
|
|
21
|
+
const {
|
|
22
|
+
imageUrl,
|
|
23
|
+
filename,
|
|
24
|
+
} = uploadPayload;
|
|
25
|
+
|
|
26
|
+
return printifyClient.fetch({
|
|
27
|
+
requestPayload: {
|
|
28
|
+
method: 'post',
|
|
29
|
+
url: '/uploads/images.json',
|
|
30
|
+
body: {
|
|
31
|
+
url: imageUrl,
|
|
32
|
+
file_name: filename,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
context: { credsPayload },
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const printifyImageUpload = async (
|
|
40
|
+
credsPayload,
|
|
41
|
+
uploadPayload,
|
|
42
|
+
{
|
|
43
|
+
queueRunOptions,
|
|
44
|
+
} = {},
|
|
45
|
+
) => {
|
|
46
|
+
|
|
47
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
48
|
+
credsPayload,
|
|
49
|
+
uploadPayload,
|
|
50
|
+
});
|
|
51
|
+
if (rejectResponse) {
|
|
52
|
+
return rejectResponse;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return actionSingleOrMultiple(
|
|
56
|
+
uploadPayload,
|
|
57
|
+
printifyImageUploadSingle,
|
|
58
|
+
(uploadPayloadItem) => ({
|
|
59
|
+
args: [credsPayload, uploadPayloadItem],
|
|
60
|
+
}),
|
|
61
|
+
{
|
|
62
|
+
...(queueRunOptions ? { queueRunOptions } : {}),
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const funcApiConfig = {
|
|
68
|
+
argsWarden,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
printifyImageUpload,
|
|
73
|
+
funcApiConfig,
|
|
74
|
+
};
|