Skip to content

Commit

Permalink
Adding Slack documentation links to all API methods and removing redu…
Browse files Browse the repository at this point in the history
…ndant XML docs
  • Loading branch information
soxtoby committed Jan 30, 2022
1 parent 19242db commit c289421
Show file tree
Hide file tree
Showing 33 changed files with 155 additions and 1,125 deletions.
13 changes: 2 additions & 11 deletions SlackNet/WebApi/ApiApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ public interface IApiApi
/// <summary>
/// Helps you test your calling code.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/api.test">Slack documentation</a> for more information.</remarks>
/// <param name="error">Error response to return.</param>
/// <param name="args">Example properties to return.</param>
/// <param name="cancellationToken"></param>
/// <returns>
/// The response includes any supplied arguments.
/// The response includes any supplied arguments.
/// If called with an error argument an error response is returned.
/// </returns>
Task<IReadOnlyDictionary<string, string>> Test(string error, Args args, CancellationToken? cancellationToken = null);
Expand All @@ -25,16 +26,6 @@ public class ApiApi : IApiApi
private readonly ISlackApiClient _client;
public ApiApi(ISlackApiClient client) => _client = client;

/// <summary>
/// Helps you test your calling code.
/// </summary>
/// <param name="error">Error response to return.</param>
/// <param name="args">Example properties to return.</param>
/// <param name="cancellationToken"></param>
/// <returns>
/// The response includes any supplied arguments.
/// If called with an error argument an error response is returned.
/// </returns>
public async Task<IReadOnlyDictionary<string, string>> Test(string error, Args args, CancellationToken? cancellationToken = null)
{
var query = new Args(args) { ["error"] = error };
Expand Down
7 changes: 1 addition & 6 deletions SlackNet/WebApi/AppsConnectionsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public interface IAppsConnectionsApi
/// This API method uses an app-level token to generate a dynamic WebSocket URL.
/// Use it with your app in Socket Mode to receive events and interactive feature payloads to the URL, rather than a public HTTP Request URL.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/apps.connections.open">Slack documentation</a> for more information.</remarks>
/// <param name="cancellationToken"></param>
Task<ConnectionOpenResponse> Open(CancellationToken? cancellationToken = null);
}
Expand All @@ -20,12 +21,6 @@ public class AppsConnectionsApi : IAppsConnectionsApi
private readonly ISlackApiClient _client;
public AppsConnectionsApi(ISlackApiClient client) => _client = client;

/// <summary>
/// Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive events and interactive payloads over.
/// This API method uses an app-level token to generate a dynamic WebSocket URL.
/// Use it with your app in Socket Mode to receive events and interactive feature payloads to the URL, rather than a public HTTP Request URL.
/// </summary>
/// <param name="cancellationToken"></param>
public Task<ConnectionOpenResponse> Open(CancellationToken? cancellationToken = null) =>
_client.Post<ConnectionOpenResponse>("apps.connections.open", new Args(), cancellationToken);
}
Expand Down
11 changes: 1 addition & 10 deletions SlackNet/WebApi/AppsEventAuthorizationsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public interface IAppsEventAuthorizationsApi
/// <summary>
/// Get a list of authorizations for the given event context. Should always be used with app token type.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/apps.event.authorizations.list">Slack documentation</a> for more information.</remarks>
/// <param name="eventContext">The <see cref="EventCallback.EventContext"/> from an event.</param>
/// <param name="limit">The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.</param>
/// <param name="cursor">
Expand All @@ -29,16 +30,6 @@ public class AppsEventAuthorizationsApi : IAppsEventAuthorizationsApi
private readonly ISlackApiClient _client;
public AppsEventAuthorizationsApi(ISlackApiClient client) => _client = client;

/// <summary>
/// Get a list of authorizations for the given event context. Should always be used with app token type.
/// </summary>
/// <param name="eventContext">The <see cref="EventCallback.EventContext"/> from an event.</param>
/// <param name="limit">The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.</param>
/// <param name="cursor">
/// Paginate through collections of data by setting the cursor parameter to the <see cref="AppsEventsAuthorizationsListResponse.CursorNext"/> property
/// returned by a previous request. Default value fetches the first "page" of the collection.
/// </param>
/// <param name="cancellationToken"></param>
public Task<AppsEventsAuthorizationsListResponse> List(
string eventContext,
int limit = 100,
Expand Down
13 changes: 3 additions & 10 deletions SlackNet/WebApi/AuthApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public interface IAuthApi
/// Revokes an access token. Use it when you no longer need a token.
/// For example, with a Sign In With Slack app, call this to log a user out.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/auth.revoke">Slack documentation</a> for more information.</remarks>
/// <param name="test">Setting this parameter to True triggers a testing mode where the specified token will not actually be revoked.</param>
/// <param name="cancellationToken"></param>
/// <returns>Whether or not the access token was revoked.</returns>
Expand All @@ -18,6 +19,8 @@ public interface IAuthApi
/// <summary>
/// Checks authentication and tells you who you are.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/auth.test">Slack documentation</a> for more information.</remarks>
/// <param name="cancellationToken"></param>
Task<AuthTestResponse> Test(CancellationToken? cancellationToken = null);
}

Expand All @@ -26,19 +29,9 @@ public class AuthApi : IAuthApi
private readonly ISlackApiClient _client;
public AuthApi(ISlackApiClient client) => _client = client;

/// <summary>
/// Revokes an access token. Use it when you no longer need a token.
/// For example, with a Sign In With Slack app, call this to log a user out.
/// </summary>
/// <param name="test">Setting this parameter to True triggers a testing mode where the specified token will not actually be revoked.</param>
/// <param name="cancellationToken"></param>
/// <returns>Whether or not the access token was revoked.</returns>
public async Task<bool> Revoke(bool test, CancellationToken? cancellationToken = null) =>
(await _client.Get<RevokeResponse>("auth.revoke", new Args { { "test", test } }, cancellationToken).ConfigureAwait(false)).Revoked;

/// <summary>
/// Checks authentication and tells you who you are.
/// </summary>
public Task<AuthTestResponse> Test(CancellationToken? cancellationToken = null) =>
_client.Post<AuthTestResponse>("auth.test", new Args(), cancellationToken);
}
Expand Down
9 changes: 2 additions & 7 deletions SlackNet/WebApi/BotsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ public interface IBotsApi
{
/// <summary>
/// Returns information about a bot user.
/// <paramref name="botId"/> is returned from <see cref="BotMessage"/> events and in the response of methods like <see cref="ChannelsApi.History"/>.
/// <paramref name="botId"/> is returned from <see cref="BotMessage"/> events and in the response of methods like <see cref="ConversationsApi.History"/>.
/// </summary>
/// <remarks>See the <a href="https://api.slack.com/methods/bots.info">Slack documentation</a> for more information.</remarks>
/// <param name="botId">Bot user to get info on.</param>
/// <param name="cancellationToken"></param>
Task<BotInfo> Info(string botId, CancellationToken? cancellationToken = null);
Expand All @@ -21,12 +22,6 @@ public class BotsApi : IBotsApi
private readonly ISlackApiClient _client;
public BotsApi(ISlackApiClient client) => _client = client;

/// <summary>
/// Returns information about a bot user.
/// <paramref name="botId"/> is returned from <see cref="BotMessage"/> events and in the response of methods like <see cref="ChannelsApi.History"/>.
/// </summary>
/// <param name="botId">Bot user to get info on.</param>
/// <param name="cancellationToken"></param>
public async Task<BotInfo> Info(string botId, CancellationToken? cancellationToken = null) =>
(await _client.Get<BotsInfoResponse>("bots.info", new Args { { "bot", botId } }, cancellationToken).ConfigureAwait(false)).Bot;
}
Expand Down
Loading

0 comments on commit c289421

Please sign in to comment.