async enablePublicViewing(docId) {
    const gapiClient = await this._gapiClient;

    // Prepare Google API client library for making Google Drive API requests.
    await gapiClient.init({
      apiKey: this._developerKey,
      clientId: this._clientId,
      discoveryDocs: [
        'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest',
      ],
      scope: GOOGLE_DRIVE_SCOPE,
    });

    const body = {
      type: 'anyone',
      role: 'reader',
    };
    const request = gapiClient.drive.permissions.create({
      fileId: docId,
      resource: body,
    });
    return new Promise((resolve, reject) => {
      request.execute(resolve, reject);
    });
  }
/**
   * Change the sharing settings on a document in Google Drive to make it
   * publicly viewable to anyone with the link.
   *
   * @param {string} docId
   */
Change the sharing settings on a document in Google Drive to make it
publicly viewable to anyone with the link.

@param {string} docId
Change the sharing settings on a document in Google Drive to make it publicly viewable to anyone with the link . @param { string } docId
async enablePublicViewing(docId) {
    const gapiClient = await this._gapiClient;
    await gapiClient.init({
      apiKey: this._developerKey,
      clientId: this._clientId,
      discoveryDocs: [
        'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest',
      ],
      scope: GOOGLE_DRIVE_SCOPE,
    });
    const body = {
      type: 'anyone',
      role: 'reader',
    };
    const request = gapiClient.drive.permissions.create({
      fileId: docId,
      resource: body,
    });
    return new Promise((resolve, reject) => {
      request.execute(resolve, reject);
    });
  }
async enablePublicViewing ( docId ) { const gapiClient = await this . _gapiClient ; await gapiClient . init ( { apiKey : this . _developerKey , clientId : this . _clientId , discoveryDocs : [ 'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest' , ] , scope : GOOGLE_DRIVE_SCOPE , } ) ; const body = { type : 'anyone' , role : 'reader' , } ; const request = gapiClient . drive . permissions . create ( { fileId : docId , resource : body , } ) ; return new Promise ( ( resolve , reject ) => { request . execute ( resolve , reject ) ; } ) ; }
Change the sharing settings on a document in Google Drive to make it
 publicly viewable to anyone with the link.
Change the sharing settings on a document in Google Drive to make it publicly viewable to anyone with the link .
// Prepare Google API client library for making Google Drive API requests.