Hi Dennis
Thank you for contributing to the Lucid for Developers Community! I recommend taking a look at our recently released Asana integration. It serves as a more comprehensive example that you can reference.
You can find the relevant code in the asanacardintegration.ts file specifically where the editor extension requests a data action:
import: async (
primaryKeys: string[]
searchFields: Map<string SerializedFieldType>
): Promise<{collection: CollectionProxy; primaryKeys: string[]}> => {
const workspaceId = searchFields.get('workspace');
if (!isString(workspaceId) || !workspaceId) {
throw new Error('No workspace selected');
}
this.updateDefaultCreationProjects(searchFields.get('project'));
await this.editorClient.performDataAction({
dataConnectorName: 'asana'
syncDataSourceIdNonce: workspaceId
actionName: 'Import'
actionData: {workspaceId taskIds: primaryKeys.map((pk) => JSON.parse(pk))}
asynchronous: true
});
const collection = await this.editorClient.awaitDataImport('asana' workspaceId 'Tasks' primaryKeys);
return {collection primaryKeys};
}
And then where the data connector handles that request in importaction.ts:
export const importAction: AsanaAction<DataConnectorAsynchronousAction> = async ({action asanaClient}) => {
if (!importBodyValidator(action.data)) {
throw new DataConnectorRunError(404 'Body must be of type {workspaceId:string taskIds:string[]}');
}
const {workspaceId taskIds} = action.data;
const fullTaskData = await importTasks(new Set(taskIds) asanaClient);
return await uploadTasks(action.client workspaceId fullTaskData asanaClient);
};
You'll also probably want to take a look at where the data connector gets defined in index.ts.
Let me know if you get stuck!
Reply
Create an account in the community
A Lucid account is required to interact with the Community, and your participation is subject to the Supplemental Lucid Community Terms. You may not participate in the Community if you are under age 18. You will be redirected to the Lucid app to log in.
Log in to the community
A Lucid account is required to interact with the Community, and your participation is subject to the Supplemental Lucid Community Terms. You may not participate in the Community if you are under age 18. You will be redirected to the Lucid app to log in.
Log in with Lucid
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.