How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/gmail.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const gmail = google.gmail('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
          'https://www.googleapis.com/auth/gmail.settings.basic',
          'https://www.googleapis.com/auth/gmail.settings.sharing',
        ],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await gmail.users.settings.sendAs.update({
        // The send-as alias to be updated.
        sendAsEmail: 'placeholder-value',
        // User's email address. The special value "me" can be used to indicate the authenticated user.
        userId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "displayName": "my_displayName",
          //   "isDefault": false,
          //   "isPrimary": false,
          //   "replyToAddress": "my_replyToAddress",
          //   "sendAsEmail": "my_sendAsEmail",
          //   "signature": "my_signature",
          //   "smtpMsa": {},
          //   "treatAsAlias": false,
          //   "verificationStatus": "my_verificationStatus"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "displayName": "my_displayName",
      //   "isDefault": false,
      //   "isPrimary": false,
      //   "replyToAddress": "my_replyToAddress",
      //   "sendAsEmail": "my_sendAsEmail",
      //   "signature": "my_signature",
      //   "smtpMsa": {},
      //   "treatAsAlias": false,
      //   "verificationStatus": "my_verificationStatus"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/gmail.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const gmail = google.gmail('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
          'https://www.googleapis.com/auth/gmail.settings.basic',
          'https://www.googleapis.com/auth/gmail.settings.sharing',
        ],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await gmail.users.settings.sendAs.patch({
        // The send-as alias to be updated.
        sendAsEmail: 'placeholder-value',
        // User's email address. The special value "me" can be used to indicate the authenticated user.
        userId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "displayName": "my_displayName",
          //   "isDefault": false,
          //   "isPrimary": false,
          //   "replyToAddress": "my_replyToAddress",
          //   "sendAsEmail": "my_sendAsEmail",
          //   "signature": "my_signature",
          //   "smtpMsa": {},
          //   "treatAsAlias": false,
          //   "verificationStatus": "my_verificationStatus"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "displayName": "my_displayName",
      //   "isDefault": false,
      //   "isPrimary": false,
      //   "replyToAddress": "my_replyToAddress",
      //   "sendAsEmail": "my_sendAsEmail",
      //   "signature": "my_signature",
      //   "smtpMsa": {},
      //   "treatAsAlias": false,
      //   "verificationStatus": "my_verificationStatus"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/gmail.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const gmail = google.gmail('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
          'https://mail.google.com/',
          'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
          'https://www.googleapis.com/auth/gmail.compose',
          'https://www.googleapis.com/auth/gmail.modify',
          'https://www.googleapis.com/auth/gmail.send',
        ],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await gmail.users.messages.send({
        // The user's email address. The special value `me` can be used to indicate the authenticated user.
        userId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "historyId": "my_historyId",
          //   "id": "my_id",
          //   "internalDate": "my_internalDate",
          //   "labelIds": [],
          //   "payload": {},
          //   "raw": "my_raw",
          //   "sizeEstimate": 0,
          //   "snippet": "my_snippet",
          //   "threadId": "my_threadId"
          // }
        },
        media: {
          mimeType: 'placeholder-value',
          body: 'placeholder-value',
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "historyId": "my_historyId",
      //   "id": "my_id",
      //   "internalDate": "my_internalDate",
      //   "labelIds": [],
      //   "payload": {},
      //   "raw": "my_raw",
      //   "sizeEstimate": 0,
      //   "snippet": "my_snippet",
      //   "threadId": "my_threadId"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/gmail.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const gmail = google.gmail('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
          'https://mail.google.com/',
          'https://www.googleapis.com/auth/gmail.addons.current.message.action',
          'https://www.googleapis.com/auth/gmail.addons.current.message.metadata',
          'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
          'https://www.googleapis.com/auth/gmail.metadata',
          'https://www.googleapis.com/auth/gmail.modify',
          'https://www.googleapis.com/auth/gmail.readonly',
        ],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await gmail.users.messages.get({
        // The format to return the message in.
        format: 'placeholder-value',
        // The ID of the message to retrieve. This ID is usually retrieved using `messages.list`. The ID is also contained in the result when a message is inserted (`messages.insert`) or imported (`messages.import`).
        id: 'placeholder-value',
        // When given and format is `METADATA`, only include headers specified.
        metadataHeaders: 'placeholder-value',
        // The user's email address. The special value `me` can be used to indicate the authenticated user.
        userId: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "historyId": "my_historyId",
      //   "id": "my_id",
      //   "internalDate": "my_internalDate",
      //   "labelIds": [],
      //   "payload": {},
      //   "raw": "my_raw",
      //   "sizeEstimate": 0,
      //   "snippet": "my_snippet",
      //   "threadId": "my_threadId"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/gmail.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const gmail = google.gmail('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
          'https://mail.google.com/',
          'https://www.googleapis.com/auth/gmail.modify',
          'https://www.googleapis.com/auth/gmail.readonly',
          'https://www.googleapis.com/auth/gmail.settings.basic',
        ],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await gmail.users.settings.sendAs.get({
        // The send-as alias to be retrieved.
        sendAsEmail: 'placeholder-value',
        // User's email address. The special value "me" can be used to indicate the authenticated user.
        userId: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "displayName": "my_displayName",
      //   "isDefault": false,
      //   "isPrimary": false,
      //   "replyToAddress": "my_replyToAddress",
      //   "sendAsEmail": "my_sendAsEmail",
      //   "signature": "my_signature",
      //   "smtpMsa": {},
      //   "treatAsAlias": false,
      //   "verificationStatus": "my_verificationStatus"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples