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/content.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 content = google.content('v2.1');
    
    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/content'],
      });
    
      // 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 content.collections.delete({
        // Required. The collectionId of the collection. CollectionId is the same as the REST ID of the collection.
        collectionId: 'placeholder-value',
        // Required. The ID of the account that contains the collection. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
      });
      console.log(res.data);
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.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 content = google.content('v2.1');
    
    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/content'],
      });
    
      // 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 content.collectionstatuses.get({
        // Required. The collectionId of the collection. CollectionId is the same as the REST ID of the collection.
        collectionId: 'placeholder-value',
        // Required. The ID of the account that contains the collection. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "collectionLevelIssuses": [],
      //   "creationDate": "my_creationDate",
      //   "destinationStatuses": [],
      //   "id": "my_id",
      //   "lastUpdateDate": "my_lastUpdateDate"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.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 content = google.content('v2.1');
    
    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/content'],
      });
    
      // 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 content.collectionstatuses.list({
        // Required. The ID of the account that contains the collection. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The maximum number of collection statuses to return in the response, used for paging. Defaults to 50; values above 1000 will be coerced to 1000.
        pageSize: 'placeholder-value',
        // Token (if provided) to retrieve the subsequent page. All other parameters must match the original call that provided the page token.
        pageToken: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "nextPageToken": "my_nextPageToken",
      //   "resources": []
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/serviceconsumermanagement.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 serviceconsumermanagement = google.serviceconsumermanagement('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/cloud-platform'],
      });
    
      // 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 serviceconsumermanagement.services.tenancyUnits.create({
        // Required. services/{service\}/{collection id\}/{resource id\} {collection id\} is the cloud resource collection type representing the service consumer, for example 'projects', or 'organizations'. {resource id\} is the consumer numeric id, such as project number: '123456'. {service\} the name of a managed service, such as 'service.googleapis.com'. Enables service binding using the new tenancy unit.
        parent: 'services/my-service/[^/]+/[^/]+',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "tenancyUnitId": "my_tenancyUnitId"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "consumer": "my_consumer",
      //   "createTime": "my_createTime",
      //   "name": "my_name",
      //   "service": "my_service",
      //   "tenantResources": []
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.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 content = google.content('v2.1');
    
    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/content'],
      });
    
      // 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 content.promotions.create({
        // Required. The ID of the account that contains the collection.
        merchantId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "brand": [],
          //   "brandExclusion": [],
          //   "contentLanguage": "my_contentLanguage",
          //   "couponValueType": "my_couponValueType",
          //   "freeGiftDescription": "my_freeGiftDescription",
          //   "freeGiftItemId": "my_freeGiftItemId",
          //   "freeGiftValue": {},
          //   "genericRedemptionCode": "my_genericRedemptionCode",
          //   "getThisQuantityDiscounted": 0,
          //   "id": "my_id",
          //   "itemGroupId": [],
          //   "itemGroupIdExclusion": [],
          //   "itemId": [],
          //   "itemIdExclusion": [],
          //   "limitQuantity": 0,
          //   "limitValue": {},
          //   "longTitle": "my_longTitle",
          //   "minimumPurchaseAmount": {},
          //   "minimumPurchaseQuantity": 0,
          //   "moneyBudget": {},
          //   "moneyOffAmount": {},
          //   "offerType": "my_offerType",
          //   "orderLimit": 0,
          //   "percentOff": 0,
          //   "productApplicability": "my_productApplicability",
          //   "promotionDestinationIds": [],
          //   "promotionDisplayDates": "my_promotionDisplayDates",
          //   "promotionEffectiveDates": "my_promotionEffectiveDates",
          //   "promotionId": "my_promotionId",
          //   "redemptionChannel": [],
          //   "shippingServiceNames": [],
          //   "targetCountry": "my_targetCountry"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "brand": [],
      //   "brandExclusion": [],
      //   "contentLanguage": "my_contentLanguage",
      //   "couponValueType": "my_couponValueType",
      //   "freeGiftDescription": "my_freeGiftDescription",
      //   "freeGiftItemId": "my_freeGiftItemId",
      //   "freeGiftValue": {},
      //   "genericRedemptionCode": "my_genericRedemptionCode",
      //   "getThisQuantityDiscounted": 0,
      //   "id": "my_id",
      //   "itemGroupId": [],
      //   "itemGroupIdExclusion": [],
      //   "itemId": [],
      //   "itemIdExclusion": [],
      //   "limitQuantity": 0,
      //   "limitValue": {},
      //   "longTitle": "my_longTitle",
      //   "minimumPurchaseAmount": {},
      //   "minimumPurchaseQuantity": 0,
      //   "moneyBudget": {},
      //   "moneyOffAmount": {},
      //   "offerType": "my_offerType",
      //   "orderLimit": 0,
      //   "percentOff": 0,
      //   "productApplicability": "my_productApplicability",
      //   "promotionDestinationIds": [],
      //   "promotionDisplayDates": "my_promotionDisplayDates",
      //   "promotionEffectiveDates": "my_promotionEffectiveDates",
      //   "promotionId": "my_promotionId",
      //   "redemptionChannel": [],
      //   "shippingServiceNames": [],
      //   "targetCountry": "my_targetCountry"
      // }
    }
    
    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