/// <summary> /// Constructor method for creating <see cref="RestCallerParameters"/> with <paramref name="serverCaller"/>, <paramref name="baseServerUrl"/>, <paramref name="accessToken"/> and <paramref name="canal"/>. /// </summary> /// /// <param name="serverCaller">The <see cref="ServerCaller"/>.</param> /// <param name="baseServerUrl">The <see cref="BaseServerUrl"/>.</param> /// <param name="accessToken">The <see cref="AccessToken"/>.</param> /// <param name="canal">The <see cref="Canal"/>.</param> public RestCallerParameters(ServerCaller serverCaller, BaseServerUrl baseServerUrl, AccessToken accessToken, Canal canal) { if (serverCaller == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => serverCaller))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => serverCaller))); } if (baseServerUrl == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => baseServerUrl))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => baseServerUrl))); } if (accessToken == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => accessToken))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => accessToken))); } if (canal == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => canal))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => canal))); } ServerCaller = serverCaller; BaseServerUrl = baseServerUrl; AccessToken = accessToken; Canal = canal; }
/// <summary> /// Constructor method for creating <see cref="ServerCaller"/> with <paramref name="serverCallerParameters"/>. /// </summary> /// /// <param name="serverCallerParameters">The <see cref="ServerCallerParameters"/>.</param> public ServerCaller(ServerCallerParameters serverCallerParameters) { if (serverCallerParameters == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => serverCallerParameters))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => serverCallerParameters))); } var restCallerParameters = new RestCallerParameters(this, serverCallerParameters.BaseServerUrl, serverCallerParameters.AccessToken, serverCallerParameters.Canal); Callers = new List <BasicRestCaller>(); OAuth = new OAuthRestCaller(restCallerParameters); Event = new EventRestCaller(restCallerParameters); Customer = new CustomerRestCaller(restCallerParameters); }
/// <summary> /// Constructor method for creating <see cref="BasicRestCaller"/> with <paramref name="parameters"/>. /// </summary> /// /// <param name="parameters">The <see cref="Parameters"/>.</param> public BasicRestCaller(RestCallerParameters parameters) { if (parameters == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => parameters))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => parameters))); } Parameters = parameters; Parameters.ServerCaller.Callers.Add(this); }
/// <summary> /// Constructor method for creating <see cref="ServerCallerParameters"/> with <paramref name="baseServerUrl"/> and <paramref name="canal"/>. /// </summary> /// /// <param name="baseServerUrl">The Base Server URL.</param> /// <param name="canal">The <see cref="Canal"/>.</param> public ServerCallerParameters(string baseServerUrl, Canal canal) { if (canal == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => canal))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => canal))); } BaseServerUrl = new BaseServerUrl(baseServerUrl); Canal = canal; AccessToken = new AccessToken(); }
/// <summary> /// This method validates the <paramref name="response"/>. /// </summary> /// /// <param name="response">The response.</param> private static void ValidateResponse(IRestResponse response) { if (response == null) { LOGGER.ErrorFormat(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => response))); throw new ArgumentException(string.Format(Constants.CANNOT_BE_NULL_ERROR_MESSAGE_FORMAT, ObjectMetadata.GetMemberName(() => response))); } }