/// <summary> /// Close a direct message channel. /// <see href="https://api.slack.com/methods/im.close" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:write` /// </param> /// <param name='channel'> /// Direct message channel to close. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <CloseOKResponseModel> CloseAsync(this IIm operations, string token = default(string), string channel = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CloseWithHttpMessagesAsync(token, channel, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Opens a direct message channel. /// <see href="https://api.slack.com/methods/im.open" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:write` /// </param> /// <param name='returnIm'> /// Boolean, indicates you want the full IM channel definition in the response. /// </param> /// <param name='user'> /// User to open a direct message channel with. /// </param> /// <param name='includeLocale'> /// Set this to `true` to receive the locale for this im. Defaults to `false` /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <OpenOKResponseModelModel> OpenAsync(this IIm operations, string token = default(string), bool?returnIm = default(bool?), string user = default(string), bool?includeLocale = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.OpenWithHttpMessagesAsync(token, returnIm, user, includeLocale, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Retrieve a thread of messages posted to a direct message conversation /// <see href="https://api.slack.com/methods/im.replies" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='threadTs'> /// Unique identifier of a thread's parent message /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:history` /// </param> /// <param name='channel'> /// Direct message channel to fetch thread from /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <RepliesOKResponse> RepliesAsync(this IIm operations, string threadTs = default(string), string token = default(string), string channel = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RepliesWithHttpMessagesAsync(threadTs, token, channel, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Fetches history of messages and events from direct message channel. /// <see href="https://api.slack.com/methods/im.history" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='count'> /// Number of messages to return, between 1 and 1000. /// </param> /// <param name='unreads'> /// Include `unread_count_display` in the output? /// </param> /// <param name='inclusive'> /// Include messages with latest or oldest timestamp in results. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:history` /// </param> /// <param name='oldest'> /// Start of time range of messages to include in results. /// </param> /// <param name='channel'> /// Direct message channel to fetch history for. /// </param> /// <param name='latest'> /// End of time range of messages to include in results. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <HistoryOKResponseModelModelModel> HistoryAsync(this IIm operations, int?count = default(int?), bool?unreads = default(bool?), bool?inclusive = default(bool?), string token = default(string), string oldest = default(string), string channel = default(string), string latest = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.HistoryWithHttpMessagesAsync(count, unreads, inclusive, token, oldest, channel, latest, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public ImExecutor() { IImAdapter adapter = ImManager.ImAdapter; if (adapter == null) { Logger.Warn(Resources.IM_NotInitialized); } else { _instance = adapter.ImInstance; } }
/// <summary> /// Fetches history of messages and events from direct message channel. /// <see href="https://api.slack.com/methods/im.history" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='count'> /// Number of messages to return, between 1 and 1000. /// </param> /// <param name='unreads'> /// Include `unread_count_display` in the output? /// </param> /// <param name='inclusive'> /// Include messages with latest or oldest timestamp in results. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:history` /// </param> /// <param name='oldest'> /// Start of time range of messages to include in results. /// </param> /// <param name='channel'> /// Direct message channel to fetch history for. /// </param> /// <param name='latest'> /// End of time range of messages to include in results. /// </param> public static HistoryOKResponseModelModelModel History(this IIm operations, int?count = default(int?), bool?unreads = default(bool?), bool?inclusive = default(bool?), string token = default(string), string oldest = default(string), string channel = default(string), string latest = default(string)) { return(operations.HistoryAsync(count, unreads, inclusive, token, oldest, channel, latest).GetAwaiter().GetResult()); }
/// <summary> /// Retrieve a thread of messages posted to a direct message conversation /// <see href="https://api.slack.com/methods/im.replies" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='threadTs'> /// Unique identifier of a thread's parent message /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:history` /// </param> /// <param name='channel'> /// Direct message channel to fetch thread from /// </param> public static RepliesOKResponse Replies(this IIm operations, string threadTs = default(string), string token = default(string), string channel = default(string)) { return(operations.RepliesAsync(threadTs, token, channel).GetAwaiter().GetResult()); }
/// <summary> /// Close a direct message channel. /// <see href="https://api.slack.com/methods/im.close" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:write` /// </param> /// <param name='channel'> /// Direct message channel to close. /// </param> public static CloseOKResponseModel Close(this IIm operations, string token = default(string), string channel = default(string)) { return(operations.CloseAsync(token, channel).GetAwaiter().GetResult()); }
/// <summary> /// Opens a direct message channel. /// <see href="https://api.slack.com/methods/im.open" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:write` /// </param> /// <param name='returnIm'> /// Boolean, indicates you want the full IM channel definition in the response. /// </param> /// <param name='user'> /// User to open a direct message channel with. /// </param> /// <param name='includeLocale'> /// Set this to `true` to receive the locale for this im. Defaults to `false` /// </param> public static OpenOKResponseModelModel Open(this IIm operations, string token = default(string), bool?returnIm = default(bool?), string user = default(string), bool?includeLocale = default(bool?)) { return(operations.OpenAsync(token, returnIm, user, includeLocale).GetAwaiter().GetResult()); }
/// <summary> /// Sets the read cursor in a direct message channel. /// <see href="https://api.slack.com/methods/im.mark" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:write` /// </param> /// <param name='ts'> /// Timestamp of the most recently seen message. /// </param> /// <param name='channel'> /// Direct message channel to set reading cursor in. /// </param> public static MarkOKResponseModelModel Mark(this IIm operations, string token = default(string), string ts = default(string), string channel = default(string)) { return(operations.MarkAsync(token, ts, channel).GetAwaiter().GetResult()); }
/// <summary> /// Lists direct message channels for the calling user. /// <see href="https://api.slack.com/methods/im.list" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cursor'> /// Paginate through collections of data by setting the `cursor` parameter to a /// `next_cursor` attribute returned by a previous request's /// `response_metadata`. Default value fetches the first "page" of the /// collection. See [pagination](/docs/pagination) for more detail. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:read` /// </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='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ListOKResponseModelModelModelModelModelModelModel> ListAsync(this IIm operations, string cursor = default(string), string token = default(string), int?limit = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(cursor, token, limit, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Lists direct message channels for the calling user. /// <see href="https://api.slack.com/methods/im.list" /> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cursor'> /// Paginate through collections of data by setting the `cursor` parameter to a /// `next_cursor` attribute returned by a previous request's /// `response_metadata`. Default value fetches the first "page" of the /// collection. See [pagination](/docs/pagination) for more detail. /// </param> /// <param name='token'> /// Authentication token. Requires scope: `im:read` /// </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> public static ListOKResponseModelModelModelModelModelModelModel List(this IIm operations, string cursor = default(string), string token = default(string), int?limit = default(int?)) { return(operations.ListAsync(cursor, token, limit).GetAwaiter().GetResult()); }