Add project files.
This commit is contained in:
87
GoogleApi/Configuration/GoogleAdsConfig.cs
Normal file
87
GoogleApi/Configuration/GoogleAdsConfig.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
namespace GoogleApi.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Root configuration for Google Ads API integration.
|
||||
/// Bind to the "GoogleAds" section in appsettings.json or environment variables.
|
||||
/// </summary>
|
||||
public sealed class GoogleAdsConfig
|
||||
{
|
||||
public const string SectionName = "GoogleAds";
|
||||
|
||||
/// <summary>
|
||||
/// Enable/disable real API calls. When false, the provider returns emulated responses.
|
||||
/// </summary>
|
||||
public bool EnableRealApi { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Target Google Ads API version used by generated stubs (e.g. "v22").
|
||||
/// NOTE: This value is informational; the compiled code targets a specific Vxx namespace.
|
||||
/// </summary>
|
||||
public string ApiVersion { get; set; } = "v22";
|
||||
|
||||
/// <summary>
|
||||
/// Developer token from your Google Ads manager account.
|
||||
/// </summary>
|
||||
public string DeveloperToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// OAuth 2.0 application credentials used for server-to-server calls.
|
||||
///
|
||||
/// IMPORTANT:
|
||||
/// - There is no interactive OAuth flow at runtime.
|
||||
/// - A refresh token is generated once (out-of-band) and stored securely.
|
||||
/// - This service uses that refresh token to obtain access tokens automatically.
|
||||
/// </summary>
|
||||
public GoogleOAuthConfig OAuth { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Default login customer ID (manager account / MCC) if not specified per request.
|
||||
/// Format: 1234567890 (no dashes)
|
||||
/// </summary>
|
||||
public string? DefaultLoginCustomerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Request timeout in seconds.
|
||||
/// </summary>
|
||||
public int TimeoutSeconds { get; set; } = 60;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OAuth configuration for Google Ads API.
|
||||
/// This provider uses the "refresh token" (offline) flow for non-interactive server-to-server calls.
|
||||
/// </summary>
|
||||
public sealed class GoogleOAuthConfig
|
||||
{
|
||||
public string ClientId { get; set; } = string.Empty;
|
||||
public string ClientSecret { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Platform refresh token used to obtain access tokens without user interaction.
|
||||
/// Store in Key Vault / secret store; inject via environment variables in prod.
|
||||
/// </summary>
|
||||
public string? RefreshToken { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Per-request Google Ads context, populated from request and/or database.
|
||||
/// </summary>
|
||||
public sealed class GoogleAdsContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Target Google Ads customer ID for this request.
|
||||
/// Format: 1234567890 (no dashes)
|
||||
/// </summary>
|
||||
public required string CustomerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Login customer ID (manager account / MCC).
|
||||
/// Required when accessing client accounts under a manager account.
|
||||
/// </summary>
|
||||
public string? LoginCustomerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional override refresh token for a specific account (if you ever store per-account tokens).
|
||||
/// If null, the platform token from config is used.
|
||||
/// </summary>
|
||||
public string? RefreshToken { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user