mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
28 lines
783 B
TypeScript
28 lines
783 B
TypeScript
import type { ICredentialsResponse, IShareCredentialsPayload } from '@/Interface';
|
|
import type { IRestApiContext } from '@n8n/rest-api-client';
|
|
import { makeRestApiRequest } from '@n8n/rest-api-client';
|
|
import type { IDataObject } from 'n8n-workflow';
|
|
|
|
export async function setCredentialSharedWith(
|
|
context: IRestApiContext,
|
|
id: string,
|
|
data: IShareCredentialsPayload,
|
|
): Promise<ICredentialsResponse> {
|
|
return await makeRestApiRequest(
|
|
context,
|
|
'PUT',
|
|
`/credentials/${id}/share`,
|
|
data as unknown as IDataObject,
|
|
);
|
|
}
|
|
|
|
export async function moveCredentialToProject(
|
|
context: IRestApiContext,
|
|
id: string,
|
|
destinationProjectId: string,
|
|
): Promise<void> {
|
|
return await makeRestApiRequest(context, 'PUT', `/credentials/${id}/transfer`, {
|
|
destinationProjectId,
|
|
});
|
|
}
|