Untitled

 avatar
unknown
typescript
2 years ago
1.3 kB
3
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/get-file-from-repository/get-file-from-repository.js';

export const definition = fromPipeDream(
	path,
	{
		id: 'action.bitbucket.get-file-from-repository',
		icon: 'https://i.hizliresim.com/5cg3sym.png',
		auth: 'oauth',
		apiAction: 'noScope',
		desc: "Gets the actual file contents of a download artifact and not the artifact's metadata. [See docs here](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads/#api-repositories-workspace-repo-slug-downloads-filename-get)",
		keywords: ['get file', 'get file from', 'get file from repository', 'repository', 'get'],
		inputs: [
			{
				name: 'filename',
				showOnDiagram: false,
				type: typeFor('Text'),
			},
		],
		outputs: [
			{
				name: 'file',
				type: typeFor('Entity<?>'),
			},
		],
	},
	async (inputs, actualRun) => {
		const rawInputs = _.mapValues(inputs, (v) => v.value) as PDFunctionInputs;

		const response = await actualRun(rawInputs);

		return {
			name: 'Result',
			outputs: {
				fileContent: valueAs(typeFor('string'), response),
			},
		};
	},
);
Editor is loading...