Skip to content

Commit

Permalink
Remove redundant PUT definition and using latest default syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
yj7o5 committed Oct 6, 2020
1 parent 7fec166 commit 86e2f6b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 75 deletions.
53 changes: 18 additions & 35 deletions source/Octopus.Client/IOctopusAsyncClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>The collection of resources from the server.</returns>
Task<ResourceCollection<TResource>> List<TResource>(string path, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<ResourceCollection<TResource>> List<TResource>(string path, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Fetches a collection of resources from the server using the HTTP GET verb. All result pages will be retrieved.
Expand All @@ -105,7 +105,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>The collection of resources from the server.</returns>
Task<IReadOnlyList<TResource>> ListAll<TResource>(string path, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<IReadOnlyList<TResource>> ListAll<TResource>(string path, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Fetches a collection of resources from the server one page at a time using the HTTP GET verb.
Expand All @@ -127,7 +127,7 @@ public interface IOctopusAsyncClient : IDisposable
/// </param>
/// <param name="token"></param>
/// <returns>The collection of resources from the server.</returns>
Task Paginate<TResource>(string path, Func<ResourceCollection<TResource>, bool> getNextPage, CancellationToken token = default(CancellationToken));
Task Paginate<TResource>(string path, Func<ResourceCollection<TResource>, bool> getNextPage, CancellationToken token = default);

/// <summary>
/// Fetches a collection of resources from the server one page at a time using the HTTP GET verb.
Expand All @@ -150,7 +150,7 @@ public interface IOctopusAsyncClient : IDisposable
/// </param>
/// <param name="token"></param>
/// <returns>The collection of resources from the server.</returns>
Task Paginate<TResource>(string path, object pathParameters, Func<ResourceCollection<TResource>, bool> getNextPage, CancellationToken token = default(CancellationToken));
Task Paginate<TResource>(string path, object pathParameters, Func<ResourceCollection<TResource>, bool> getNextPage, CancellationToken token = default);

/// <summary>
/// Fetches a single resource from the server using the HTTP GET verb.
Expand All @@ -169,7 +169,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>The resource from the server.</returns>
Task<TResource> Get<TResource>(string path, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<TResource> Get<TResource>(string path, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Creates a resource at the given URI on the server using the POST verb, then performs a fresh GET request to fetch
Expand All @@ -190,7 +190,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>The latest copy of the resource from the server.</returns>
Task<TResource> Create<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<TResource> Create<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Sends a command to a resource at the given URI on the server using the POST verb.
Expand All @@ -209,7 +209,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="resource">The resource to create.</param>
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
Task Post<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task Post<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Sends a command to a resource at the given URI on the server using the POST verb, and retrieve the response.
Expand All @@ -228,7 +228,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="resource">The resource to create.</param>
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
Task<TResponse> Post<TResource, TResponse>(string path, TResource resource, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<TResponse> Post<TResource, TResponse>(string path, TResource resource, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Sends a command to a resource at the given URI on the server using the POST verb.
Expand All @@ -245,25 +245,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <exception cref="OctopusResourceNotFoundException">HTTP 404: If the specified resource does not exist on the server.</exception>
/// <param name="path">The path to the container resource.</param>
/// <param name="token"></param>
Task Post(string path, CancellationToken token = default(CancellationToken));

/// <summary>
/// Sends a command to a resource at the given URI on the server using the PUT verb.
/// </summary>
/// <exception cref="OctopusSecurityException">
/// HTTP 401 or 403: Thrown when the current user's API key was not valid, their
/// account is disabled, or they don't have permission to perform the specified action.
/// </exception>
/// <exception cref="OctopusServerException">
/// If any other error is successfully returned from the server (e.g., a 500
/// server error).
/// </exception>
/// <exception cref="OctopusValidationException">HTTP 400: If there was a problem with the request provided by the user.</exception>
/// <exception cref="OctopusResourceNotFoundException">HTTP 404: If the specified resource does not exist on the server.</exception>
/// <param name="path">The path to the container resource.</param>
/// <param name="resource">The resource to create.</param>
/// <param name="token"></param>
Task Put<TResource>(string path, TResource resource, CancellationToken token = default(CancellationToken));
Task Post(string path, CancellationToken token = default);

/// <summary>
/// Sends a command to a resource at the given URI on the server using the PUT verb.
Expand All @@ -280,7 +262,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <exception cref="OctopusResourceNotFoundException">HTTP 404: If the specified resource does not exist on the server.</exception>
/// <param name="path">The path to the container resource.</param>
/// <param name="token"></param>
Task Put(string path, CancellationToken token = default(CancellationToken));
Task Put(string path, CancellationToken token = default);

/// <summary>
/// Sends a command to a resource at the given URI on the server using the PUT verb.
Expand All @@ -299,7 +281,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="resource">The resource to create.</param>
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
Task Put<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task Put<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Updates the resource at the given URI on the server using the PUT verb, then performs a fresh GET request to reload
Expand All @@ -320,7 +302,7 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>The latest copy of the resource from the server.</returns>
Task<TResource> Update<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<TResource> Update<TResource>(string path, TResource resource, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Deletes the resource at the given URI from the server using a the DELETE verb. Deletes in Octopus happen
Expand All @@ -341,8 +323,9 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="path">The path to the resource to delete.</param>
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="resource">An optional resource to pass as the body of the request.</param>
/// <param name="token"></param>
/// <returns>A task resource that provides details about the background task that deletes the specified resource.</returns>
Task Delete(string path, object pathParameters = null, object resource = null, CancellationToken token = default(CancellationToken));
Task Delete(string path, object pathParameters = null, object resource = null, CancellationToken token = default);

/// <summary>
/// Fetches raw content from the resource at the specified path, using the GET verb.
Expand All @@ -361,15 +344,15 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="pathParameters">If the <c>path</c> is a URI template, parameters to use for substitution.</param>
/// <param name="token"></param>
/// <returns>A stream containing the content of the resource.</returns>
Task<Stream> GetContent(string path, object pathParameters = null, CancellationToken token = default(CancellationToken));
Task<Stream> GetContent(string path, object pathParameters = null, CancellationToken token = default);

/// <summary>
/// Creates or updates the raw content of the resource at the specified path, using the PUT verb.
/// </summary>
/// <param name="path">The path to the resource to create or update.</param>
/// <param name="contentStream">A stream containing content of the resource.</param>
/// <param name="token"></param>
Task PutContent(string path, Stream contentStream, CancellationToken token = default(CancellationToken));
Task PutContent(string path, Stream contentStream, CancellationToken token = default);

Uri QualifyUri(string path, object parameters = null);

Expand All @@ -379,14 +362,14 @@ public interface IOctopusAsyncClient : IDisposable
/// <param name="loginCommand"></param>
/// <param name="token"></param>
/// <returns></returns>
Task SignIn(LoginCommand loginCommand, CancellationToken token = default(CancellationToken));
Task SignIn(LoginCommand loginCommand, CancellationToken token = default);

/// <summary>
/// Sign out
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
Task SignOut(CancellationToken token = default(CancellationToken));
Task SignOut(CancellationToken token = default);

/// <summary>
/// Get a repository for the given space
Expand Down
Loading

0 comments on commit 86e2f6b

Please sign in to comment.