update-issue-cpmment

 avatar
unknown
typescript
2 years ago
1.2 kB
4
Indexable
import _ from 'lodash';

import { fromPipeDream } from '@automation/components/pipedream';
import { typeFor, valueAs } from '@automation/helpers/value';
import { PDFunctionInputs } from '@automation/api-types';

const path = 'bitbucket/actions/update-issue-comment/update-issue-comment.js';

export const definition = fromPipeDream(
	path,
	{
		id: 'action.bitbucket.update-issue-comment',
		icon: 'https://i.hizliresim.com/5cg3sym.png',
		auth: 'oauth',
		apiAction: 'noScope',
		desc: 'Update a snippet comment. [See docs here](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-snippets/#api-snippets-workspace-encoded-id-comments-comment-id-put)',
		keywords: ['update comment', 'comment', 'change comment'],
		outputs: [
			{
				name: 'comment',
				type: typeFor('Entity<?>'),
			},
		],
	},
	async (inputs, actualRun) => {
		const rawInputs = _.mapValues(inputs, (v) => v.value) as PDFunctionInputs;

		if (!rawInputs.htmlContent && !rawInputs.rawContent && !rawInputs.markupContent)
			throw new Error('Need to provide at least one content type');

		const response = await actualRun(rawInputs);

		return {
			name: 'Result',
			outputs: {
				comment: valueAs(typeFor('Entity<?>'), response),
			},
		};
	},
);
Editor is loading...