@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,54 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleCalendar, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const googlecalendarCalendarsGet = async (
|
|
10
|
+
credsPayload,
|
|
11
|
+
{
|
|
12
|
+
subject,
|
|
13
|
+
} = {},
|
|
14
|
+
) => {
|
|
15
|
+
|
|
16
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
17
|
+
credsPayload,
|
|
18
|
+
});
|
|
19
|
+
if (rejectResponse) {
|
|
20
|
+
return rejectResponse;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { client, error } = await getGoogleCalendar(credsPayload, { subject });
|
|
24
|
+
|
|
25
|
+
if (error) {
|
|
26
|
+
return error;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return googleApiCall(() => client.calendarList.list());
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const funcApiConfig = {
|
|
33
|
+
argsWarden,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
googlecalendarCalendarsGet,
|
|
38
|
+
funcApiConfig,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
curl -X POST "http://localhost:8000/googlecalendarCalendarsGet" \
|
|
43
|
+
-H "Content-Type: application/json" \
|
|
44
|
+
-d '{
|
|
45
|
+
"credsPayload": { "credsPath": "google" }
|
|
46
|
+
}'
|
|
47
|
+
|
|
48
|
+
curl -X POST "http://localhost:8000/googlecalendarCalendarsGet" \
|
|
49
|
+
-H "Content-Type: application/json" \
|
|
50
|
+
-d '{
|
|
51
|
+
"credsPayload": { "credsPath": "google" },
|
|
52
|
+
"options": { "subject": "x@y.com" }
|
|
53
|
+
}'
|
|
54
|
+
*/
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleCalendar, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const eventDataValidator = (eventData) => {
|
|
6
|
+
return Boolean(eventData?.summary && eventData?.start && eventData?.end);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const argsWarden = new ArgsWarden([
|
|
10
|
+
['credsPayload', credsValidator],
|
|
11
|
+
['eventData', eventDataValidator],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const googlecalendarEventCreate = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
eventData,
|
|
17
|
+
{
|
|
18
|
+
subject,
|
|
19
|
+
calendarId = 'primary',
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
eventData,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { client, error } = await getGoogleCalendar(credsPayload, { subject });
|
|
32
|
+
|
|
33
|
+
if (error) {
|
|
34
|
+
return error;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return googleApiCall(() => client.events.insert({
|
|
38
|
+
calendarId,
|
|
39
|
+
requestBody: eventData,
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const funcApiConfig = {
|
|
44
|
+
argsWarden,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
googlecalendarEventCreate,
|
|
49
|
+
funcApiConfig,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
curl -X POST "http://localhost:8000/googlecalendarEventCreate" \
|
|
54
|
+
-H "Content-Type: application/json" \
|
|
55
|
+
-d '{
|
|
56
|
+
"credsPayload": { "credsPath": "google" },
|
|
57
|
+
"eventData": {
|
|
58
|
+
"summary": "Meeting",
|
|
59
|
+
"start": { "dateTime": "2026-04-09T10:00:00-04:00" },
|
|
60
|
+
"end": { "dateTime": "2026-04-09T11:00:00-04:00" }
|
|
61
|
+
}
|
|
62
|
+
}'
|
|
63
|
+
*/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleCalendar, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['eventId'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const googlecalendarEventDelete = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
eventId,
|
|
13
|
+
{
|
|
14
|
+
subject,
|
|
15
|
+
calendarId = 'primary',
|
|
16
|
+
} = {},
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
20
|
+
credsPayload,
|
|
21
|
+
eventId,
|
|
22
|
+
});
|
|
23
|
+
if (rejectResponse) {
|
|
24
|
+
return rejectResponse;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { client, error } = await getGoogleCalendar(credsPayload, { subject });
|
|
28
|
+
|
|
29
|
+
if (error) {
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return googleApiCall(() => client.events.delete({
|
|
34
|
+
calendarId,
|
|
35
|
+
eventId,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
googlecalendarEventDelete,
|
|
45
|
+
funcApiConfig,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
curl -X POST "http://localhost:8000/googlecalendarEventDelete" \
|
|
50
|
+
-H "Content-Type: application/json" \
|
|
51
|
+
-d '{
|
|
52
|
+
"credsPayload": { "credsPath": "google" },
|
|
53
|
+
"eventId": "abc123"
|
|
54
|
+
}'
|
|
55
|
+
*/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleCalendar, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['eventId'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const googlecalendarEventGet = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
eventId,
|
|
13
|
+
{
|
|
14
|
+
subject,
|
|
15
|
+
calendarId = 'primary',
|
|
16
|
+
} = {},
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
20
|
+
credsPayload,
|
|
21
|
+
eventId,
|
|
22
|
+
});
|
|
23
|
+
if (rejectResponse) {
|
|
24
|
+
return rejectResponse;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { client, error } = await getGoogleCalendar(credsPayload, { subject });
|
|
28
|
+
|
|
29
|
+
if (error) {
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return googleApiCall(() => client.events.get({
|
|
34
|
+
calendarId,
|
|
35
|
+
eventId,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
googlecalendarEventGet,
|
|
45
|
+
funcApiConfig,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
curl -X POST "http://localhost:8000/googlecalendarEventGet" \
|
|
50
|
+
-H "Content-Type: application/json" \
|
|
51
|
+
-d '{
|
|
52
|
+
"credsPayload": { "credsPath": "google" },
|
|
53
|
+
"eventId": "abc123"
|
|
54
|
+
}'
|
|
55
|
+
*/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleCalendar, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const googlecalendarEventsGet = async (
|
|
10
|
+
credsPayload,
|
|
11
|
+
{
|
|
12
|
+
subject,
|
|
13
|
+
calendarId = 'primary',
|
|
14
|
+
timeMin,
|
|
15
|
+
timeMax,
|
|
16
|
+
maxResults = 50,
|
|
17
|
+
orderBy = 'startTime',
|
|
18
|
+
singleEvents = true,
|
|
19
|
+
q,
|
|
20
|
+
pageToken,
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { client, error } = await getGoogleCalendar(credsPayload, { subject });
|
|
32
|
+
|
|
33
|
+
if (error) {
|
|
34
|
+
return error;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return googleApiCall(() => client.events.list({
|
|
38
|
+
calendarId,
|
|
39
|
+
...timeMin && { timeMin },
|
|
40
|
+
...timeMax && { timeMax },
|
|
41
|
+
maxResults,
|
|
42
|
+
orderBy,
|
|
43
|
+
singleEvents,
|
|
44
|
+
...q && { q },
|
|
45
|
+
...pageToken && { pageToken },
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const funcApiConfig = {
|
|
50
|
+
argsWarden,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
googlecalendarEventsGet,
|
|
55
|
+
funcApiConfig,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
curl -X POST "http://localhost:8000/googlecalendarEventsGet" \
|
|
60
|
+
-H "Content-Type: application/json" \
|
|
61
|
+
-d '{
|
|
62
|
+
"credsPayload": { "credsPath": "google" },
|
|
63
|
+
"options": { "calendarId": "primary", "maxResults": 10 }
|
|
64
|
+
}'
|
|
65
|
+
*/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleDrive, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['fileId'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const googledriveFileDelete = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
fileId,
|
|
13
|
+
{
|
|
14
|
+
} = {},
|
|
15
|
+
) => {
|
|
16
|
+
|
|
17
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
18
|
+
credsPayload,
|
|
19
|
+
fileId,
|
|
20
|
+
});
|
|
21
|
+
if (rejectResponse) {
|
|
22
|
+
return rejectResponse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { client, error } = await getGoogleDrive(credsPayload);
|
|
26
|
+
|
|
27
|
+
if (error) {
|
|
28
|
+
return error;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return googleApiCall(() => client.files.delete({
|
|
32
|
+
supportsAllDrives: true,
|
|
33
|
+
fileId,
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const funcApiConfig = {
|
|
38
|
+
argsWarden,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
googledriveFileDelete,
|
|
43
|
+
funcApiConfig,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
curl -X POST "http://localhost:8000/googledriveFileDelete" \
|
|
48
|
+
-H "Content-Type: application/json" \
|
|
49
|
+
-d '{
|
|
50
|
+
"credsPayload": { "credsPath": "google" },
|
|
51
|
+
"fileId": "REPLACE_FILE_ID"
|
|
52
|
+
}'
|
|
53
|
+
*/
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleDrive, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const defaultAttrs = 'id, name, mimeType, size, createdTime, modifiedTime, webViewLink';
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['fileId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const googledriveFileGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
fileId,
|
|
15
|
+
{
|
|
16
|
+
attrs = defaultAttrs,
|
|
17
|
+
} = {},
|
|
18
|
+
) => {
|
|
19
|
+
|
|
20
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
21
|
+
credsPayload,
|
|
22
|
+
fileId,
|
|
23
|
+
});
|
|
24
|
+
if (rejectResponse) {
|
|
25
|
+
return rejectResponse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { client, error } = await getGoogleDrive(credsPayload);
|
|
29
|
+
|
|
30
|
+
if (error) {
|
|
31
|
+
return error;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return googleApiCall(() => client.files.get({
|
|
35
|
+
supportsAllDrives: true,
|
|
36
|
+
fileId,
|
|
37
|
+
fields: attrs,
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const funcApiConfig = {
|
|
42
|
+
argsWarden,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
googledriveFileGet,
|
|
47
|
+
funcApiConfig,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
curl -X POST "http://localhost:8000/googledriveFileGet" \
|
|
52
|
+
-H "Content-Type: application/json" \
|
|
53
|
+
-d '{
|
|
54
|
+
"credsPayload": { "credsPath": "google" },
|
|
55
|
+
"fileId": "1YWzBt28D9ikWpreifWwo-2xdOQ4FATcA"
|
|
56
|
+
}'
|
|
57
|
+
*/
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const fs = require('fs').promises;
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { Readable } = require('stream');
|
|
4
|
+
|
|
5
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
6
|
+
const { credsValidator } = require('../validators');
|
|
7
|
+
const { getGoogleDrive, googleApiCall } = require('../google/google.utils');
|
|
8
|
+
|
|
9
|
+
const fileDataValidator = (fileData) => {
|
|
10
|
+
if (fileData?.filePath) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return Boolean(fileData?.fileName && fileData?.fileSource !== undefined);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const folderIdentifierValidator = (folderIdentifier) => {
|
|
18
|
+
return objHasAny(folderIdentifier, ['folderId']);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const argsWarden = new ArgsWarden([
|
|
22
|
+
['credsPayload', credsValidator],
|
|
23
|
+
['fileData', fileDataValidator],
|
|
24
|
+
['folderIdentifier', folderIdentifierValidator],
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const googledriveFileUpload = async (
|
|
28
|
+
credsPayload,
|
|
29
|
+
fileData,
|
|
30
|
+
folderIdentifier,
|
|
31
|
+
{
|
|
32
|
+
mimeType = 'application/octet-stream',
|
|
33
|
+
} = {},
|
|
34
|
+
) => {
|
|
35
|
+
|
|
36
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
37
|
+
credsPayload,
|
|
38
|
+
fileData,
|
|
39
|
+
folderIdentifier,
|
|
40
|
+
});
|
|
41
|
+
if (rejectResponse) {
|
|
42
|
+
return rejectResponse;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let {
|
|
46
|
+
filePath,
|
|
47
|
+
fileName,
|
|
48
|
+
fileSource,
|
|
49
|
+
} = fileData;
|
|
50
|
+
|
|
51
|
+
const { folderId } = folderIdentifier;
|
|
52
|
+
|
|
53
|
+
if (filePath) {
|
|
54
|
+
fileName = path.basename(filePath);
|
|
55
|
+
fileSource = await fs.readFile(filePath);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!(fileName && fileSource !== undefined)) {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
error: {
|
|
62
|
+
code: 'INVALID_FILE_DATA',
|
|
63
|
+
message: 'Provide filePath or fileName with fileSource',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const buffer = Buffer.isBuffer(fileSource)
|
|
69
|
+
? fileSource
|
|
70
|
+
: Buffer.from(String(fileSource));
|
|
71
|
+
|
|
72
|
+
const { client, error } = await getGoogleDrive(credsPayload);
|
|
73
|
+
|
|
74
|
+
if (error) {
|
|
75
|
+
return error;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const uploadResponse = await googleApiCall(() => client.files.create({
|
|
79
|
+
supportsAllDrives: true,
|
|
80
|
+
requestBody: {
|
|
81
|
+
name: fileName,
|
|
82
|
+
...folderId && { parents: [folderId] },
|
|
83
|
+
},
|
|
84
|
+
media: {
|
|
85
|
+
body: Readable.from(buffer),
|
|
86
|
+
mimeType,
|
|
87
|
+
},
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
if (!uploadResponse.ok) {
|
|
91
|
+
return uploadResponse;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const uploadedFileId = uploadResponse.data.id;
|
|
95
|
+
const fileUrl = `https://drive.google.com/file/d/${ uploadedFileId }/view`;
|
|
96
|
+
const folderUrl = folderId ? `https://drive.google.com/drive/folders/${ folderId }` : null;
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
ok: true,
|
|
100
|
+
data: {
|
|
101
|
+
...uploadResponse.data,
|
|
102
|
+
customData: {
|
|
103
|
+
fileUrl,
|
|
104
|
+
...folderUrl && { folderUrl },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const funcApiConfig = {
|
|
111
|
+
argsWarden,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
module.exports = {
|
|
115
|
+
googledriveFileUpload,
|
|
116
|
+
funcApiConfig,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
curl -X POST "http://localhost:8000/googledriveFileUpload" \
|
|
121
|
+
-H "Content-Type: application/json" \
|
|
122
|
+
-d '{
|
|
123
|
+
"credsPayload": { "credsPath": "google" },
|
|
124
|
+
"fileData": { "fileName": "hello.txt", "fileSource": "hello world" },
|
|
125
|
+
"folderIdentifier": { "folderId": "REPLACE_FOLDER_ID" }
|
|
126
|
+
}'
|
|
127
|
+
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getGoogleDrive, googleApiCall } = require('../google/google.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const googledriveFilesGet = async (
|
|
10
|
+
credsPayload,
|
|
11
|
+
{
|
|
12
|
+
folderIdentifier = {},
|
|
13
|
+
pageSize = 100,
|
|
14
|
+
pageToken,
|
|
15
|
+
} = {},
|
|
16
|
+
) => {
|
|
17
|
+
|
|
18
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
19
|
+
credsPayload,
|
|
20
|
+
});
|
|
21
|
+
if (rejectResponse) {
|
|
22
|
+
return rejectResponse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { folderId } = folderIdentifier;
|
|
26
|
+
|
|
27
|
+
if (!folderId) {
|
|
28
|
+
return {
|
|
29
|
+
ok: false,
|
|
30
|
+
error: {
|
|
31
|
+
code: 'MISSING_FOLDER_ID',
|
|
32
|
+
message: 'folderIdentifier.folderId is required',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { client, error } = await getGoogleDrive(credsPayload);
|
|
38
|
+
|
|
39
|
+
if (error) {
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return googleApiCall(() => client.files.list({
|
|
44
|
+
supportsAllDrives: true,
|
|
45
|
+
includeItemsFromAllDrives: true,
|
|
46
|
+
q: [
|
|
47
|
+
'trashed=false',
|
|
48
|
+
`'${ folderId }' in parents`,
|
|
49
|
+
].join(' and '),
|
|
50
|
+
pageSize,
|
|
51
|
+
...pageToken && { pageToken },
|
|
52
|
+
fields: 'nextPageToken, files(id, name, mimeType, size, createdTime, modifiedTime, webViewLink)',
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const funcApiConfig = {
|
|
57
|
+
argsWarden,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
googledriveFilesGet,
|
|
62
|
+
funcApiConfig,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
curl -X POST "http://localhost:8000/googledriveFilesGet" \
|
|
67
|
+
-H "Content-Type: application/json" \
|
|
68
|
+
-d '{
|
|
69
|
+
"credsPayload": { "credsPath": "google" },
|
|
70
|
+
"options": { "folderIdentifier": { "folderId": "REPLACE_FOLDER_ID" } }
|
|
71
|
+
}'
|
|
72
|
+
*/
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/get
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { getGoogleSheets, googleApiCall } = require('../google/google.utils');
|
|
6
|
+
|
|
7
|
+
const spreadsheetIdentifierValidator = (spreadsheetIdentifier) => {
|
|
8
|
+
return objHasAny(spreadsheetIdentifier, ['spreadsheetId']);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const argsWarden = new ArgsWarden([
|
|
12
|
+
['credsPayload', credsValidator],
|
|
13
|
+
['spreadsheetIdentifier', spreadsheetIdentifierValidator],
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
const googlesheetsSpreadsheetGet = async (
|
|
17
|
+
credsPayload,
|
|
18
|
+
spreadsheetIdentifier,
|
|
19
|
+
{
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
spreadsheetIdentifier,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { spreadsheetId } = spreadsheetIdentifier;
|
|
32
|
+
const { client, error } = await getGoogleSheets(credsPayload);
|
|
33
|
+
|
|
34
|
+
if (error) {
|
|
35
|
+
return error;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return googleApiCall(() => client.spreadsheets.get({ spreadsheetId }));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const funcApiConfig = {
|
|
42
|
+
argsWarden,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
googlesheetsSpreadsheetGet,
|
|
47
|
+
funcApiConfig,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
curl -X POST "http://localhost:8000/googlesheetsSpreadsheetGet" \
|
|
52
|
+
-H "Content-Type: application/json" \
|
|
53
|
+
-d '{
|
|
54
|
+
"credsPayload": { "credsPath": "google" },
|
|
55
|
+
"spreadsheetIdentifier": { "spreadsheetId": "ABC123" }
|
|
56
|
+
}'
|
|
57
|
+
*/
|