How to use the google-ads-node.MutateGoogleAdsRequest 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 / services / customer.ts View on Github external
public async mutateResources(
        operations: Array,
        options?: ServiceCreateOptions
    ): MutateResourcesResponse {
        const request = new grpc.MutateGoogleAdsRequest()

        request.setCustomerId(this.cid)

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

        const ops: Array = []

        for (const operation of operations) {
            if (!operation.hasOwnProperty('_resource')) {
                throw new Error(`Missing "_resource" key on entity`)
            }