/// <summary> /// Initializes a new instance of the MDLP REST API client. /// </summary> /// <param name="credentials">Credentials used for authentication.</param> /// <param name="client"><see cref="IRestClient"/> instance.</param> public MdlpClient(CredentialsBase credentials, IRestClient client) { Credentials = credentials; Serializer = new ServiceStackSerializer(); BaseUrl = client.BaseUrl.ToString(); Limiter = new RequestRateLimiter(); // set up REST client Client = client; Client.Authenticator = new CredentialsAuthenticator(this, credentials); Client.Encoding = Encoding.UTF8; Client.ThrowOnDeserializationError = false; Client.UseSerializer(() => Serializer); }
public CredentialsAuthenticator(MdlpClient apiClient, CredentialsBase credentials) { State = AuthState.NotAuthenticated; Client = apiClient; Credentials = credentials; }
/// <summary> /// Initializes a new instance of the MDLP REST API client. /// </summary> /// <param name="credentials">Credentials used for authentication.</param> /// <param name="baseUrl">Base URL of the API endpoint.</param> public MdlpClient(CredentialsBase credentials, string baseUrl = StageApiHttp) : this(credentials, new RestClient(baseUrl ?? StageApiHttp)) { }