How to use the google-ads-node.MutateOperation 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
resource_operation.setUpdate(pb)
                const update_mask = getFieldMask(operation)
                resource_operation.setUpdateMask(update_mask)
            }

            if (operation_mode === 'delete') {
                // @ts-ignore Types are no use here
                if (!pb.toObject().hasOwnProperty('resourceName') || !pb.toObject().resourceName) {
                    throw new Error(`Must specify "resource_name" to remove when using "delete"`)
                }
                // @ts-ignore Types are no use here
                resource_operation.setRemove(pb.toObject().resourceName)
            }

            /* Add operation of resource type to global mutate operation e.g. "MutateOperation.setCampaignBudgetOperation" */
            const op = new grpc.MutateOperation()
            const operation_set_method = `set${operation_resource_name}Operation`
            // @ts-ignore Types are no use here
            op[operation_set_method](resource_operation)

            /* Push operation to MutateOperationsList */
            ops.push(op)
        }

        request.setMutateOperationsList(ops)
        const response = await this.globalMutate(request)

        return response
    }
}