forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HttpxResponseEventArgs.cs
102 lines (93 loc) · 2.53 KB
/
HttpxResponseEventArgs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Waher.Networking.HTTP;
namespace Waher.Networking.XMPP.HTTPX
{
/// <summary>
/// Event handler for HTTPX response events.
/// </summary>
/// <param name="Sender">Sender of event.</param>
/// <param name="e">Event arguments.</param>
public delegate void HttpxResponseEventHandler(object Sender, HttpxResponseEventArgs e);
/// <summary>
/// Event arguments for HTTPX responses.
/// </summary>
public class HttpxResponseEventArgs : IqResultEventArgs
{
private HttpResponse response;
private string statusMessage;
private double version;
private int statusCode;
private bool hasData;
private byte[] data;
/// <summary>
/// Event arguments for HTTPX responses.
/// </summary>
/// <param name="e">Event arguments.</param>
/// <param name="Response">HTTP response object.</param>
/// <param name="State">State object.</param>
/// <param name="Version">HTTP Version.</param>
/// <param name="StatusCode">HTTP Status Code.</param>
/// <param name="StatusMessage">HTTP Status Message.</param>
/// <param name="HasData">If the response has data.</param>
/// <param name="Data">Any binary data directly available in the response.</param>
public HttpxResponseEventArgs(IqResultEventArgs e, HttpResponse Response, object State,
double Version, int StatusCode, string StatusMessage, bool HasData, byte[] Data)
: base(e)
{
this.response = Response;
this.State = State;
this.version = Version;
this.statusCode = StatusCode;
this.statusMessage = StatusMessage;
this.hasData = HasData;
this.data = Data;
}
/// <summary>
/// HTTP Response.
/// </summary>
public HttpResponse HttpResponse
{
get { return this.response; }
}
/// <summary>
/// HTTP version.
/// </summary>
public double Version
{
get { return this.version; }
}
/// <summary>
/// HTTP status code.
/// </summary>
public int StatusCode
{
get { return this.statusCode; }
}
/// <summary>
/// HTTP status message.
/// </summary>
public string StatusMessage
{
get { return this.statusMessage; }
}
/// <summary>
/// If the response has data.
/// </summary>
public bool HasData
{
get { return this.hasData; }
}
/// <summary>
/// Any binary data directly available in the response. If <see cref="HasData"/>=true and <see cref="Data"/>=null,
/// binary data will be received in chunks.
/// </summary>
public byte[] Data
{
get { return this.data; }
}
}
}