public Task AuthenticateAsync(AuthConfig authConfig)
        {
            if (authConfig == null)
            {
                throw new ArgumentNullException("authConfig");
            }
            var data = new JsonRequestContent<AuthConfig>(authConfig, this.Client.JsonSerializer);

            const string path = "auth";
            return this.Client.MakeRequestAsync(this.Client.NoErrorHandlers, HttpMethod.Post, path, null, data);
        }
        public Task<Stream> PushImageAsync(string name, PushImageParameters parameters, AuthConfig authConfig)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (authConfig == null)
            {
                throw new ArgumentNullException("authConfig");
            }

            string path = string.Format(CultureInfo.InvariantCulture, "images/{0}/push", name);
            IQueryString queryParameters = new QueryString<PushImageParameters>(parameters);
            return this.Client.MakeRequestForStreamAsync(this.Client.NoErrorHandlers, HttpMethod.Post, path, queryParameters, RegistryAuthHeaders(authConfig), null, CancellationToken.None);
        }
        private Dictionary<string, string> RegistryAuthHeaders(AuthConfig authConfig)
        {
            if (authConfig == null)
            {
                throw new ArgumentNullException("authConfig");
            }

            return new Dictionary<string, string>
            {
                {
                    RegistryAuthHeaderKey,
                    Convert.ToBase64String(Encoding.UTF8.GetBytes(this.Client.JsonSerializer.SerializeObject<AuthConfig>(authConfig)))
                }
            };
        }
        public Task<Stream> CreateImageAsync(CreateImageParameters parameters, AuthConfig authConfig)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            string path = "images/create";
            Dictionary<string, string> headers = authConfig == null ? null : RegistryAuthHeaders(authConfig);
            IQueryString queryParameters = new QueryString<CreateImageParameters>(parameters);
            return this.Client.MakeRequestForStreamAsync(this.Client.NoErrorHandlers, HttpMethod.Post, path, queryParameters, headers, null, CancellationToken.None);
        }