Skip to content

Commit

Permalink
fix: google client interface (#235)
Browse files Browse the repository at this point in the history
Fix the google client interface, using the correct response types and
parameters
  • Loading branch information
dzehnder authored May 21, 2024
1 parent 592054f commit 9e0dc2c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/spacecat-shared-google-client/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ import { OAuth2Client } from 'google-auth-library';
export default class GoogleClient {
/**
* Static factory method to create an instance of GoogleClient.
*
* @param {UniversalContext} context - An object containing the AWS Lambda context information
* @param {object} config - The configuration object:
* {
* ACCESS_TOKEN: string,
* REFRESH_TOKEN: string,
* EXPIRATION: number,
* }
* @param {string} url - The URL of the site to be audited.
* @returns An instance of GoogleClient.
*/
static createFrom(context: UniversalContext, config: object): GoogleClient;
static createFrom(context: UniversalContext, url: string): GoogleClient;

/**
* Constructor for creating an instance of GoogleClient.
Expand All @@ -36,13 +32,14 @@ export default class GoogleClient {

/**
* Retrieves the Google Search Console data for the specified date range.
*
* @param baseURL - The base URL of the site to be audited.
* @param startDate - The start date of the date range.
* @param endDate - The end date of the date range.
* @param dimensions - The dimensions to be included in the report.
* this parameter is optional and defaults to ['date'],
* which means that the report will be grouped by date.
* @returns {Promise<Response>} The Google Search Console data.
* @returns {Promise<JSON>} The Google Search Console data.
* Format: {
* "rows": [
* {
Expand All @@ -63,12 +60,12 @@ export default class GoogleClient {
startDate: Date,
endDate: Date,
dimensions: string[]
): Promise<Response>;
): Promise<JSON>;

/**
* Lists all sites available to the authenticated user in Google Search Console.
*
* @returns {Promise<Response>} A promise that resolves to the result of the list sites operation.
* @returns {Promise<JSON>} A promise that resolves to the result of the list sites operation.
* @throws {Error} If an error occurs while retrieving the sites.
* Format: {
* "data": {
Expand All @@ -81,5 +78,5 @@ export default class GoogleClient {
* }
*}
* */
listSites(): Promise<Response>;
listSites(): Promise<JSON>;
}

0 comments on commit 9e0dc2c

Please sign in to comment.