public ScApiSession( ISessionConfig config, IWebApiCredentials credentials, IMediaLibrarySettings mediaSettings, ItemSource defaultSource = null, HttpMessageHandler httpMessageHandler = null) { if (null == config) { throw new ArgumentNullException("ScApiSession.config cannot be null"); } this.sessionConfig = config.SessionConfigShallowCopy(); this.requestMerger = new UserRequestMerger(this.sessionConfig, defaultSource); if (null != credentials) { this.credentials = credentials.CredentialsShallowCopy(); } if (null != mediaSettings) { this.mediaSettings = mediaSettings.MediaSettingsShallowCopy(); } this.httpClient = httpMessageHandler == null ? new HttpClient() : new HttpClient(httpMessageHandler); }
public ScApiSession( ISessionConfig config, IWebApiCredentials credentials, IMediaLibrarySettings mediaSettings, ItemSource defaultSource = null) { if (null == config) { throw new ArgumentNullException("ScApiSession.config cannot be null"); } this.sessionConfig = config.SessionConfigShallowCopy(); this.requestMerger = new UserRequestMerger(this.sessionConfig, defaultSource); if (null != credentials) { this.credentials = credentials.CredentialsShallowCopy(); } if (null != mediaSettings) { this.mediaSettings = mediaSettings.MediaSettingsShallowCopy(); } this.httpClient = new HttpClient(); }
public IBaseSessionBuilder Credentials(IWebApiCredentials credentials) { // @adk : won't be invoked more than once. // No validation needed. BaseValidator.CheckForNullAndEmptyOrThrow(credentials.Username, this.GetType().Name + ".Credentials.Username"); BaseValidator.CheckForNullAndEmptyOrThrow(credentials.Password, this.GetType().Name + ".Credentials.Password"); this.credentials = credentials.CredentialsShallowCopy(); return(this); }
public IBaseSessionBuilder Credentials(IWebApiCredentials credentials) { // @adk : won't be invoked more than once. // No validation needed. BaseValidator.CheckForNullAndEmptyOrThrow(credentials.Username, this.GetType().Name + ".Credentials.Username"); BaseValidator.CheckForNullAndEmptyOrThrow(credentials.Password, this.GetType().Name + ".Credentials.Password"); this.credentials = credentials.CredentialsShallowCopy(); return this; }