@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.
- package/.creds.yml.sample +27 -6
- package/AGENTS.md +6 -1
- package/README.md +1 -1
- package/api/bleckmann/.gitkeep +0 -0
- package/api/bleckmann/bleckmann.constants.js +8 -0
- package/api/bleckmann/bleckmann.utils.js +32 -0
- package/api/bleckmann/bleckmannAsnGet.js +52 -0
- package/api/bleckmann/bleckmannAsnsGet.js +65 -0
- package/api/constants.js +2 -1
- package/api/github/github.constants.js +11 -0
- package/api/github/github.utils.js +65 -0
- package/api/github/githubGet.js +144 -0
- package/api/github/githubIssueCreate.js +71 -0
- package/api/github/githubIssueGet.js +65 -0
- package/api/github/githubIssueUpdate.js +71 -0
- package/api/github/githubIssuesGet.js +74 -0
- package/api/github/githubPullRequestCreate.js +74 -0
- package/api/github/githubPullRequestGet.js +65 -0
- package/api/github/githubPullRequestMerge.js +77 -0
- package/api/github/githubPullRequestUpdate.js +72 -0
- package/api/github/githubPullRequestsGet.js +74 -0
- package/api/github/githubRepoCreate.js +80 -0
- package/api/github/githubRepoDelete.js +60 -0
- package/api/github/githubRepoGet.js +61 -0
- package/api/github/githubRepoUpdate.js +68 -0
- package/api/github/githubReposGet.js +69 -0
- package/api/github/githubUserGet.js +64 -0
- package/api/linear/linear.utils.js +9 -14
- package/api/linear/linearIssuesGet.js +9 -9
- package/api/logiwa/logiwa.utils.js +27 -25
- package/api/logiwa/logiwaInventoriesGet.js +5 -3
- package/api/logiwa/logiwaOrderGet.js +4 -2
- package/api/logiwa/logiwaOrdersGet.js +5 -3
- package/api/logiwa/logiwaProductGet.js +4 -2
- package/api/logiwa/logiwaProductsGet.js +5 -3
- package/api/logiwa/logiwaReportGetAvailableToPromise.js +5 -3
- package/api/logiwa/logiwaReportGetInventoryCalculation.js +5 -3
- package/api/logiwa/logiwaReportGetInventorySnapshot.js +5 -3
- package/api/logiwa/logiwaReportGetTotalInventory.js +5 -3
- package/api/logiwa/logiwaWebhookStatusGet.js +4 -2
- package/api/logiwa/logiwaWebhookSubscribe.js +8 -6
- package/api/logiwa/logiwaWebhookUnsubscribe.js +4 -2
- package/api/logiwa/logiwaWebhooksGet.js +4 -2
- package/api/loop/loop.utils.js +9 -15
- package/api/loop/loopGet.js +20 -24
- package/api/loop/loopReturnGet.js +6 -6
- package/api/peoplevox/peoplevox.constants.js +1 -1
- package/api/peoplevox/peoplevox.sessions.js +0 -33
- package/api/peoplevox/peoplevox.utils.js +63 -19
- package/api/peoplevox/peoplevoxGetSingle.js +7 -5
- package/api/peoplevox/peoplevoxOrderEdit.js +7 -5
- package/api/peoplevox/peoplevoxReportGet.js +11 -9
- package/api/pipelineSteps.js +49 -0
- package/api/shopify/shopify.utils.js +18 -24
- package/api/shopify/shopifyBulkMutationDo.js +211 -0
- package/api/shopify/shopifyBulkOperationGet.js +86 -0
- package/api/shopify/shopifyBulkOperationRunMutation.js +83 -0
- package/api/shopify/shopifyCheckoutAndAccountsConfigurationUpdate.js +79 -0
- package/api/shopify/shopifyCollectionGet.js +6 -6
- package/api/shopify/shopifyCustomerGet.js +6 -6
- package/api/shopify/shopifyGet.js +18 -13
- package/api/shopify/shopifyGetSingle.js +9 -9
- package/api/shopify/shopifyMutationDo.js +6 -6
- package/api/shopify/shopifyOrdersGet.js +11 -11
- package/api/shopify/shopifyStagedUploadCreate.js +96 -0
- package/api/shopify/shopifyTagsAddBulk.js +90 -0
- package/api/slack/slack.utils.js +10 -19
- package/api/slack/slackMessagePost.js +11 -11
- package/api/starshipit/starshipit.constants.js +8 -0
- package/api/starshipit/starshipit.utils.js +71 -0
- package/api/starshipit/starshipitAddressCreate.js +77 -0
- package/api/starshipit/starshipitAddressDelete.js +55 -0
- package/api/starshipit/starshipitAddressUpdate.js +69 -0
- package/api/starshipit/starshipitAddressesGet.js +52 -0
- package/api/starshipit/starshipitGet.js +146 -0
- package/api/starshipit/starshipitOrderDelete.js +102 -0
- package/api/starshipit/starshipitOrderGet.js +74 -0
- package/api/starshipit/starshipitOrderUpdate.js +109 -0
- package/api/starshipit/starshipitOrdersListShipped.js +64 -0
- package/api/starshipit/starshipitProductAdd.js +100 -0
- package/api/starshipit/starshipitProductsDelete.js +57 -0
- package/api/starshipit/starshipitProductsGet.js +49 -0
- package/api/starshipit/starshipitTrackingGet.js +69 -0
- package/api/stripe/_example.js +7 -7
- package/api/stripe/stripe.utils.js +9 -14
- package/api/stripe/stripeCardTokenCreate.js +11 -11
- package/api/stripe/stripeChargeCapture.js +11 -11
- package/api/stripe/stripeChargeCreate.js +11 -11
- package/api/stripe/stripeChargeGet.js +5 -5
- package/api/stripe/stripeChargesGet.js +6 -6
- package/api/stripe/stripeRefundCreate.js +10 -10
- package/api/stripe/stripeRefundGet.js +5 -5
- package/api/stripe/stripeRefundsGet.js +6 -6
- package/api/stripe/stripeTokenGet.js +5 -5
- package/api/stylearcade/stylearcade.constants.js +5 -0
- package/api/stylearcade/stylearcade.utils.js +40 -0
- package/api/stylearcade/stylearcadeDataGet.js +62 -0
- package/api/stylearcade/stylearcadeGet.js +133 -0
- package/api/stylearcade/stylearcadeMetadataGet.js +47 -0
- package/api/threeclicks/threeclicks.constants.js +8 -0
- package/api/threeclicks/threeclicks.utils.js +119 -0
- package/api/threeclicks/threeclicksCollectionsGet.js +40 -0
- package/api/threeclicks/threeclicksGet.js +138 -0
- package/api/threeclicks/threeclicksKeycodeCreate.js +55 -0
- package/api/threeclicks/threeclicksKeycodeGet.js +47 -0
- package/api/threeclicks/threeclicksPurchaseOrderCreate.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderCreateBulk.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderGet.js +33 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantitiesGet.js +33 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreate.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreateBulk.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdate.js +46 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdateBulk.js +46 -0
- package/api/threeclicks/threeclicksPurchaseOrderUpdate.js +35 -0
- package/api/threeclicks/threeclicksPurchaseOrdersGet.js +30 -0
- package/api/threeclicks/threeclicksShipmentCreate.js +34 -0
- package/api/threeclicks/threeclicksShipmentGet.js +33 -0
- package/api/threeclicks/threeclicksShipmentOrderAdd.js +38 -0
- package/api/threeclicks/threeclicksShipmentOrderQuantityCreate.js +35 -0
- package/api/threeclicks/threeclicksShipmentQuantityUpdate.js +35 -0
- package/api/threeclicks/threeclicksShipmentStatusUpdate.js +45 -0
- package/api/threeclicks/threeclicksShipmentsGet.js +52 -0
- package/api/threeclicks/threeclicksSignatureCalculate.js +73 -0
- package/api/threeclicks/threeclicksStyleCodesGet.js +46 -0
- package/api/threeclicks/threeclicksStyleColourCreate.js +47 -0
- package/api/threeclicks/threeclicksStyleColourDelete.js +34 -0
- package/api/threeclicks/threeclicksStyleCreate.js +44 -0
- package/api/threeclicks/threeclicksStyleDelete.js +33 -0
- package/api/threeclicks/threeclicksStyleGet.js +43 -0
- package/api/threeclicks/threeclicksStylePriceUpdate.js +70 -0
- package/api/threeclicks/threeclicksStyleUpdate.js +47 -0
- package/api/threeclicks/threeclicksStylesGet.js +45 -0
- package/api/utils.js +85 -117
- package/api/validators.js +1 -1
- package/api/workable/workable.utils.js +8 -13
- package/api/workable/workableGet.js +16 -11
- package/api/workable/workableJobCandidateCreate.js +10 -10
- package/api/workable/workableJobGet.js +5 -5
- package/api/workable/workableJobMembersGet.js +5 -5
- package/api/workable/workableJobStagesGet.js +5 -5
- package/api/yotpo/yotpo.utils.js +17 -22
- package/api/yotpo/yotpoCampaignsGet.js +6 -6
- package/api/yotpo/yotpoCustomerActionRecord.js +7 -7
- package/api/yotpo/yotpoCustomerAnniversaryGet.js +7 -7
- package/api/yotpo/yotpoCustomerAnniversarySet.js +7 -7
- package/api/yotpo/yotpoCustomerBirthdaySet.js +7 -7
- package/api/yotpo/yotpoCustomerGet.js +6 -6
- package/api/yotpo/yotpoCustomerPointsAdjust.js +7 -7
- package/api/yotpo/yotpoCustomerUpsert.js +7 -7
- package/api/yotpo/yotpoCustomersRecentGet.js +6 -6
- package/api/yotpo/yotpoRedemptionCreate.js +7 -7
- package/api/yotpo/yotpoRedemptionOptionsGet.js +6 -6
- package/api/yotpo/yotpoVipTiersGet.js +5 -5
- package/api/youtube/youtube.constants.js +5 -0
- package/api/youtube/youtube.utils.js +77 -0
- package/api/youtube/youtubeChannelVideosGet.js +25 -70
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/issues/issues#list-repository-issues
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubGet } = require('../github/githubGet');
|
|
6
|
+
const { MAX_PER_PAGE } = require('../github/github.constants');
|
|
7
|
+
|
|
8
|
+
const argsWarden = new ArgsWarden([
|
|
9
|
+
['credsPayload', credsValidator],
|
|
10
|
+
['owner'],
|
|
11
|
+
['repo'],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const githubIssuesGet = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
{
|
|
19
|
+
state,
|
|
20
|
+
labels,
|
|
21
|
+
sort,
|
|
22
|
+
direction,
|
|
23
|
+
since,
|
|
24
|
+
perPage,
|
|
25
|
+
...getterOptions
|
|
26
|
+
} = {},
|
|
27
|
+
) => {
|
|
28
|
+
|
|
29
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
30
|
+
credsPayload,
|
|
31
|
+
owner,
|
|
32
|
+
repo,
|
|
33
|
+
});
|
|
34
|
+
if (rejectResponse) {
|
|
35
|
+
return rejectResponse;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const params = {
|
|
39
|
+
...state && { state },
|
|
40
|
+
...labels && { labels },
|
|
41
|
+
...sort && { sort },
|
|
42
|
+
...direction && { direction },
|
|
43
|
+
...since && { since },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return githubGet(credsPayload, `/repos/${ owner }/${ repo }/issues`, {
|
|
47
|
+
params,
|
|
48
|
+
perPage: perPage ?? MAX_PER_PAGE,
|
|
49
|
+
...getterOptions,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const funcApiConfig = {
|
|
54
|
+
argsWarden,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
githubIssuesGet,
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
curl -X POST "http://localhost:8000/githubIssuesGet" \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{
|
|
66
|
+
"credsPayload": { "credsPath": "github" },
|
|
67
|
+
"owner": "GorgonFreeman",
|
|
68
|
+
"repo": "mineral",
|
|
69
|
+
"options": {
|
|
70
|
+
"state": "open",
|
|
71
|
+
"limit": 10
|
|
72
|
+
}
|
|
73
|
+
}'
|
|
74
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const pullRequestPayloadValidator = (pullRequestPayload) => {
|
|
8
|
+
return Boolean(pullRequestPayload?.head) && Boolean(pullRequestPayload?.base);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const argsWarden = new ArgsWarden([
|
|
12
|
+
['credsPayload', credsValidator],
|
|
13
|
+
['owner'],
|
|
14
|
+
['repo'],
|
|
15
|
+
['pullRequestPayload', pullRequestPayloadValidator],
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const githubPullRequestCreate = async (
|
|
19
|
+
credsPayload,
|
|
20
|
+
owner,
|
|
21
|
+
repo,
|
|
22
|
+
pullRequestPayload,
|
|
23
|
+
{
|
|
24
|
+
apiVersion,
|
|
25
|
+
} = {},
|
|
26
|
+
) => {
|
|
27
|
+
|
|
28
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
29
|
+
credsPayload,
|
|
30
|
+
owner,
|
|
31
|
+
repo,
|
|
32
|
+
pullRequestPayload,
|
|
33
|
+
});
|
|
34
|
+
if (rejectResponse) {
|
|
35
|
+
return rejectResponse;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return githubClient.fetch({
|
|
39
|
+
requestPayload: {
|
|
40
|
+
method: 'post',
|
|
41
|
+
url: `/repos/${ owner }/${ repo }/pulls`,
|
|
42
|
+
body: pullRequestPayload,
|
|
43
|
+
},
|
|
44
|
+
context: {
|
|
45
|
+
credsPayload,
|
|
46
|
+
apiVersion,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const funcApiConfig = {
|
|
52
|
+
argsWarden,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
githubPullRequestCreate,
|
|
57
|
+
funcApiConfig,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
curl -X POST "http://localhost:8000/githubPullRequestCreate" \
|
|
62
|
+
-H "Content-Type: application/json" \
|
|
63
|
+
-d '{
|
|
64
|
+
"credsPayload": { "credsPath": "github" },
|
|
65
|
+
"owner": "GorgonFreeman",
|
|
66
|
+
"repo": "mineral",
|
|
67
|
+
"pullRequestPayload": {
|
|
68
|
+
"title": "Amazing new feature",
|
|
69
|
+
"head": "feature-branch",
|
|
70
|
+
"base": "main",
|
|
71
|
+
"body": "Please review"
|
|
72
|
+
}
|
|
73
|
+
}'
|
|
74
|
+
*/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
['pullNumber'],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const githubPullRequestGet = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pullNumber,
|
|
19
|
+
{
|
|
20
|
+
params,
|
|
21
|
+
apiVersion,
|
|
22
|
+
} = {},
|
|
23
|
+
) => {
|
|
24
|
+
|
|
25
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
26
|
+
credsPayload,
|
|
27
|
+
owner,
|
|
28
|
+
repo,
|
|
29
|
+
pullNumber,
|
|
30
|
+
});
|
|
31
|
+
if (rejectResponse) {
|
|
32
|
+
return rejectResponse;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return githubClient.fetch({
|
|
36
|
+
requestPayload: {
|
|
37
|
+
url: `/repos/${ owner }/${ repo }/pulls/${ pullNumber }`,
|
|
38
|
+
params,
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
credsPayload,
|
|
42
|
+
apiVersion,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const funcApiConfig = {
|
|
48
|
+
argsWarden,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
githubPullRequestGet,
|
|
53
|
+
funcApiConfig,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
curl -X POST "http://localhost:8000/githubPullRequestGet" \
|
|
58
|
+
-H "Content-Type: application/json" \
|
|
59
|
+
-d '{
|
|
60
|
+
"credsPayload": { "credsPath": "github" },
|
|
61
|
+
"owner": "GorgonFreeman",
|
|
62
|
+
"repo": "mineral",
|
|
63
|
+
"pullNumber": 1
|
|
64
|
+
}'
|
|
65
|
+
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
['pullNumber'],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const githubPullRequestMerge = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pullNumber,
|
|
19
|
+
{
|
|
20
|
+
commitTitle,
|
|
21
|
+
commitMessage,
|
|
22
|
+
sha,
|
|
23
|
+
mergeMethod,
|
|
24
|
+
apiVersion,
|
|
25
|
+
} = {},
|
|
26
|
+
) => {
|
|
27
|
+
|
|
28
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
29
|
+
credsPayload,
|
|
30
|
+
owner,
|
|
31
|
+
repo,
|
|
32
|
+
pullNumber,
|
|
33
|
+
});
|
|
34
|
+
if (rejectResponse) {
|
|
35
|
+
return rejectResponse;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return githubClient.fetch({
|
|
39
|
+
requestPayload: {
|
|
40
|
+
method: 'put',
|
|
41
|
+
url: `/repos/${ owner }/${ repo }/pulls/${ pullNumber }/merge`,
|
|
42
|
+
body: {
|
|
43
|
+
...commitTitle && { commit_title: commitTitle },
|
|
44
|
+
...commitMessage && { commit_message: commitMessage },
|
|
45
|
+
...sha && { sha },
|
|
46
|
+
...mergeMethod && { merge_method: mergeMethod },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
context: {
|
|
50
|
+
credsPayload,
|
|
51
|
+
apiVersion,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const funcApiConfig = {
|
|
57
|
+
argsWarden,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
githubPullRequestMerge,
|
|
62
|
+
funcApiConfig,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
curl -X POST "http://localhost:8000/githubPullRequestMerge" \
|
|
67
|
+
-H "Content-Type: application/json" \
|
|
68
|
+
-d '{
|
|
69
|
+
"credsPayload": { "credsPath": "github" },
|
|
70
|
+
"owner": "GorgonFreeman",
|
|
71
|
+
"repo": "mineral",
|
|
72
|
+
"pullNumber": 1,
|
|
73
|
+
"options": {
|
|
74
|
+
"mergeMethod": "squash"
|
|
75
|
+
}
|
|
76
|
+
}'
|
|
77
|
+
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
['pullNumber'],
|
|
12
|
+
['updatePayload', Boolean],
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const githubPullRequestUpdate = async (
|
|
16
|
+
credsPayload,
|
|
17
|
+
owner,
|
|
18
|
+
repo,
|
|
19
|
+
pullNumber,
|
|
20
|
+
updatePayload,
|
|
21
|
+
{
|
|
22
|
+
apiVersion,
|
|
23
|
+
} = {},
|
|
24
|
+
) => {
|
|
25
|
+
|
|
26
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
27
|
+
credsPayload,
|
|
28
|
+
owner,
|
|
29
|
+
repo,
|
|
30
|
+
pullNumber,
|
|
31
|
+
updatePayload,
|
|
32
|
+
});
|
|
33
|
+
if (rejectResponse) {
|
|
34
|
+
return rejectResponse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return githubClient.fetch({
|
|
38
|
+
requestPayload: {
|
|
39
|
+
method: 'patch',
|
|
40
|
+
url: `/repos/${ owner }/${ repo }/pulls/${ pullNumber }`,
|
|
41
|
+
body: updatePayload,
|
|
42
|
+
},
|
|
43
|
+
context: {
|
|
44
|
+
credsPayload,
|
|
45
|
+
apiVersion,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const funcApiConfig = {
|
|
51
|
+
argsWarden,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
githubPullRequestUpdate,
|
|
56
|
+
funcApiConfig,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
curl -X POST "http://localhost:8000/githubPullRequestUpdate" \
|
|
61
|
+
-H "Content-Type: application/json" \
|
|
62
|
+
-d '{
|
|
63
|
+
"credsPayload": { "credsPath": "github" },
|
|
64
|
+
"owner": "GorgonFreeman",
|
|
65
|
+
"repo": "mineral",
|
|
66
|
+
"pullNumber": 1,
|
|
67
|
+
"updatePayload": {
|
|
68
|
+
"title": "Updated title",
|
|
69
|
+
"state": "open"
|
|
70
|
+
}
|
|
71
|
+
}'
|
|
72
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/pulls/pulls#list-pull-requests
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubGet } = require('../github/githubGet');
|
|
6
|
+
const { MAX_PER_PAGE } = require('../github/github.constants');
|
|
7
|
+
|
|
8
|
+
const argsWarden = new ArgsWarden([
|
|
9
|
+
['credsPayload', credsValidator],
|
|
10
|
+
['owner'],
|
|
11
|
+
['repo'],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const githubPullRequestsGet = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
{
|
|
19
|
+
state,
|
|
20
|
+
head,
|
|
21
|
+
base,
|
|
22
|
+
sort,
|
|
23
|
+
direction,
|
|
24
|
+
perPage,
|
|
25
|
+
...getterOptions
|
|
26
|
+
} = {},
|
|
27
|
+
) => {
|
|
28
|
+
|
|
29
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
30
|
+
credsPayload,
|
|
31
|
+
owner,
|
|
32
|
+
repo,
|
|
33
|
+
});
|
|
34
|
+
if (rejectResponse) {
|
|
35
|
+
return rejectResponse;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const params = {
|
|
39
|
+
...state && { state },
|
|
40
|
+
...head && { head },
|
|
41
|
+
...base && { base },
|
|
42
|
+
...sort && { sort },
|
|
43
|
+
...direction && { direction },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return githubGet(credsPayload, `/repos/${ owner }/${ repo }/pulls`, {
|
|
47
|
+
params,
|
|
48
|
+
perPage: perPage ?? MAX_PER_PAGE,
|
|
49
|
+
...getterOptions,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const funcApiConfig = {
|
|
54
|
+
argsWarden,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
githubPullRequestsGet,
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
curl -X POST "http://localhost:8000/githubPullRequestsGet" \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{
|
|
66
|
+
"credsPayload": { "credsPath": "github" },
|
|
67
|
+
"owner": "GorgonFreeman",
|
|
68
|
+
"repo": "mineral",
|
|
69
|
+
"options": {
|
|
70
|
+
"state": "open",
|
|
71
|
+
"limit": 10
|
|
72
|
+
}
|
|
73
|
+
}'
|
|
74
|
+
*/
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user
|
|
2
|
+
// https://docs.github.com/en/rest/repos/repos#create-an-organization-repository
|
|
3
|
+
|
|
4
|
+
const { ArgsWarden } = require('../utils');
|
|
5
|
+
const { credsValidator } = require('../validators');
|
|
6
|
+
const { githubClient } = require('../github/github.utils');
|
|
7
|
+
|
|
8
|
+
const repoPayloadValidator = (repoPayload) => Boolean(repoPayload?.name);
|
|
9
|
+
|
|
10
|
+
const argsWarden = new ArgsWarden([
|
|
11
|
+
['credsPayload', credsValidator],
|
|
12
|
+
['repoPayload', repoPayloadValidator],
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const githubRepoCreate = async (
|
|
16
|
+
credsPayload,
|
|
17
|
+
repoPayload,
|
|
18
|
+
{
|
|
19
|
+
org,
|
|
20
|
+
apiVersion,
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
repoPayload,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const url = org ? `/orgs/${ org }/repos` : '/user/repos';
|
|
33
|
+
|
|
34
|
+
return githubClient.fetch({
|
|
35
|
+
requestPayload: {
|
|
36
|
+
method: 'post',
|
|
37
|
+
url,
|
|
38
|
+
body: repoPayload,
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
credsPayload,
|
|
42
|
+
apiVersion,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const funcApiConfig = {
|
|
48
|
+
argsWarden,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
githubRepoCreate,
|
|
53
|
+
funcApiConfig,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
curl -X POST "http://localhost:8000/githubRepoCreate" \
|
|
58
|
+
-H "Content-Type: application/json" \
|
|
59
|
+
-d '{
|
|
60
|
+
"credsPayload": { "credsPath": "github" },
|
|
61
|
+
"repoPayload": {
|
|
62
|
+
"name": "my-new-repo",
|
|
63
|
+
"private": true,
|
|
64
|
+
"auto_init": true
|
|
65
|
+
}
|
|
66
|
+
}'
|
|
67
|
+
|
|
68
|
+
curl -X POST "http://localhost:8000/githubRepoCreate" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"credsPayload": { "credsPath": "github" },
|
|
72
|
+
"repoPayload": {
|
|
73
|
+
"name": "my-org-repo",
|
|
74
|
+
"private": false
|
|
75
|
+
},
|
|
76
|
+
"options": {
|
|
77
|
+
"org": "GorgonFreeman"
|
|
78
|
+
}
|
|
79
|
+
}'
|
|
80
|
+
*/
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/repos/repos#delete-a-repository
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const githubRepoDelete = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
owner,
|
|
16
|
+
repo,
|
|
17
|
+
{
|
|
18
|
+
apiVersion,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
owner,
|
|
25
|
+
repo,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return githubClient.fetch({
|
|
32
|
+
requestPayload: {
|
|
33
|
+
method: 'delete',
|
|
34
|
+
url: `/repos/${ owner }/${ repo }`,
|
|
35
|
+
},
|
|
36
|
+
context: {
|
|
37
|
+
credsPayload,
|
|
38
|
+
apiVersion,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const funcApiConfig = {
|
|
44
|
+
argsWarden,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
githubRepoDelete,
|
|
49
|
+
funcApiConfig,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
curl -X POST "http://localhost:8000/githubRepoDelete" \
|
|
54
|
+
-H "Content-Type: application/json" \
|
|
55
|
+
-d '{
|
|
56
|
+
"credsPayload": { "credsPath": "github" },
|
|
57
|
+
"owner": "GorgonFreeman",
|
|
58
|
+
"repo": "my-old-repo"
|
|
59
|
+
}'
|
|
60
|
+
*/
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/repos/repos#get-a-repository
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const githubRepoGet = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
owner,
|
|
16
|
+
repo,
|
|
17
|
+
{
|
|
18
|
+
params,
|
|
19
|
+
apiVersion,
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
owner,
|
|
26
|
+
repo,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return githubClient.fetch({
|
|
33
|
+
requestPayload: {
|
|
34
|
+
url: `/repos/${ owner }/${ repo }`,
|
|
35
|
+
params,
|
|
36
|
+
},
|
|
37
|
+
context: {
|
|
38
|
+
credsPayload,
|
|
39
|
+
apiVersion,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const funcApiConfig = {
|
|
45
|
+
argsWarden,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
githubRepoGet,
|
|
50
|
+
funcApiConfig,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
curl -X POST "http://localhost:8000/githubRepoGet" \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{
|
|
57
|
+
"credsPayload": { "credsPath": "github" },
|
|
58
|
+
"owner": "GorgonFreeman",
|
|
59
|
+
"repo": "mineral"
|
|
60
|
+
}'
|
|
61
|
+
*/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// https://docs.github.com/en/rest/repos/repos#update-a-repository
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { githubClient } = require('../github/github.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['owner'],
|
|
10
|
+
['repo'],
|
|
11
|
+
['updatePayload', Boolean],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const githubRepoUpdate = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
updatePayload,
|
|
19
|
+
{
|
|
20
|
+
apiVersion,
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
owner,
|
|
27
|
+
repo,
|
|
28
|
+
updatePayload,
|
|
29
|
+
});
|
|
30
|
+
if (rejectResponse) {
|
|
31
|
+
return rejectResponse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return githubClient.fetch({
|
|
35
|
+
requestPayload: {
|
|
36
|
+
method: 'patch',
|
|
37
|
+
url: `/repos/${ owner }/${ repo }`,
|
|
38
|
+
body: updatePayload,
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
credsPayload,
|
|
42
|
+
apiVersion,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const funcApiConfig = {
|
|
48
|
+
argsWarden,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
githubRepoUpdate,
|
|
53
|
+
funcApiConfig,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
curl -X POST "http://localhost:8000/githubRepoUpdate" \
|
|
58
|
+
-H "Content-Type: application/json" \
|
|
59
|
+
-d '{
|
|
60
|
+
"credsPayload": { "credsPath": "github" },
|
|
61
|
+
"owner": "GorgonFreeman",
|
|
62
|
+
"repo": "mineral",
|
|
63
|
+
"updatePayload": {
|
|
64
|
+
"description": "Updated description",
|
|
65
|
+
"private": true
|
|
66
|
+
}
|
|
67
|
+
}'
|
|
68
|
+
*/
|