
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
GoogleAds.API is an async, thread-safe singleton implementation for the Google Ads client. It ensures safe and efficient concurrent access to the Google Ads API, making it ideal for high-performance applications.
You can install the package via NuGet:
Install-Package GoogleAds.API
🔧 1. Configuration (e.g. appsettings.json)
{
"GoogleAds": {
"DeveloperToken": "YOUR_DEV_TOKEN",
"LoginCustomerId": "123-456-7890",
"ClientCustomerId": "098-765-4321",
"OAuthClientId": "your-oauth-client-id",
"OAuthClientSecret": "your-oauth-client-secret",
"RefreshToken": "your-refresh-token"
}
}
🚀 2. Initialize and Use the Client
// Load configuration
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
// Initialize the Google Ads client
var adsClient = GoogleAdsClientSingleton.Create(config.GetSection("GoogleAds"));
// Example: fetch first 10 campaigns
var service = adsClient.GetClient().GetService(Services.V14.GoogleAdsService);
var response = await service.SearchAsync($"SELECT campaign.id, campaign.name FROM campaign ORDER BY campaign.id LIMIT 10");
foreach (var row in response)
{
Console.WriteLine($"Campaign ID: {row.Campaign.Id}, Name: {row.Campaign.Name}");
}
🧩 3. Customizing for Campaign Creation
using Google.Ads.GoogleAds.V14.Services;
using Google.Ads.GoogleAds.V14.Resources;
// ... initialize adsClient as shown above ...
var campaignService = adsClient.GetClient().GetService(CampaignServiceClient);
var campaign = new Campaign
{
Name = "My New Campaign",
AdvertisingChannelType = AdvertisingChannelType.Search,
Status = CampaignStatus.Paused,
ManualCpc = new ManualCpc(),
CampaignBudget = ResourceNames.CampaignBudget(yourCustomerId, yourBudgetId)
};
var operation = new CampaignOperation { Create = campaign };
var response = await campaignService.MutateCampaignsAsync(customerId.ToString(), new[] { operation });
Console.WriteLine($"Created campaign with resource name: {response.Results[0].ResourceName}");
Contributions are welcome! Please submit pull requests or open issues on the repository.
MIT License
FAQs
An async thread-safe singleton for the Google Ads client
We found that googleads.api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.