@adobe/spacecat-helix-content-sdk
v1.1.12
Published
A simple SDK to be able to modify documents directly in the helix content bus
Downloads
1,189
Maintainers
Keywords
Readme
Spacecat Helix Content SDK
This library offers a minimal SDK around content bus modifications for Helix. It currently supports 2 backends:
- Microsoft Sharepoint, via an application service principal
- Google Drive, via a service account
:warning: Still early stage, so use at your own risk knowing we have:
- No input validation
- No error handling
- No tests
Install
Just run:
npm install @adobe/spacecat-helix-content-sdk
Giving access to the client
Google Drive
- Go to your Google Cloud console
- Select the project to create the API access in
- Enable the
Google Drive API
,Google Docs API
&Google Sheets API
- Create a new service account
- Create a new key for the service account
- Share the Google Drive folder for the project with the service account email
Microsoft Sharepoint
- Create a new App Registration in your azure portal
- Create a client credential (certificate or secret) for it
- Set the API permissions to
Files.SelectedOperations.Selected
andSites.Selected
- Give the app access to the desired Sharepoint site collection: https://devblogs.microsoft.com/microsoft365dev/controlling-app-access-on-specific-sharepoint-site-collections/
Usage
Google Drive
import { createFrom } from '../src/index.js';
const gdriveclient = await createFrom({
client_email: '',
private_key: '',
private_key_id: '',
project_id: '',
client_id: '',
type: '',
auth_uri: '',
token_uri: '',
auth_provider_x509_cert_url: '',
client_x509_cert_url: '',
universe_domain: '',
}, { url: 'GOOGLE_DRIVE_URL', type: 'drive.google' });
const results = await client.getPageMetadata('/index');
console.log(results);
Microsoft Sharepoint Drive
import { createFrom } from '../src/index.js';
const onedriveclient = await createFrom({
clientId: '',
clientSecret: '',
authority: '',
domainId: '',
}, { url: 'ONEDRIVE_URL', type: 'onedrive' });
const results = await client.getPageMetadata('/index.docx');
console.log(results);
Client API
See: client.interface.js