Exemple #1
0
        /// <summary>
        /// Creates a new ship.
        /// </summary>
        /// <param name="ship">The ship.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other
        /// objects or threads to receive notice of cancellation.</param>
        /// <exception cref="HttpException">A server side error occurred.</exception>
        public async Task <DTO.Query.Ship> PostAsync(DTO.Post.Ship ship,
                                                     CancellationToken cancellationToken)
        {
            const string route  = "/v1/ships";
            var          result = await PostObjectAsync <DTO.Query.Ship, DTO.Post.Ship>(ship, null, null,
                                                                                        route, cancellationToken);

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Updates the specified ship.
        /// </summary>
        /// <param name="identifier">The ship identifier which can be imo or Uid.</param>
        /// <param name="ship">The ship.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other
        /// objects or threads to receive notice of cancellation.</param>
        /// <exception cref="HttpException">A server side error occurred.</exception>
        public async Task <DTO.Query.Ship> PutAsync(string identifier, DTO.Post.Ship ship,
                                                    CancellationToken cancellationToken)
        {
            var route  = $"/v1/ships/{identifier}";
            var result = await PutObjectAsync <DTO.Query.Ship, DTO.Post.Ship>(ship, null, null,
                                                                              route, cancellationToken);

            return(result);
        }