@adobe/spacecat-shared-google-client
v1.3.1
Published
Shared modules of the Spacecat Services - Google Client
Downloads
1,497
Maintainers
Keywords
Readme
Spacecat Shared - Google Client
The GoogleClient library provides an easy-to-use interface for interacting with Google Search Console APIs. It allows for secure retrieval of organic search data and site listings using OAuth2 authentication, with credentials managed via AWS Secrets Manager.
Installation
Install the package using npm:
npm install @adobe/spacecat-shared-google-client
Environment Variables
GOOGLE_CLIENT_ID
: Google OAuth2 client IDGOOGLE_CLIENT_SECRET
: Google OAuth2 client secretGOOGLE_REDIRECT_URI
: Google OAuth2 redirect URI:- For dev environment: https://spacecat.experiencecloud.live/api/ci/auth/google
- For prod environment: https://spacecat.experiencecloud.live/api/v1/auth/google
Usage
import GoogleClient from '@adobe/spacecat-shared-google-client';
...
try {
const googleClient = await GoogleClient.createFrom(context, baseURL);
const result = await googleClient.getOrganicTrafficData(startDate, endDate);
} catch (error) {
// handle error
}
...
Testing
To run tests:
npm run test
Linting
Lint your code:
npm run lint
Cleaning
To remove node_modules
and package-lock.json
:
npm run clean
Additional Information
- Repository: GitHub
- Issue Tracking: GitHub Issues
- License: Apache-2.0