@foxtware/mineral 0.1.14 → 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 +5 -6
- 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/shopifyTagsRemoveBulk.js +77 -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,62 @@
|
|
|
1
|
+
// https://developers.etsy.com/documentation/reference/#operation/getUserAddress
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { etsyClient } = require('./etsy.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['addressId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const etsyUserAddressGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
addressId,
|
|
15
|
+
{
|
|
16
|
+
params,
|
|
17
|
+
inspect = false,
|
|
18
|
+
fetchClient = etsyClient,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
addressId,
|
|
25
|
+
});
|
|
26
|
+
if (rejectResponse) {
|
|
27
|
+
return rejectResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fetchClient.fetch({
|
|
31
|
+
requestPayload: {
|
|
32
|
+
method: 'get',
|
|
33
|
+
url: `/application/user/addresses/${ addressId }`,
|
|
34
|
+
...(params && { params }),
|
|
35
|
+
},
|
|
36
|
+
context: {
|
|
37
|
+
credsPayload,
|
|
38
|
+
withAccessToken: true,
|
|
39
|
+
},
|
|
40
|
+
inspect,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const funcApiConfig = {
|
|
45
|
+
argsWarden,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
etsyUserAddressGet,
|
|
50
|
+
funcApiConfig,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
curl -X POST "http://localhost:8000/etsyUserAddressGet" \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{
|
|
57
|
+
"credsPayload": {
|
|
58
|
+
"credsPath": "etsy"
|
|
59
|
+
},
|
|
60
|
+
"addressId": "1296125024835"
|
|
61
|
+
}'
|
|
62
|
+
*/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// https://developers.etsy.com/documentation/reference/#operation/getUserAddresses
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { etsyGet, etsyGetter } = require('./etsyGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const etsyUserAddressesGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
params: paramsOption,
|
|
17
|
+
perPage,
|
|
18
|
+
|
|
19
|
+
withAccessToken = true,
|
|
20
|
+
...getterOptions
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const params = {
|
|
32
|
+
...paramsOption,
|
|
33
|
+
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const getterArgs = [
|
|
37
|
+
credsPayload,
|
|
38
|
+
`/application/user/addresses`,
|
|
39
|
+
{
|
|
40
|
+
params,
|
|
41
|
+
perPage,
|
|
42
|
+
withAccessToken,
|
|
43
|
+
...getterOptions,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
return returnGetter
|
|
48
|
+
? etsyGetter(...getterArgs)
|
|
49
|
+
: etsyGet(...getterArgs);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
etsyUserAddressesGet: (...args) => etsyUserAddressesGet(false, ...args),
|
|
58
|
+
etsyUserAddressesGetter: (...args) => etsyUserAddressesGet(true, ...args),
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
curl -X POST "http://localhost:8000/etsyUserAddressesGet" \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{
|
|
66
|
+
"credsPayload": {
|
|
67
|
+
"credsPath": "etsy"
|
|
68
|
+
}
|
|
69
|
+
}'
|
|
70
|
+
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// https://developers.etsy.com/documentation/reference/#operation/getUser
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { etsyClient } = require('./etsy.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['userId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const etsyUserGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
userId,
|
|
15
|
+
{
|
|
16
|
+
params,
|
|
17
|
+
inspect = false,
|
|
18
|
+
fetchClient = etsyClient,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
userId,
|
|
25
|
+
});
|
|
26
|
+
if (rejectResponse) {
|
|
27
|
+
return rejectResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fetchClient.fetch({
|
|
31
|
+
requestPayload: {
|
|
32
|
+
method: 'get',
|
|
33
|
+
url: `/application/users/${ userId }`,
|
|
34
|
+
...(params && { params }),
|
|
35
|
+
},
|
|
36
|
+
context: {
|
|
37
|
+
credsPayload,
|
|
38
|
+
withAccessToken: true,
|
|
39
|
+
},
|
|
40
|
+
inspect,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const funcApiConfig = {
|
|
45
|
+
argsWarden,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
etsyUserGet,
|
|
50
|
+
funcApiConfig,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
curl -X POST "http://localhost:8000/etsyUserGet" \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{
|
|
57
|
+
"credsPayload": {
|
|
58
|
+
"credsPath": "etsy"
|
|
59
|
+
},
|
|
60
|
+
"userId": "123456789"
|
|
61
|
+
}'
|
|
62
|
+
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// https://developers.etsy.com/documentation/reference/#operation/getShopByOwnerUserId
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { etsyClient } = require('./etsy.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['userId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const etsyUserShopsGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
userId,
|
|
15
|
+
{
|
|
16
|
+
params,
|
|
17
|
+
inspect = false,
|
|
18
|
+
fetchClient = etsyClient,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
userId,
|
|
25
|
+
});
|
|
26
|
+
if (rejectResponse) {
|
|
27
|
+
return rejectResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fetchClient.fetch({
|
|
31
|
+
requestPayload: {
|
|
32
|
+
method: 'get',
|
|
33
|
+
url: `/application/users/${ userId }/shops`,
|
|
34
|
+
...(params && { params }),
|
|
35
|
+
},
|
|
36
|
+
context: {
|
|
37
|
+
credsPayload,
|
|
38
|
+
withAccessToken: true,
|
|
39
|
+
},
|
|
40
|
+
inspect,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const funcApiConfig = {
|
|
45
|
+
argsWarden,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
etsyUserShopsGet,
|
|
50
|
+
funcApiConfig,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
curl -X POST "http://localhost:8000/etsyUserShopsGet" \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{
|
|
57
|
+
"credsPayload": {
|
|
58
|
+
"credsPath": "etsy"
|
|
59
|
+
},
|
|
60
|
+
"userId": "123456789"
|
|
61
|
+
}'
|
|
62
|
+
*/
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// https://developers.etsy.com/documentation/reference/#operation/updateVariationImages
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { etsyClient, resolveShopId } = require('./etsy.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['listingId'],
|
|
10
|
+
['updatePayload'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const etsyVariationImagesUpdate = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
listingId,
|
|
16
|
+
updatePayload,
|
|
17
|
+
{
|
|
18
|
+
shopId,
|
|
19
|
+
params,
|
|
20
|
+
inspect = false,
|
|
21
|
+
fetchClient = etsyClient,
|
|
22
|
+
} = {},
|
|
23
|
+
) => {
|
|
24
|
+
|
|
25
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
26
|
+
credsPayload,
|
|
27
|
+
listingId,
|
|
28
|
+
updatePayload,
|
|
29
|
+
});
|
|
30
|
+
if (rejectResponse) {
|
|
31
|
+
return rejectResponse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const shopIdResponse = await resolveShopId({ shopId, credsPayload });
|
|
35
|
+
if (!shopIdResponse.ok) {
|
|
36
|
+
return shopIdResponse;
|
|
37
|
+
}
|
|
38
|
+
({ data: shopId } = shopIdResponse);
|
|
39
|
+
|
|
40
|
+
return fetchClient.fetch({
|
|
41
|
+
requestPayload: {
|
|
42
|
+
method: 'post',
|
|
43
|
+
url: `/application/shops/${ shopId }/listings/${ listingId }/variation-images`,
|
|
44
|
+
body: updatePayload,
|
|
45
|
+
},
|
|
46
|
+
context: {
|
|
47
|
+
credsPayload,
|
|
48
|
+
withAccessToken: true,
|
|
49
|
+
},
|
|
50
|
+
inspect,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const funcApiConfig = {
|
|
55
|
+
argsWarden,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
etsyVariationImagesUpdate,
|
|
60
|
+
funcApiConfig,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
curl -X POST "http://localhost:8000/etsyVariationImagesUpdate" \
|
|
65
|
+
-H "Content-Type: application/json" \
|
|
66
|
+
-d '{
|
|
67
|
+
"credsPayload": {
|
|
68
|
+
"credsPath": "etsy"
|
|
69
|
+
},
|
|
70
|
+
"listingId": "1234567890",
|
|
71
|
+
"updatePayload": {
|
|
72
|
+
...
|
|
73
|
+
}
|
|
74
|
+
}'
|
|
75
|
+
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Figma
|
|
2
|
+
|
|
3
|
+
- [Developer documentation](https://www.figma.com/developers/api)
|
|
4
|
+
- [Authentication](https://www.figma.com/developers/api#authentication)
|
|
5
|
+
|
|
6
|
+
REST JSON at `https://api.figma.com/v1` for files, comments, and variables, authenticated with a personal access token in the `X-Figma-Token` header.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const { FIGMA_API_BASE_URL } = require('../figma/figma.constants');
|
|
2
|
+
const { resolveCreds, useBaseUrl } = require('../pipelineSteps');
|
|
3
|
+
const {
|
|
4
|
+
FetchClient,
|
|
5
|
+
fetchClientCommonSteps,
|
|
6
|
+
} = require('../utils');
|
|
7
|
+
|
|
8
|
+
const useAuthHeaders = async (state) => {
|
|
9
|
+
const { requestPayload, context } = state;
|
|
10
|
+
const { creds } = context;
|
|
11
|
+
const { API_KEY } = creds;
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
requestPayload: {
|
|
15
|
+
...requestPayload,
|
|
16
|
+
headers: {
|
|
17
|
+
'X-Figma-Token': API_KEY,
|
|
18
|
+
...requestPayload.headers,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const figmaClient = new FetchClient({
|
|
25
|
+
pipeline: [
|
|
26
|
+
resolveCreds,
|
|
27
|
+
useBaseUrl(FIGMA_API_BASE_URL),
|
|
28
|
+
useAuthHeaders,
|
|
29
|
+
'fetch',
|
|
30
|
+
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
figmaClient,
|
|
36
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// https://www.figma.com/developers/api#get-me-endpoint
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, Getter } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { figmaClient } = require('../figma/figma.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['url'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const figmaGetPacket = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
url,
|
|
15
|
+
{
|
|
16
|
+
params,
|
|
17
|
+
} = {},
|
|
18
|
+
) => {
|
|
19
|
+
return figmaClient.fetch({
|
|
20
|
+
requestPayload: {
|
|
21
|
+
url,
|
|
22
|
+
params,
|
|
23
|
+
},
|
|
24
|
+
context: {
|
|
25
|
+
credsPayload,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const figmaGetPaginator = async (currentParams, response) => {
|
|
31
|
+
if (!response?.ok) {
|
|
32
|
+
return [true];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return [true];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const figmaGet = async (
|
|
39
|
+
returnGetter,
|
|
40
|
+
|
|
41
|
+
credsPayload,
|
|
42
|
+
url,
|
|
43
|
+
{
|
|
44
|
+
params,
|
|
45
|
+
...getterOptions
|
|
46
|
+
} = {},
|
|
47
|
+
) => {
|
|
48
|
+
|
|
49
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
50
|
+
credsPayload,
|
|
51
|
+
url,
|
|
52
|
+
});
|
|
53
|
+
if (rejectResponse) {
|
|
54
|
+
return rejectResponse;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const getter = new Getter(
|
|
58
|
+
{
|
|
59
|
+
args: [credsPayload, url],
|
|
60
|
+
options: {
|
|
61
|
+
params,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
func: figmaGetPacket,
|
|
66
|
+
digester: (response) => {
|
|
67
|
+
if (!response?.ok) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return Array.isArray(response.data) ? response.data : [];
|
|
72
|
+
},
|
|
73
|
+
paginator: figmaGetPaginator,
|
|
74
|
+
...getterOptions,
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if (returnGetter) {
|
|
79
|
+
return getter;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const data = await getter.run({ returnAll: true });
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
ok: true,
|
|
86
|
+
data,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const funcApiConfig = {
|
|
91
|
+
argsWarden,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
module.exports = {
|
|
95
|
+
figmaGet: (...args) => figmaGet(false, ...args),
|
|
96
|
+
figmaGetter: (...args) => figmaGet(true, ...args),
|
|
97
|
+
funcApiConfig,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
curl -X POST "http://localhost:8000/figmaGet" \
|
|
102
|
+
-H "Content-Type: application/json" \
|
|
103
|
+
-d '{
|
|
104
|
+
"credsPayload": { "credsPath": "figma" },
|
|
105
|
+
"url": "/me"
|
|
106
|
+
}'
|
|
107
|
+
*/
|
|
@@ -21,7 +21,9 @@ const githubReposGet = async (
|
|
|
21
21
|
} = {},
|
|
22
22
|
) => {
|
|
23
23
|
|
|
24
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
});
|
|
25
27
|
if (rejectResponse) {
|
|
26
28
|
return rejectResponse;
|
|
27
29
|
}
|
|
@@ -18,7 +18,9 @@ const githubUserGet = async (
|
|
|
18
18
|
} = {},
|
|
19
19
|
) => {
|
|
20
20
|
|
|
21
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
});
|
|
22
24
|
if (rejectResponse) {
|
|
23
25
|
return rejectResponse;
|
|
24
26
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Google (Workspace APIs)
|
|
2
|
+
|
|
3
|
+
Service account auth via `SERVICE_ACCOUNT_JSON` on the `google` creds path. Uses [`googleapis`](https://github.com/googleapis/google-api-nodejs-client).
|
|
4
|
+
|
|
5
|
+
- [Sheets API](https://developers.google.com/workspace/sheets/api/reference/rest)
|
|
6
|
+
- [Drive API](https://developers.google.com/workspace/drive/api/reference/rest/v3)
|
|
7
|
+
- [Calendar API](https://developers.google.com/workspace/calendar/api/v3/reference)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
const { google } = require('googleapis');
|
|
2
|
+
const { credsFromPayload } = require('../utils');
|
|
3
|
+
const { GOOGLE_SCOPES } = require('../google/google.constants');
|
|
4
|
+
|
|
5
|
+
const invalidCredsResponse = () => ({
|
|
6
|
+
ok: false,
|
|
7
|
+
error: {
|
|
8
|
+
code: 'INVALID_CREDS',
|
|
9
|
+
message: 'SERVICE_ACCOUNT_JSON is required on google creds.',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const resolveServiceAccountJson = async (credsPayload) => {
|
|
14
|
+
const creds = await credsFromPayload(credsPayload);
|
|
15
|
+
|
|
16
|
+
if (!creds?.SERVICE_ACCOUNT_JSON) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return creds.SERVICE_ACCOUNT_JSON;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const buildGoogleAuth = (
|
|
24
|
+
serviceAccountJson,
|
|
25
|
+
{
|
|
26
|
+
scopes,
|
|
27
|
+
subject,
|
|
28
|
+
},
|
|
29
|
+
) => {
|
|
30
|
+
if (subject) {
|
|
31
|
+
return new google.auth.JWT({
|
|
32
|
+
email: serviceAccountJson.client_email,
|
|
33
|
+
key: serviceAccountJson.private_key,
|
|
34
|
+
scopes,
|
|
35
|
+
subject,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return new google.auth.GoogleAuth({
|
|
40
|
+
credentials: serviceAccountJson,
|
|
41
|
+
scopes,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const getGoogleAuth = async (
|
|
46
|
+
credsPayload,
|
|
47
|
+
{
|
|
48
|
+
scopes,
|
|
49
|
+
subject,
|
|
50
|
+
},
|
|
51
|
+
) => {
|
|
52
|
+
const serviceAccountJson = await resolveServiceAccountJson(credsPayload);
|
|
53
|
+
|
|
54
|
+
if (!serviceAccountJson) {
|
|
55
|
+
return { error: invalidCredsResponse() };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
auth: buildGoogleAuth(serviceAccountJson, { scopes, subject }),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getGoogleSheets = async (credsPayload) => {
|
|
64
|
+
const { auth, error } = await getGoogleAuth(credsPayload, {
|
|
65
|
+
scopes: GOOGLE_SCOPES.sheets,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (error) {
|
|
69
|
+
return { error };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
client: google.sheets({ version: 'v4', auth }),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getGoogleDrive = async (credsPayload) => {
|
|
78
|
+
const { auth, error } = await getGoogleAuth(credsPayload, {
|
|
79
|
+
scopes: GOOGLE_SCOPES.drive,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (error) {
|
|
83
|
+
return { error };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
client: google.drive({ version: 'v3', auth }),
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const getGoogleCalendar = async (
|
|
92
|
+
credsPayload,
|
|
93
|
+
{
|
|
94
|
+
subject,
|
|
95
|
+
} = {},
|
|
96
|
+
) => {
|
|
97
|
+
const { auth, error } = await getGoogleAuth(credsPayload, {
|
|
98
|
+
scopes: GOOGLE_SCOPES.calendar,
|
|
99
|
+
subject,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (error) {
|
|
103
|
+
return { error };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
client: google.calendar({ version: 'v3', auth }),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const googleApiCall = async (promiseFn) => {
|
|
112
|
+
try {
|
|
113
|
+
const response = await promiseFn();
|
|
114
|
+
return {
|
|
115
|
+
ok: true,
|
|
116
|
+
data: response?.data ?? response,
|
|
117
|
+
};
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
error: {
|
|
122
|
+
code: 'GOOGLE_API_ERROR',
|
|
123
|
+
message: error.message,
|
|
124
|
+
details: error.response?.data ?? error.errors ?? error,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
module.exports = {
|
|
131
|
+
resolveServiceAccountJson,
|
|
132
|
+
getGoogleSheets,
|
|
133
|
+
getGoogleDrive,
|
|
134
|
+
getGoogleCalendar,
|
|
135
|
+
googleApiCall,
|
|
136
|
+
invalidCredsResponse,
|
|
137
|
+
};
|