@foxtware/mineral 0.1.9 → 0.1.10

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.
Files changed (157) hide show
  1. package/.creds.yml.sample +27 -6
  2. package/AGENTS.md +6 -1
  3. package/README.md +1 -1
  4. package/api/bleckmann/.gitkeep +0 -0
  5. package/api/bleckmann/bleckmann.constants.js +8 -0
  6. package/api/bleckmann/bleckmann.utils.js +32 -0
  7. package/api/bleckmann/bleckmannAsnGet.js +52 -0
  8. package/api/bleckmann/bleckmannAsnsGet.js +65 -0
  9. package/api/constants.js +2 -1
  10. package/api/github/github.constants.js +11 -0
  11. package/api/github/github.utils.js +65 -0
  12. package/api/github/githubGet.js +144 -0
  13. package/api/github/githubIssueCreate.js +71 -0
  14. package/api/github/githubIssueGet.js +65 -0
  15. package/api/github/githubIssueUpdate.js +71 -0
  16. package/api/github/githubIssuesGet.js +74 -0
  17. package/api/github/githubPullRequestCreate.js +74 -0
  18. package/api/github/githubPullRequestGet.js +65 -0
  19. package/api/github/githubPullRequestMerge.js +77 -0
  20. package/api/github/githubPullRequestUpdate.js +72 -0
  21. package/api/github/githubPullRequestsGet.js +74 -0
  22. package/api/github/githubRepoCreate.js +80 -0
  23. package/api/github/githubRepoDelete.js +60 -0
  24. package/api/github/githubRepoGet.js +61 -0
  25. package/api/github/githubRepoUpdate.js +68 -0
  26. package/api/github/githubReposGet.js +69 -0
  27. package/api/github/githubUserGet.js +64 -0
  28. package/api/linear/linear.utils.js +9 -14
  29. package/api/linear/linearIssuesGet.js +9 -9
  30. package/api/logiwa/logiwa.utils.js +27 -25
  31. package/api/logiwa/logiwaInventoriesGet.js +5 -3
  32. package/api/logiwa/logiwaOrderGet.js +4 -2
  33. package/api/logiwa/logiwaOrdersGet.js +5 -3
  34. package/api/logiwa/logiwaProductGet.js +4 -2
  35. package/api/logiwa/logiwaProductsGet.js +5 -3
  36. package/api/logiwa/logiwaReportGetAvailableToPromise.js +5 -3
  37. package/api/logiwa/logiwaReportGetInventoryCalculation.js +5 -3
  38. package/api/logiwa/logiwaReportGetInventorySnapshot.js +5 -3
  39. package/api/logiwa/logiwaReportGetTotalInventory.js +5 -3
  40. package/api/logiwa/logiwaWebhookStatusGet.js +4 -2
  41. package/api/logiwa/logiwaWebhookSubscribe.js +8 -6
  42. package/api/logiwa/logiwaWebhookUnsubscribe.js +4 -2
  43. package/api/logiwa/logiwaWebhooksGet.js +4 -2
  44. package/api/loop/loop.utils.js +9 -15
  45. package/api/loop/loopGet.js +20 -24
  46. package/api/loop/loopReturnGet.js +6 -6
  47. package/api/peoplevox/peoplevox.constants.js +1 -1
  48. package/api/peoplevox/peoplevox.sessions.js +0 -33
  49. package/api/peoplevox/peoplevox.utils.js +63 -19
  50. package/api/peoplevox/peoplevoxGetSingle.js +7 -5
  51. package/api/peoplevox/peoplevoxOrderEdit.js +7 -5
  52. package/api/peoplevox/peoplevoxReportGet.js +11 -9
  53. package/api/pipelineSteps.js +49 -0
  54. package/api/shopify/shopify.utils.js +18 -24
  55. package/api/shopify/shopifyBulkMutationDo.js +211 -0
  56. package/api/shopify/shopifyBulkOperationGet.js +86 -0
  57. package/api/shopify/shopifyBulkOperationRunMutation.js +83 -0
  58. package/api/shopify/shopifyCheckoutAndAccountsConfigurationUpdate.js +79 -0
  59. package/api/shopify/shopifyCollectionGet.js +6 -6
  60. package/api/shopify/shopifyCustomerGet.js +6 -6
  61. package/api/shopify/shopifyGet.js +18 -13
  62. package/api/shopify/shopifyGetSingle.js +9 -9
  63. package/api/shopify/shopifyMutationDo.js +6 -6
  64. package/api/shopify/shopifyOrdersGet.js +11 -11
  65. package/api/shopify/shopifyStagedUploadCreate.js +96 -0
  66. package/api/shopify/shopifyTagsAddBulk.js +90 -0
  67. package/api/slack/slack.utils.js +10 -19
  68. package/api/slack/slackMessagePost.js +11 -11
  69. package/api/starshipit/starshipit.constants.js +8 -0
  70. package/api/starshipit/starshipit.utils.js +71 -0
  71. package/api/starshipit/starshipitAddressCreate.js +77 -0
  72. package/api/starshipit/starshipitAddressDelete.js +55 -0
  73. package/api/starshipit/starshipitAddressUpdate.js +69 -0
  74. package/api/starshipit/starshipitAddressesGet.js +52 -0
  75. package/api/starshipit/starshipitGet.js +146 -0
  76. package/api/starshipit/starshipitOrderDelete.js +102 -0
  77. package/api/starshipit/starshipitOrderGet.js +74 -0
  78. package/api/starshipit/starshipitOrderUpdate.js +109 -0
  79. package/api/starshipit/starshipitOrdersListShipped.js +64 -0
  80. package/api/starshipit/starshipitProductAdd.js +100 -0
  81. package/api/starshipit/starshipitProductsDelete.js +57 -0
  82. package/api/starshipit/starshipitProductsGet.js +49 -0
  83. package/api/starshipit/starshipitTrackingGet.js +69 -0
  84. package/api/stripe/_example.js +7 -7
  85. package/api/stripe/stripe.utils.js +9 -14
  86. package/api/stripe/stripeCardTokenCreate.js +11 -11
  87. package/api/stripe/stripeChargeCapture.js +11 -11
  88. package/api/stripe/stripeChargeCreate.js +11 -11
  89. package/api/stripe/stripeChargeGet.js +5 -5
  90. package/api/stripe/stripeChargesGet.js +6 -6
  91. package/api/stripe/stripeRefundCreate.js +10 -10
  92. package/api/stripe/stripeRefundGet.js +5 -5
  93. package/api/stripe/stripeRefundsGet.js +6 -6
  94. package/api/stripe/stripeTokenGet.js +5 -5
  95. package/api/stylearcade/stylearcade.constants.js +5 -0
  96. package/api/stylearcade/stylearcade.utils.js +40 -0
  97. package/api/stylearcade/stylearcadeDataGet.js +62 -0
  98. package/api/stylearcade/stylearcadeGet.js +133 -0
  99. package/api/stylearcade/stylearcadeMetadataGet.js +47 -0
  100. package/api/threeclicks/threeclicks.constants.js +8 -0
  101. package/api/threeclicks/threeclicks.utils.js +119 -0
  102. package/api/threeclicks/threeclicksCollectionsGet.js +40 -0
  103. package/api/threeclicks/threeclicksGet.js +138 -0
  104. package/api/threeclicks/threeclicksKeycodeCreate.js +55 -0
  105. package/api/threeclicks/threeclicksKeycodeGet.js +47 -0
  106. package/api/threeclicks/threeclicksPurchaseOrderCreate.js +34 -0
  107. package/api/threeclicks/threeclicksPurchaseOrderCreateBulk.js +34 -0
  108. package/api/threeclicks/threeclicksPurchaseOrderGet.js +33 -0
  109. package/api/threeclicks/threeclicksPurchaseOrderQuantitiesGet.js +33 -0
  110. package/api/threeclicks/threeclicksPurchaseOrderQuantityCreate.js +34 -0
  111. package/api/threeclicks/threeclicksPurchaseOrderQuantityCreateBulk.js +34 -0
  112. package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdate.js +46 -0
  113. package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdateBulk.js +46 -0
  114. package/api/threeclicks/threeclicksPurchaseOrderUpdate.js +35 -0
  115. package/api/threeclicks/threeclicksPurchaseOrdersGet.js +30 -0
  116. package/api/threeclicks/threeclicksShipmentCreate.js +34 -0
  117. package/api/threeclicks/threeclicksShipmentGet.js +33 -0
  118. package/api/threeclicks/threeclicksShipmentOrderAdd.js +38 -0
  119. package/api/threeclicks/threeclicksShipmentOrderQuantityCreate.js +35 -0
  120. package/api/threeclicks/threeclicksShipmentQuantityUpdate.js +35 -0
  121. package/api/threeclicks/threeclicksShipmentStatusUpdate.js +45 -0
  122. package/api/threeclicks/threeclicksShipmentsGet.js +52 -0
  123. package/api/threeclicks/threeclicksSignatureCalculate.js +73 -0
  124. package/api/threeclicks/threeclicksStyleCodesGet.js +46 -0
  125. package/api/threeclicks/threeclicksStyleColourCreate.js +47 -0
  126. package/api/threeclicks/threeclicksStyleColourDelete.js +34 -0
  127. package/api/threeclicks/threeclicksStyleCreate.js +44 -0
  128. package/api/threeclicks/threeclicksStyleDelete.js +33 -0
  129. package/api/threeclicks/threeclicksStyleGet.js +43 -0
  130. package/api/threeclicks/threeclicksStylePriceUpdate.js +70 -0
  131. package/api/threeclicks/threeclicksStyleUpdate.js +47 -0
  132. package/api/threeclicks/threeclicksStylesGet.js +45 -0
  133. package/api/utils.js +85 -117
  134. package/api/validators.js +1 -1
  135. package/api/workable/workable.utils.js +8 -13
  136. package/api/workable/workableGet.js +16 -11
  137. package/api/workable/workableJobCandidateCreate.js +10 -10
  138. package/api/workable/workableJobGet.js +5 -5
  139. package/api/workable/workableJobMembersGet.js +5 -5
  140. package/api/workable/workableJobStagesGet.js +5 -5
  141. package/api/yotpo/yotpo.utils.js +17 -22
  142. package/api/yotpo/yotpoCampaignsGet.js +6 -6
  143. package/api/yotpo/yotpoCustomerActionRecord.js +7 -7
  144. package/api/yotpo/yotpoCustomerAnniversaryGet.js +7 -7
  145. package/api/yotpo/yotpoCustomerAnniversarySet.js +7 -7
  146. package/api/yotpo/yotpoCustomerBirthdaySet.js +7 -7
  147. package/api/yotpo/yotpoCustomerGet.js +6 -6
  148. package/api/yotpo/yotpoCustomerPointsAdjust.js +7 -7
  149. package/api/yotpo/yotpoCustomerUpsert.js +7 -7
  150. package/api/yotpo/yotpoCustomersRecentGet.js +6 -6
  151. package/api/yotpo/yotpoRedemptionCreate.js +7 -7
  152. package/api/yotpo/yotpoRedemptionOptionsGet.js +6 -6
  153. package/api/yotpo/yotpoVipTiersGet.js +5 -5
  154. package/api/youtube/youtube.constants.js +5 -0
  155. package/api/youtube/youtube.utils.js +77 -0
  156. package/api/youtube/youtubeChannelVideosGet.js +25 -70
  157. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/set-customer-birthday
2
2
 
3
- const { credsFromPayload, objHasAny, ArgsWarden } = require('../utils');
3
+ const { objHasAny, ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -42,8 +42,6 @@ const yotpoCustomerBirthdaySet = async (
42
42
  return rejectResponse;
43
43
  }
44
44
 
45
- const creds = await credsFromPayload(credsPayload);
46
-
47
45
  const {
48
46
  customerId,
49
47
  customerEmail,
@@ -58,11 +56,13 @@ const yotpoCustomerBirthdaySet = async (
58
56
  };
59
57
 
60
58
  const response = await yotpoClient.fetch({
61
- url: '/customer_birthdays',
62
- method: 'post',
63
- body,
59
+ requestPayload: {
60
+ url: '/customer_birthdays',
61
+ method: 'post',
62
+ body,
63
+ },
64
64
  context: {
65
- creds,
65
+ credsPayload,
66
66
  apiVersion,
67
67
  },
68
68
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/fetch-customer-details
2
2
 
3
- const { credsFromPayload, objHasAny, ArgsWarden } = require('../utils');
3
+ const { objHasAny, ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -37,8 +37,6 @@ const yotpoCustomerGet = async (
37
37
  return rejectResponse;
38
38
  }
39
39
 
40
- const creds = await credsFromPayload(credsPayload);
41
-
42
40
  const {
43
41
  customerId,
44
42
  customerEmail,
@@ -57,10 +55,12 @@ const yotpoCustomerGet = async (
57
55
  };
58
56
 
59
57
  const response = await yotpoClient.fetch({
60
- url: '/customers',
61
- params,
58
+ requestPayload: {
59
+ url: '/customers',
60
+ params,
61
+ },
62
62
  context: {
63
- creds,
63
+ credsPayload,
64
64
  apiVersion,
65
65
  },
66
66
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/adjust-a-customers-point-balance
2
2
 
3
- const { credsFromPayload, objHasAny, ArgsWarden } = require('../utils');
3
+ const { objHasAny, ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -40,8 +40,6 @@ const yotpoCustomerPointsAdjust = async (
40
40
  return rejectResponse;
41
41
  }
42
42
 
43
- const creds = await credsFromPayload(credsPayload);
44
-
45
43
  const {
46
44
  customerId,
47
45
  customerEmail,
@@ -57,11 +55,13 @@ const yotpoCustomerPointsAdjust = async (
57
55
  };
58
56
 
59
57
  const response = await yotpoClient.fetch({
60
- url: '/points/adjust',
61
- method: 'post',
62
- body,
58
+ requestPayload: {
59
+ url: '/points/adjust',
60
+ method: 'post',
61
+ body,
62
+ },
63
63
  context: {
64
- creds,
64
+ credsPayload,
65
65
  apiVersion,
66
66
  },
67
67
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/createupdate-customer-records
2
2
 
3
- const { credsFromPayload, ArgsWarden } = require('../utils');
3
+ const { ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -37,8 +37,6 @@ const yotpoCustomerUpsert = async (
37
37
  return rejectResponse;
38
38
  }
39
39
 
40
- const creds = await credsFromPayload(credsPayload);
41
-
42
40
  const body = {
43
41
  email,
44
42
  ...(id && { id }),
@@ -55,11 +53,13 @@ const yotpoCustomerUpsert = async (
55
53
  };
56
54
 
57
55
  const response = await yotpoClient.fetch({
58
- url: '/customers',
59
- method: 'post',
60
- body,
56
+ requestPayload: {
57
+ url: '/customers',
58
+ method: 'post',
59
+ body,
60
+ },
61
61
  context: {
62
- creds,
62
+ credsPayload,
63
63
  apiVersion,
64
64
  },
65
65
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/fetch-all-recently-updated-customers
2
2
 
3
- const { credsFromPayload, ArgsWarden } = require('../utils');
3
+ const { ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -22,18 +22,18 @@ const yotpoCustomersRecentGet = async (
22
22
  return rejectResponse;
23
23
  }
24
24
 
25
- const creds = await credsFromPayload(credsPayload);
26
-
27
25
  const params = {
28
26
  ...(pageInfo && { page_info: pageInfo }),
29
27
  ...(perPage !== undefined && { per_page: perPage }),
30
28
  };
31
29
 
32
30
  const response = await yotpoClient.fetch({
33
- url: '/customers/recent',
34
- params,
31
+ requestPayload: {
32
+ url: '/customers/recent',
33
+ params,
34
+ },
35
35
  context: {
36
- creds,
36
+ credsPayload,
37
37
  apiVersion,
38
38
  },
39
39
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/create-redemption
2
2
 
3
- const { credsFromPayload, objHasAny, ArgsWarden } = require('../utils');
3
+ const { objHasAny, ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -43,8 +43,6 @@ const yotpoRedemptionCreate = async (
43
43
  return rejectResponse;
44
44
  }
45
45
 
46
- const creds = await credsFromPayload(credsPayload);
47
-
48
46
  const {
49
47
  customerId,
50
48
  customerEmail,
@@ -64,11 +62,13 @@ const yotpoRedemptionCreate = async (
64
62
  };
65
63
 
66
64
  const response = await yotpoClient.fetch({
67
- url: '/redemptions',
68
- method: 'post',
69
- body,
65
+ requestPayload: {
66
+ url: '/redemptions',
67
+ method: 'post',
68
+ body,
69
+ },
70
70
  context: {
71
- creds,
71
+ credsPayload,
72
72
  apiVersion,
73
73
  },
74
74
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/fetch-active-redemption-options
2
2
 
3
- const { credsFromPayload, ArgsWarden } = require('../utils');
3
+ const { ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -23,8 +23,6 @@ const yotpoRedemptionOptionsGet = async (
23
23
  return rejectResponse;
24
24
  }
25
25
 
26
- const creds = await credsFromPayload(credsPayload);
27
-
28
26
  const {
29
27
  customerId,
30
28
  customerEmail,
@@ -40,10 +38,12 @@ const yotpoRedemptionOptionsGet = async (
40
38
  };
41
39
 
42
40
  const response = await yotpoClient.fetch({
43
- url: '/redemption_options',
44
- params,
41
+ requestPayload: {
42
+ url: '/redemption_options',
43
+ params,
44
+ },
45
45
  context: {
46
- creds,
46
+ credsPayload,
47
47
  apiVersion,
48
48
  },
49
49
  });
@@ -1,6 +1,6 @@
1
1
  // https://loyaltyapi.yotpo.com/reference/fetch-vip-tiers
2
2
 
3
- const { credsFromPayload, ArgsWarden } = require('../utils');
3
+ const { ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
5
  const { yotpoClient } = require('../yotpo/yotpo.utils');
6
6
 
@@ -20,12 +20,12 @@ const yotpoVipTiersGet = async (
20
20
  return rejectResponse;
21
21
  }
22
22
 
23
- const creds = await credsFromPayload(credsPayload);
24
-
25
23
  const response = await yotpoClient.fetch({
26
- url: '/vip_tiers',
24
+ requestPayload: {
25
+ url: '/vip_tiers',
26
+ },
27
27
  context: {
28
- creds,
28
+ credsPayload,
29
29
  apiVersion,
30
30
  },
31
31
  });
@@ -0,0 +1,5 @@
1
+ const YOUTUBE_API_BASE = 'https://www.googleapis.com/youtube/v3';
2
+
3
+ module.exports = {
4
+ YOUTUBE_API_BASE,
5
+ };
@@ -0,0 +1,77 @@
1
+ const { YOUTUBE_API_BASE } = require('../youtube/youtube.constants');
2
+ const { resolveCreds, useBaseUrl } = require('../pipelineSteps');
3
+ const {
4
+ FetchClient,
5
+ } = require('../utils');
6
+
7
+ const useApiKeyParam = async (state) => {
8
+ const { requestPayload, context } = state;
9
+ const { creds } = context;
10
+ const { API_KEY } = creds;
11
+
12
+ return {
13
+ requestPayload: {
14
+ ...requestPayload,
15
+ params: {
16
+ key: API_KEY,
17
+ ...requestPayload.params,
18
+ },
19
+ },
20
+ };
21
+ };
22
+
23
+ const interpretYoutubeResponse = async (state) => {
24
+ const { response } = state;
25
+
26
+ if (!response.ok) {
27
+ const youtubeError = response.error?.details?.error;
28
+
29
+ if (youtubeError) {
30
+ return {
31
+ response: {
32
+ ok: false,
33
+ error: {
34
+ code: youtubeError.code,
35
+ message: youtubeError.message,
36
+ details: youtubeError,
37
+ },
38
+ },
39
+ breakChain: true,
40
+ };
41
+ }
42
+
43
+ return { breakChain: true };
44
+ }
45
+
46
+ const { data } = response;
47
+
48
+ if (data?.error) {
49
+ return {
50
+ response: {
51
+ ok: false,
52
+ error: {
53
+ code: data.error.code,
54
+ message: data.error.message,
55
+ details: data.error,
56
+ },
57
+ },
58
+ breakChain: true,
59
+ };
60
+ }
61
+
62
+ return {};
63
+ };
64
+
65
+ const youtubeClient = new FetchClient({
66
+ pipeline: [
67
+ resolveCreds,
68
+ useBaseUrl(YOUTUBE_API_BASE),
69
+ useApiKeyParam,
70
+ 'fetch',
71
+ interpretYoutubeResponse,
72
+ ],
73
+ });
74
+
75
+ module.exports = {
76
+ youtubeClient,
77
+ };
@@ -1,9 +1,8 @@
1
1
  // https://developers.google.com/youtube/v3/guides/implementation/videos
2
2
 
3
- const { FetchClient, credsFromPayload, ArgsWarden } = require('../utils');
3
+ const { ArgsWarden } = require('../utils');
4
4
  const { credsValidator } = require('../validators');
5
-
6
- const YOUTUBE_API_BASE = 'https://www.googleapis.com/youtube/v3';
5
+ const { youtubeClient } = require('../youtube/youtube.utils');
7
6
 
8
7
  const parseChannelHandle = (channelHandle) => {
9
8
  const trimmed = channelHandle.trim();
@@ -15,54 +14,6 @@ const parseChannelHandle = (channelHandle) => {
15
14
  return trimmed;
16
15
  };
17
16
 
18
- const youtubeClient = new FetchClient({
19
- requestPreparer: async (requestPayload, context) => {
20
- const { creds } = context;
21
- const { API_KEY } = creds;
22
-
23
- return {
24
- ...requestPayload,
25
- params: {
26
- key: API_KEY,
27
- ...requestPayload.params,
28
- },
29
- };
30
- },
31
- responseInterpreter: async (response) => {
32
- if (!response.ok) {
33
- const youtubeError = response.error?.details?.error;
34
-
35
- if (youtubeError) {
36
- return {
37
- ok: false,
38
- error: {
39
- code: youtubeError.code,
40
- message: youtubeError.message,
41
- details: youtubeError,
42
- },
43
- };
44
- }
45
-
46
- return response;
47
- }
48
-
49
- const { data } = response;
50
-
51
- if (data?.error) {
52
- return {
53
- ok: false,
54
- error: {
55
- code: data.error.code,
56
- message: data.error.message,
57
- details: data.error,
58
- },
59
- };
60
- }
61
-
62
- return response;
63
- },
64
- });
65
-
66
17
  const formatVideo = (video) => {
67
18
  const {
68
19
  id,
@@ -106,17 +57,17 @@ const youtubeChannelVideosGet = async (
106
57
  return rejectResponse;
107
58
  }
108
59
 
109
- const creds = await credsFromPayload(credsPayload);
110
- const fetchContext = { creds };
111
60
  const handle = parseChannelHandle(channelHandle);
112
61
 
113
62
  const channelResponse = await youtubeClient.fetch({
114
- url: `${ YOUTUBE_API_BASE }/channels`,
115
- params: {
116
- part: 'contentDetails',
117
- forHandle: handle,
63
+ requestPayload: {
64
+ url: '/channels',
65
+ params: {
66
+ part: 'contentDetails',
67
+ forHandle: handle,
68
+ },
118
69
  },
119
- context: fetchContext,
70
+ context: { credsPayload },
120
71
  inspect,
121
72
  });
122
73
 
@@ -153,14 +104,16 @@ const youtubeChannelVideosGet = async (
153
104
 
154
105
  while (true) {
155
106
  const playlistResponse = await youtubeClient.fetch({
156
- url: `${ YOUTUBE_API_BASE }/playlistItems`,
157
- params: {
158
- part: 'contentDetails',
159
- playlistId: uploadsPlaylistId,
160
- maxResults: 50,
161
- ...(nextPageToken ? { pageToken: nextPageToken } : {}),
107
+ requestPayload: {
108
+ url: '/playlistItems',
109
+ params: {
110
+ part: 'contentDetails',
111
+ playlistId: uploadsPlaylistId,
112
+ maxResults: 50,
113
+ ...(nextPageToken ? { pageToken: nextPageToken } : {}),
114
+ },
162
115
  },
163
- context: fetchContext,
116
+ context: { credsPayload },
164
117
  inspect,
165
118
  });
166
119
 
@@ -202,12 +155,14 @@ const youtubeChannelVideosGet = async (
202
155
  const batchIds = videoIds.slice(index, index + 50).join(',');
203
156
 
204
157
  const videosResponse = await youtubeClient.fetch({
205
- url: `${ YOUTUBE_API_BASE }/videos`,
206
- params: {
207
- part: 'snippet,statistics,contentDetails',
208
- id: batchIds,
158
+ requestPayload: {
159
+ url: '/videos',
160
+ params: {
161
+ part: 'snippet,statistics,contentDetails',
162
+ id: batchIds,
163
+ },
209
164
  },
210
- context: fetchContext,
165
+ context: { credsPayload },
211
166
  inspect,
212
167
  });
213
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxtware/mineral",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "bin": {
5
5
  "mineral": "bin/mineral.js"
6
6
  },