Ejemplo n.º 1
0
        private static Dictionary <string, string> GetQueryParams <TCommand>(NamecheapApi api, TCommand command)
        {
            if (command != null)
            {
                var commandInfo = FindApiCommandInterface(command.GetType());
                if (commandInfo != null)
                {
                    (Type iface, NamecheapApiCommandAttribute commandAttr) = commandInfo.Value;

                    // get the every command params
                    Dictionary <string, string> queryParams = new()
                    {
                        { "ApiKey", api.ApiKey },
                        { "UserName", api.UserName },
Ejemplo n.º 2
0
        public static Uri BuildRequest <TCommand>(NamecheapApi api, TCommand command)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            Dictionary <string, string> queryParams = GetQueryParams(api, command);

            return(new Uri(QueryHelpers.AddQueryString(api.ApiEndPoint, queryParams)));
        }