Ads API .NET library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Google.Api.Ads.Common.Lib.AdsUser Class Referenceabstract

Represents an Ads API user. More...

Inheritance diagram for Google.Api.Ads.Common.Lib.AdsUser:
Google.Api.Ads.Common.Lib.Configurable Google.Api.Ads.AdManager.Lib.AdManagerUser

Public Member Functions

abstract Type[] GetServiceTypes ()
 Gets all the service types to be registered against this user. More...
 
abstract SoapListener[] GetDefaultListeners ()
 Gets the default listeners. More...
 
void RegisterService (string serviceId, ServiceFactory serviceFactory)
 Register a service with AdsUser. More...
 
ServiceFactory GetServiceFactory (string serviceId)
 Gets the service factory for a service. More...
 
AdsClient GetService (ServiceSignature serviceSignature)
 Creates an object of the requested type of service. More...
 
AdsClient GetService (ServiceSignature serviceSignature, string serverUrl)
 Creates an object of the requested type of service. More...
 
AdsClient GetService (ServiceSignature serviceSignature, Uri serverUrl)
 Creates an object of the requested type of service. More...
 

Protected Member Functions

 AdsUser (AppConfigBase config)
 Protected constructor. Use this version from a derived class if you want the library to use all settings from App.config. More...
 
 AdsUser (AppConfigBase config, Dictionary< string, string > headers)
 Protected constructor. Use this version from a derived class if you want the library to use all settings from App.config. More...
 
void RegisterServices (Type[] servicesFamilies)
 Registers a family of services against this user. More...
 
void SetHeadersFromConfig ()
 Set the user headers from App.config. More...
 

Properties

AdsOAuthProvider OAuthProvider [get, set]
 Gets or sets the OAuth provider. More...
 
AppConfig Config [get]
 Gets or sets the application configuration for this user. More...
 
List< SoapListenerListeners [get]
 Gets the listeners. More...
 
- Properties inherited from Google.Api.Ads.Common.Lib.Configurable
AppConfig Config [get]
 Gets the application configuration class for this object. More...
 

Detailed Description

Represents an Ads API user.

Constructor & Destructor Documentation

Google.Api.Ads.Common.Lib.AdsUser.AdsUser ( AppConfigBase  config)
inlineprotected

Protected constructor. Use this version from a derived class if you want the library to use all settings from App.config.

Google.Api.Ads.Common.Lib.AdsUser.AdsUser ( AppConfigBase  config,
Dictionary< string, string >  headers 
)
inlineprotected

Protected constructor. Use this version from a derived class if you want the library to use all settings from App.config.

This constructor exists for backward compatibility purposes.

Member Function Documentation

abstract SoapListener [] Google.Api.Ads.Common.Lib.AdsUser.GetDefaultListeners ( )
pure virtual

Gets the default listeners.

Returns
A list of default listeners

Implemented in Google.Api.Ads.AdManager.Lib.AdManagerUser.

AdsClient Google.Api.Ads.Common.Lib.AdsUser.GetService ( ServiceSignature  serviceSignature)
inline

Creates an object of the requested type of service.

Parameters
serviceSignatureSignature of the service being requested.
Returns
An object of the requested type of service. The caller should cast this object to the desired type.
AdsClient Google.Api.Ads.Common.Lib.AdsUser.GetService ( ServiceSignature  serviceSignature,
string  serverUrl 
)
inline

Creates an object of the requested type of service.

Parameters
serviceSignatureSignature of the service being requested.
serverUrlThe server url for Ads service.
Returns
An object of the requested type of service. The caller should cast this object to the desired type.
AdsClient Google.Api.Ads.Common.Lib.AdsUser.GetService ( ServiceSignature  serviceSignature,
Uri  serverUrl 
)
inline

Creates an object of the requested type of service.

Parameters
serviceSignatureSignature of the service being requested.
serverUrlThe server url for Ads service.
Returns
An object of the requested type of service. The caller should cast this object to the desired type.

References Google.Api.Ads.Common.Lib.ServiceSignature.Id, and Google.Api.Ads.Common.Lib.ServiceSignature.ServiceName.

ServiceFactory Google.Api.Ads.Common.Lib.AdsUser.GetServiceFactory ( string  serviceId)
inline

Gets the service factory for a service.

Parameters
serviceIdThe service id.
Returns
The service factory instance, or null if the service is not yet registered.
abstract Type [] Google.Api.Ads.Common.Lib.AdsUser.GetServiceTypes ( )
pure virtual

Gets all the service types to be registered against this user.

Returns
The type of all service classes to be registered.

Implemented in Google.Api.Ads.AdManager.Lib.AdManagerUser.

void Google.Api.Ads.Common.Lib.AdsUser.RegisterService ( string  serviceId,
ServiceFactory  serviceFactory 
)
inline

Register a service with AdsUser.

Parameters
serviceIdA unique id for the service being registered.
serviceFactoryThe factory that will create this service.
void Google.Api.Ads.Common.Lib.AdsUser.RegisterServices ( Type[]  servicesFamilies)
inlineprotected

Registers a family of services against this user.

Parameters
servicesFamiliesThe family of services that should be registered against this user.

Every family of services that should be registered with an AdsUser should be like follows:

public class vX {
public Type factoryType = typeof(SomeServiceVxFactory);
public readonly ServiceSignature Service1;
public readonly ServiceSignature Service2;
}

The method uses reflection to

  • Find all the fields of type ServiceSignature.
  • Extract the factory type from factoryType field.
  • Register each found service type with the user.

References Google.Api.Ads.Common.Lib.ServiceSignature.Id.

void Google.Api.Ads.Common.Lib.AdsUser.SetHeadersFromConfig ( )
inlineprotected

Set the user headers from App.config.

Property Documentation

AppConfig Google.Api.Ads.Common.Lib.AdsUser.Config
get

Gets or sets the application configuration for this user.

List<SoapListener> Google.Api.Ads.Common.Lib.AdsUser.Listeners
get

Gets the listeners.

AdsOAuthProvider Google.Api.Ads.Common.Lib.AdsUser.OAuthProvider
getset

Gets or sets the OAuth provider.


The documentation for this class was generated from the following file: