Skip to content

Commit

Permalink
Fix issues #52 and #53
Browse files Browse the repository at this point in the history
  • Loading branch information
justdmitry committed May 23, 2017
1 parent 33cb4ef commit 1fa9d80
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
19 changes: 19 additions & 0 deletions NetTelegramBotApi/Requests/DeleteWebhook.cs
@@ -0,0 +1,19 @@
namespace NetTelegramBotApi.Requests
{
using System;
using System.Net.Http;

public class DeleteWebhook : RequestBase<bool>
{
public DeleteWebhook()
: base("deleteWebhook")
{
// Nothing
}

public override HttpContent CreateHttpContent()
{
return null;
}
}
}
22 changes: 17 additions & 5 deletions NetTelegramBotApi/Requests/SetWebhook.cs
Expand Up @@ -6,14 +6,14 @@
namespace NetTelegramBotApi.Requests
{
/// <summary>
/// Use this method to specify a url and receive incoming updates via an outgoing webhook.
/// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url,
/// containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after
/// Use this method to specify a url and receive incoming updates via an outgoing webhook.
/// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url,
/// containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after
/// a reasonable amount of attempts.
/// </summary>
/// <remarks>
/// If you'd like to make sure that the Webhook request comes from Telegram,
/// we recommend using a secret path in the URL, e.g. www.example.com/<secret_path>.
/// If you'd like to make sure that the Webhook request comes from Telegram,
/// we recommend using a secret path in the URL, e.g. www.example.com/<secret_path>.
/// Since nobody else knows this secret_path, you can be pretty sure it’s us.
/// </remarks>
public class SetWebhook : SendFileRequestBase<bool>
Expand Down Expand Up @@ -43,10 +43,22 @@ public SetWebhook(string url, FileToSend certificatePublicKey)
/// </summary>
public string Url { get; set; }

/// <summary>
/// Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100.
/// Defaults to 40.
/// Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.
/// </summary>
public byte? MaxConnections { get; set; }

protected override void AppendParameters(Action<string, string> appendCallback)
{
appendCallback("url", Url);

if (MaxConnections.HasValue)
{
appendCallback("max_connections", MaxConnections.Value.ToString());
}

base.AppendParameters(appendCallback);
}
}
Expand Down

0 comments on commit 1fa9d80

Please sign in to comment.