How to use the google-ads-node.GoogleAdsClient 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 / grpc.ts View on Github external
refresh_token: string,
        login_customer_id?: string,
        gads_node_options?: GoogleAdsNodeOptions
    ) {

        const additional_options: any = {}

        // Apply google-ads-node options if specified
        if(gads_node_options?.prevent_mutations) {
            additional_options.preventMutations = gads_node_options.prevent_mutations
        }
        if(gads_node_options?.logging) {
            additional_options.logging = gads_node_options.logging
        }

        this.client = new GoogleAdsClient({
            developer_token,
            client_id,
            client_secret,
            refresh_token,
            login_customer_id,
            parseResults: true,
            async accessTokenGetter(clientId: string, clientSecret: string, refreshToken: string) {
                return getAccessToken({
                    client_id: clientId,
                    client_secret: clientSecret,
                    refresh_token: refreshToken,
                })
            },
            ...additional_options
        })
    }