@foxtware/mineral 0.1.17 → 0.1.19
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 +16 -7
- package/AGENTS.md +4 -0
- package/_build_scripts/createNewFunction.js +10 -5
- package/_build_scripts/publish.js +15 -1
- package/api/backblaze/backblaze.constants.js +11 -0
- package/api/backblaze/backblaze.utils.js +322 -0
- package/api/backblaze/backblazeBucketsGet.js +68 -0
- package/api/backblaze/backblazeFileDelete.js +62 -0
- package/api/backblaze/backblazeFileHide.js +62 -0
- package/api/backblaze/backblazeFileUpload.js +142 -0
- package/api/backblaze/backblazeFilesGet.js +85 -0
- package/api/backblaze/backblazeGet.js +139 -0
- package/api/backblaze/docs.md +6 -0
- package/api/etsy/etsyListingUpdate.js +1 -1
- package/api/gorgias/gorgias.constants.js +8 -0
- package/api/gorgias/gorgias.utils.js +46 -0
- package/api/gorgias/gorgiasAccountGet.js +51 -0
- package/api/gorgias/gorgiasCustomerGet.js +70 -0
- package/api/gorgias/gorgiasCustomersGet.js +56 -0
- package/api/gorgias/gorgiasGet.js +150 -0
- package/api/gorgias/gorgiasGetSingle.js +26 -0
- package/api/gorgias/gorgiasMessagesGet.js +56 -0
- package/api/gorgias/gorgiasTagsGet.js +52 -0
- package/api/gorgias/gorgiasTicketCreate.js +66 -0
- package/api/gorgias/gorgiasTicketGet.js +70 -0
- package/api/gorgias/gorgiasTicketMessageCreate.js +65 -0
- package/api/gorgias/gorgiasTicketMessagesGet.js +66 -0
- package/api/gorgias/gorgiasTicketUpdate.js +62 -0
- package/api/gorgias/gorgiasTicketsGet.js +58 -0
- package/api/gorgias/gorgiasUsersGet.js +52 -0
- package/api/gorgias/gorgiasViewItemsGet.js +57 -0
- package/api/gorgias/gorgiasViewsGet.js +72 -0
- package/api/linear/docs.md +6 -0
- package/api/linear/linear.constants.js +3 -0
- package/api/linear/linear.utils.js +59 -0
- package/api/linear/linearAttachmentCreate.js +77 -0
- package/api/linear/linearAttachmentDelete.js +68 -0
- package/api/linear/linearCommentCreate.js +77 -0
- package/api/linear/linearCommentDelete.js +68 -0
- package/api/linear/linearCommentGet.js +77 -0
- package/api/linear/linearCommentUpdate.js +87 -0
- package/api/linear/linearCommentsGet.js +70 -0
- package/api/linear/linearCyclesGet.js +67 -0
- package/api/linear/linearGet.js +218 -0
- package/api/linear/linearIssueAddLabel.js +77 -0
- package/api/linear/linearIssueArchive.js +74 -0
- package/api/linear/linearIssueCreate.js +94 -0
- package/api/linear/linearIssueDelete.js +74 -0
- package/api/linear/linearIssueGet.js +87 -0
- package/api/linear/linearIssueLabelCreate.js +81 -0
- package/api/linear/linearIssueLabelsGet.js +66 -0
- package/api/linear/linearIssueRemoveLabel.js +77 -0
- package/api/linear/linearIssueUpdate.js +96 -0
- package/api/linear/linearIssuesGet.js +39 -63
- package/api/linear/linearOrganizationGet.js +64 -0
- package/api/linear/linearProjectCreate.js +92 -0
- package/api/linear/linearProjectGet.js +74 -0
- package/api/linear/linearProjectUpdate.js +80 -0
- package/api/linear/linearProjectsGet.js +71 -0
- package/api/linear/linearTeamGet.js +71 -0
- package/api/linear/linearTeamsGet.js +66 -0
- package/api/linear/linearUserGet.js +72 -0
- package/api/linear/linearUsersGet.js +71 -0
- package/api/linear/linearViewerGet.js +65 -0
- package/api/linear/linearWebhookCreate.js +77 -0
- package/api/linear/linearWebhookDelete.js +68 -0
- package/api/linear/linearWebhooksGet.js +67 -0
- package/api/linear/linearWorkflowStatesGet.js +73 -0
- package/api/peoplevox/peoplevox.utils.js +25 -0
- package/api/pipe17/pipe17.utils.js +7 -20
- package/api/pipe17/pipe17ArrivalGet.js +1 -1
- package/api/pipe17/pipe17FulfillmentGet.js +1 -1
- package/api/pipe17/pipe17InventoryItemGet.js +1 -1
- package/api/pipe17/pipe17JobGet.js +11 -24
- package/api/pipe17/pipe17LocationGet.js +1 -1
- package/api/pipe17/pipe17OrderGet.js +1 -1
- package/api/pipe17/pipe17ProductGet.js +1 -1
- package/api/pipe17/pipe17PurchaseGet.js +1 -1
- package/api/pipe17/pipe17ReceiptGet.js +1 -1
- package/api/pipe17/pipe17ReturnGet.js +1 -1
- package/api/shopify/shopifyFileCreate.js +107 -0
- package/api/shopify/shopifyFulfillmentCreate.js +180 -0
- package/api/shopify/shopifyFulfillmentTrackingInfoUpdate.js +92 -0
- package/api/shopify/shopifyMetafieldDefinitionCreate.js +2 -0
- package/api/shopify/shopifyMetafieldDefinitionGet.js +108 -0
- package/api/shopify/shopifyMetafieldDefinitionPropagate.js +93 -86
- package/api/shopify/shopifyOrderFulfill.js +322 -0
- package/api/shopify/shopifyThemeFileGet.js +112 -0
- package/api/shopify/shopifyThemeFilePropagate.js +410 -0
- package/api/shopify/shopifyThemeFilesUpsert.js +88 -0
- package/api/starshipit/starshipit.utils.js +29 -3
- package/api/starshipit/starshipitOrderGet.js +2 -10
- package/api/starshipit/starshipitOrdersGet.js +96 -0
- package/api/utils.js +96 -5
- package/package.json +1 -1
- package/server.utils.js +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// https://developers.gorgias.com/reference/list-users
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { gorgiasGet, gorgiasGetter } = require('../gorgias/gorgiasGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const gorgiasUsersGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
getterOptions = {},
|
|
16
|
+
) => {
|
|
17
|
+
|
|
18
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
19
|
+
credsPayload,
|
|
20
|
+
});
|
|
21
|
+
if (rejectResponse) {
|
|
22
|
+
return rejectResponse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getterArgs = [
|
|
26
|
+
credsPayload,
|
|
27
|
+
'/users',
|
|
28
|
+
getterOptions,
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
return returnGetter
|
|
32
|
+
? gorgiasGetter(...getterArgs)
|
|
33
|
+
: gorgiasGet(...getterArgs);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const funcApiConfig = {
|
|
37
|
+
argsWarden,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
gorgiasUsersGet: (...args) => gorgiasUsersGet(false, ...args),
|
|
42
|
+
gorgiasUsersGetter: (...args) => gorgiasUsersGet(true, ...args),
|
|
43
|
+
funcApiConfig,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
curl -X POST "http://localhost:8000/gorgiasUsersGet" \
|
|
48
|
+
-H "Content-Type: application/json" \
|
|
49
|
+
-d '{
|
|
50
|
+
"credsPayload": { "credsPath": "gorgias" }
|
|
51
|
+
}'
|
|
52
|
+
*/
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// https://developers.gorgias.com/reference/list-view-items
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { gorgiasGet, gorgiasGetter } = require('../gorgias/gorgiasGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['viewId'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const gorgiasViewItemsGet = async (
|
|
13
|
+
returnGetter,
|
|
14
|
+
|
|
15
|
+
credsPayload,
|
|
16
|
+
viewId,
|
|
17
|
+
getterOptions = {},
|
|
18
|
+
) => {
|
|
19
|
+
|
|
20
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
21
|
+
credsPayload,
|
|
22
|
+
viewId,
|
|
23
|
+
});
|
|
24
|
+
if (rejectResponse) {
|
|
25
|
+
return rejectResponse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const getterArgs = [
|
|
29
|
+
credsPayload,
|
|
30
|
+
`/views/${ viewId }/items`,
|
|
31
|
+
getterOptions,
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
return returnGetter
|
|
35
|
+
? gorgiasGetter(...getterArgs)
|
|
36
|
+
: gorgiasGet(...getterArgs);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
gorgiasViewItemsGet: (...args) => gorgiasViewItemsGet(false, ...args),
|
|
45
|
+
gorgiasViewItemsGetter: (...args) => gorgiasViewItemsGet(true, ...args),
|
|
46
|
+
funcApiConfig,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
curl -X POST "http://localhost:8000/gorgiasViewItemsGet" \
|
|
51
|
+
-H "Content-Type: application/json" \
|
|
52
|
+
-d '{
|
|
53
|
+
"credsPayload": { "credsPath": "gorgias" },
|
|
54
|
+
"viewId": "2705014",
|
|
55
|
+
"options": { "limit": 10 }
|
|
56
|
+
}'
|
|
57
|
+
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// https://developers.gorgias.com/reference/list-views
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { gorgiasClient } = require('../gorgias/gorgias.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const normalizeViewsList = (body) => {
|
|
12
|
+
if (Array.isArray(body)) {
|
|
13
|
+
return body;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (Array.isArray(body?.data)) {
|
|
17
|
+
return body.data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return [];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const gorgiasViewsGet = async (
|
|
24
|
+
credsPayload,
|
|
25
|
+
{
|
|
26
|
+
inspect = false,
|
|
27
|
+
fetchClient = gorgiasClient,
|
|
28
|
+
} = {},
|
|
29
|
+
) => {
|
|
30
|
+
|
|
31
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
32
|
+
credsPayload,
|
|
33
|
+
});
|
|
34
|
+
if (rejectResponse) {
|
|
35
|
+
return rejectResponse;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const response = await fetchClient.fetch({
|
|
39
|
+
requestPayload: {
|
|
40
|
+
method: 'get',
|
|
41
|
+
url: '/views',
|
|
42
|
+
},
|
|
43
|
+
context: { credsPayload },
|
|
44
|
+
inspect,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
ok: true,
|
|
53
|
+
data: normalizeViewsList(response.data),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const funcApiConfig = {
|
|
58
|
+
argsWarden,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
gorgiasViewsGet,
|
|
63
|
+
funcApiConfig,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
curl -X POST "http://localhost:8000/gorgiasViewsGet" \
|
|
68
|
+
-H "Content-Type: application/json" \
|
|
69
|
+
-d '{
|
|
70
|
+
"credsPayload": { "credsPath": "gorgias" }
|
|
71
|
+
}'
|
|
72
|
+
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Linear
|
|
2
|
+
|
|
3
|
+
- [GraphQL API](https://linear.app/developers/graphql)
|
|
4
|
+
- [Schema explorer](https://studio.apollographql.com/public/Linear-API/variant/current/home)
|
|
5
|
+
|
|
6
|
+
Single GraphQL endpoint at `https://api.linear.app/graphql`. Authenticate with a personal API key (`Authorization: <API_KEY>`) or OAuth access token (`Authorization: Bearer <ACCESS_TOKEN>`). Pagination follows the Relay connection model (`first` / `after` / `pageInfo` / `nodes`).
|
|
@@ -3,6 +3,8 @@ const { resolveCreds } = require('../pipelineSteps');
|
|
|
3
3
|
const {
|
|
4
4
|
FetchClient,
|
|
5
5
|
fetchClientCommonSteps,
|
|
6
|
+
pathAsArray,
|
|
7
|
+
objectDigNodeAtPath,
|
|
6
8
|
} = require('../utils');
|
|
7
9
|
|
|
8
10
|
const useAuthHeaders = async (state) => {
|
|
@@ -23,16 +25,73 @@ const useAuthHeaders = async (state) => {
|
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
const movePageInfoToMeta = async (state) => {
|
|
29
|
+
const { response, context } = state;
|
|
30
|
+
const { resultPath } = context ?? {};
|
|
31
|
+
|
|
32
|
+
if (!response?.ok || !response?.data || !resultPath) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const connection = objectDigNodeAtPath(response.data, pathAsArray(resultPath));
|
|
37
|
+
|
|
38
|
+
if (!connection?.pageInfo) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
response: {
|
|
44
|
+
meta: {
|
|
45
|
+
pageInfo: connection.pageInfo,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
26
51
|
const linearClient = new FetchClient({
|
|
27
52
|
pipeline: [
|
|
28
53
|
resolveCreds,
|
|
29
54
|
useAuthHeaders,
|
|
30
55
|
'fetch',
|
|
56
|
+
movePageInfoToMeta,
|
|
57
|
+
fetchClientCommonSteps.stripEdgesAndNodes,
|
|
31
58
|
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
32
59
|
fetchClientCommonSteps.exitEarlyOnGraphqlErrors,
|
|
60
|
+
fetchClientCommonSteps.digToPath,
|
|
33
61
|
],
|
|
34
62
|
});
|
|
35
63
|
|
|
64
|
+
const linearConnectionDigester = (response) => {
|
|
65
|
+
if (!response?.ok) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return response?.data ?? [];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const linearConnectionPaginator = async (currentParams, response) => {
|
|
73
|
+
const { args, options } = currentParams;
|
|
74
|
+
|
|
75
|
+
if (!response?.ok) {
|
|
76
|
+
return [true];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const pageInfo = response?.meta?.pageInfo;
|
|
80
|
+
if (!pageInfo?.hasNextPage || !pageInfo?.endCursor) {
|
|
81
|
+
return [true];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return [false, {
|
|
85
|
+
args,
|
|
86
|
+
options: {
|
|
87
|
+
...options,
|
|
88
|
+
after: pageInfo.endCursor,
|
|
89
|
+
},
|
|
90
|
+
}];
|
|
91
|
+
};
|
|
92
|
+
|
|
36
93
|
module.exports = {
|
|
37
94
|
linearClient,
|
|
95
|
+
linearConnectionDigester,
|
|
96
|
+
linearConnectionPaginator,
|
|
38
97
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['input', valueProvided],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearAttachmentCreate = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
input,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
input,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation AttachmentCreate($input: AttachmentCreateInput!) {
|
|
34
|
+
attachmentCreate(input: $input) {
|
|
35
|
+
success
|
|
36
|
+
attachment {
|
|
37
|
+
id
|
|
38
|
+
title
|
|
39
|
+
url
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
variables: {
|
|
45
|
+
input,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
context: {
|
|
50
|
+
credsPayload,
|
|
51
|
+
resultPath: 'data.attachmentCreate',
|
|
52
|
+
},
|
|
53
|
+
inspect,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const funcApiConfig = {
|
|
58
|
+
argsWarden,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
linearAttachmentCreate,
|
|
63
|
+
funcApiConfig,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
curl -X POST "http://localhost:8000/linearAttachmentCreate" \
|
|
68
|
+
-H "Content-Type: application/json" \
|
|
69
|
+
-d '{
|
|
70
|
+
"credsPayload": { "credsPath": "linear" },
|
|
71
|
+
"input": {
|
|
72
|
+
"issueId": "WHI-267",
|
|
73
|
+
"url": "https://example.com/file.pdf",
|
|
74
|
+
"title": "File"
|
|
75
|
+
}
|
|
76
|
+
}'
|
|
77
|
+
*/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearAttachmentDelete = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
id,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
id,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation AttachmentDelete($id: String!) {
|
|
34
|
+
attachmentDelete(id: $id) {
|
|
35
|
+
success
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
variables: {
|
|
40
|
+
id,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
context: {
|
|
45
|
+
credsPayload,
|
|
46
|
+
resultPath: 'data.attachmentDelete',
|
|
47
|
+
},
|
|
48
|
+
inspect,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
linearAttachmentDelete,
|
|
58
|
+
funcApiConfig,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
curl -X POST "http://localhost:8000/linearAttachmentDelete" \
|
|
63
|
+
-H "Content-Type: application/json" \
|
|
64
|
+
-d '{
|
|
65
|
+
"credsPayload": { "credsPath": "linear" },
|
|
66
|
+
"id": "ATTACHMENT_ID"
|
|
67
|
+
}'
|
|
68
|
+
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['input', valueProvided],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearCommentCreate = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
input,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
input,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation CommentCreate($input: CommentCreateInput!) {
|
|
34
|
+
commentCreate(input: $input) {
|
|
35
|
+
success
|
|
36
|
+
comment {
|
|
37
|
+
id
|
|
38
|
+
body
|
|
39
|
+
createdAt
|
|
40
|
+
updatedAt
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
variables: {
|
|
46
|
+
input,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
context: {
|
|
51
|
+
credsPayload,
|
|
52
|
+
resultPath: 'data.commentCreate',
|
|
53
|
+
},
|
|
54
|
+
inspect,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const funcApiConfig = {
|
|
59
|
+
argsWarden,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
linearCommentCreate,
|
|
64
|
+
funcApiConfig,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
curl -X POST "http://localhost:8000/linearCommentCreate" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"credsPayload": { "credsPath": "linear" },
|
|
72
|
+
"input": {
|
|
73
|
+
"issueId": "WHI-267",
|
|
74
|
+
"body": "Hello"
|
|
75
|
+
}
|
|
76
|
+
}'
|
|
77
|
+
*/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearCommentDelete = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
id,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
id,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation CommentDelete($id: String!) {
|
|
34
|
+
commentDelete(id: $id) {
|
|
35
|
+
success
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
variables: {
|
|
40
|
+
id,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
context: {
|
|
45
|
+
credsPayload,
|
|
46
|
+
resultPath: 'data.commentDelete',
|
|
47
|
+
},
|
|
48
|
+
inspect,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
linearCommentDelete,
|
|
58
|
+
funcApiConfig,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
curl -X POST "http://localhost:8000/linearCommentDelete" \
|
|
63
|
+
-H "Content-Type: application/json" \
|
|
64
|
+
-d '{
|
|
65
|
+
"credsPayload": { "credsPath": "linear" },
|
|
66
|
+
"id": "COMMENT_ID"
|
|
67
|
+
}'
|
|
68
|
+
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearCommentGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
id,
|
|
15
|
+
{
|
|
16
|
+
hash,
|
|
17
|
+
inspect = false,
|
|
18
|
+
fetchClient = linearClient,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
id,
|
|
25
|
+
});
|
|
26
|
+
if (rejectResponse) {
|
|
27
|
+
return rejectResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fetchClient.fetch({
|
|
31
|
+
requestPayload: {
|
|
32
|
+
body: {
|
|
33
|
+
query: `
|
|
34
|
+
query CommentGet($id: String!, $hash: String) {
|
|
35
|
+
comment(id: $id, hash: $hash) {
|
|
36
|
+
id
|
|
37
|
+
body
|
|
38
|
+
createdAt
|
|
39
|
+
updatedAt
|
|
40
|
+
user {
|
|
41
|
+
id
|
|
42
|
+
name
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
variables: {
|
|
48
|
+
id,
|
|
49
|
+
hash,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
context: {
|
|
54
|
+
credsPayload,
|
|
55
|
+
resultPath: 'data.comment',
|
|
56
|
+
},
|
|
57
|
+
inspect,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const funcApiConfig = {
|
|
62
|
+
argsWarden,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
module.exports = {
|
|
66
|
+
linearCommentGet,
|
|
67
|
+
funcApiConfig,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
curl -X POST "http://localhost:8000/linearCommentGet" \
|
|
72
|
+
-H "Content-Type: application/json" \
|
|
73
|
+
-d '{
|
|
74
|
+
"credsPayload": { "credsPath": "linear" },
|
|
75
|
+
"id": "COMMENT_ID"
|
|
76
|
+
}'
|
|
77
|
+
*/
|