public static Task <MessageJsonModel> ModifyWebhookMessageAsync(this IRestApiClient client, Snowflake webhookId, string token, Snowflake messageId, MultipartJsonPayloadRestRequestContent <ModifyWebhookMessageJsonRestRequestContent> content, IRestRequestOptions options = null)
        {
            var route = Format(Route.Webhook.ModifyWebhookMessage, webhookId, token, messageId);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options));
        }
        public static Task <MessageJsonModel> CreateMessageAsync(this IRestApiClient client, Snowflake channelId, MultipartJsonPayloadRestRequestContent <CreateMessageJsonRestRequestContent> content, IRestRequestOptions options = null)
        {
            var route = Format(Route.Channel.CreateMessage, channelId);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options));
        }
        public static Task <MessageJsonModel> ExecuteWebhookAsync(this IRestApiClient client, Snowflake webhookId, string token, MultipartJsonPayloadRestRequestContent <ExecuteWebhookJsonRestRequestContent> content, bool wait = false, IRestRequestOptions options = null)
        {
            // TODO: query param utility
            var route = Format(Route.Webhook.ExecuteWebhook, new[] { KeyValuePair.Create("wait", (object)wait) }, webhookId, token);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options));
        }
        public static Task <MessageJsonModel> ModifyFollowupInteractionResponseAsync(this IRestApiClient client,
                                                                                     Snowflake applicationId, string interactionToken, Snowflake messageId, MultipartJsonPayloadRestRequestContent <ModifyWebhookMessageJsonRestRequestContent> content,
                                                                                     IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var route = Format(Route.Interactions.ModifyFollowupResponse, applicationId, interactionToken, messageId);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options, cancellationToken));
        }
        public static Task CreateInitialInteractionResponseAsync(this IRestApiClient client,
                                                                 Snowflake interactionId, string interactionToken, MultipartJsonPayloadRestRequestContent <CreateInitialInteractionResponseJsonRestRequestContent> content,
                                                                 IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var route = Format(Route.Interactions.CreateInitialResponse, interactionId, interactionToken);

            return(client.ExecuteAsync(route, content, options, cancellationToken));
        }
        public static Task <MessageJsonModel> ModifyMessageAsync(this IRestApiClient client,
                                                                 Snowflake channelId, Snowflake messageId, MultipartJsonPayloadRestRequestContent <ModifyMessageJsonRestRequestContent> content,
                                                                 IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var route = Format(Route.Channel.ModifyMessage, channelId, messageId);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options, cancellationToken));
        }
Exemplo n.º 7
0
        public static Task <MessageJsonModel> ExecuteWebhookAsync(this IRestApiClient client,
                                                                  Snowflake webhookId, string token, MultipartJsonPayloadRestRequestContent <ExecuteWebhookJsonRestRequestContent> content,
                                                                  Snowflake?threadId          = null, bool wait = false,
                                                                  IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            // TODO: query param utility
            var queryParameters = new KeyValuePair <string, object> [threadId != null ? 2: 1];

            queryParameters[0] = KeyValuePair.Create("wait", (object)wait);

            if (threadId != null)
            {
                queryParameters[1] = new("thread_id", threadId.Value);
            }

            var route = Format(Route.Webhook.ExecuteWebhook, queryParameters, webhookId, token);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options, cancellationToken));
        }
Exemplo n.º 8
0
        public static Task <MessageJsonModel> CreateFollowupInteractionResponseAsync(this IRestApiClient client, Snowflake applicationId, string interactionToken, MultipartJsonPayloadRestRequestContent <CreateFollowupMessageJsonRestRequestContent> content, IRestRequestOptions options = null)
        {
            var route = Format(Route.Interactions.CreateFollowupResponse, applicationId, interactionToken);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options));
        }