How to use the google-ads-node.CampaignOperation function in google-ads-node

To help you get started, we’ve selected a few google-ads-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Opteo / google-ads-api / src / old_services / campaign-old.ts View on Github external
public async create(campaign: Campaign, options?: ServiceCreateOptions): Promise {
        const request = new grpc.MutateCampaignsRequest()
        const operation = new grpc.CampaignOperation()

        const pb = this.buildResource('Campaign', campaign) as grpc.Campaign
        operation.setCreate(pb)

        request.setCustomerId(this.cid)
        request.setOperationsList([operation])

        if (options) {
            if (options.hasOwnProperty('validate_only')) {
                request.setValidateOnly(options.validate_only as boolean)
            }
            if (options.hasOwnProperty('partial_failure')) {
                request.setPartialFailure(options.partial_failure as boolean)
            }
        }