Пример #1
0
        /// <summary>
        /// Implements <see cref="IOwnerClient.UpdateAsync" />
        /// </summary>
        public async Task UpdateAsync(Owner owner, string username)
        {
            if (owner == null)
            {
                throw new ArgumentException("owner body cannot be null.");
            }

            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("username cannot be blank.");
            }

            await client.SendAsyncRequest(HttpMethod.Put,
                                          string.Format("/api/v3/owners/{0}", username),
                                          OwnerSerializer.SerializeOwner(owner));
        }
Пример #2
0
        /// <summary>
        /// Implements <see cref="IOwnerClient.UpdatePasswordAsync" />
        /// </summary>
        public async Task UpdatePasswordAsync(string username, string password)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("username cannot be blank.");
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("password cannot be blank.");
            }

            Owner owner = new Owner.Builder()
            {
                Username = username,
                Password = password
            };

            await client.SendAsyncRequest(HttpMethod.Put,
                                          string.Format("/api/v3/owners/{0}/password", username),
                                          OwnerSerializer.SerializeOwner(owner));
        }
Пример #3
0
        /// <summary>
        /// Implements <see cref="IOwnerClient.CreateAsync" />
        /// </summary>
        public async Task CreateAsync(Owner owner)
        {
            if (owner == null)
            {
                throw new ArgumentException("owner body cannot be null.");
            }

            if (string.IsNullOrEmpty(owner.Username))
            {
                throw new ArgumentException("username cannot be blank.");
            }

            if (string.IsNullOrEmpty(owner.Password))
            {
                throw new ArgumentException("password cannot be blank.");
            }

            await client.SendAsyncRequest(
                HttpMethod.Post,
                "/api/v3/owners",
                OwnerSerializer.SerializeOwner(owner));
        }