Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.IoTConnectivity / Tizen.Network.IoTConnectivity / Request.cs
1  /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 using System;
19
20 namespace Tizen.Network.IoTConnectivity
21 {
22     /// <summary>
23     /// Class respresenting request to a resource.
24     /// It provides APIs to manage client's request.
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     public class Request : IDisposable
28     {
29         private bool _disposed = false;
30
31         internal Request()
32         {
33         }
34
35         /// <summary>
36         /// Destructor of the Request class.
37         /// </summary>
38         ~Request()
39         {
40             Dispose(false);
41         }
42
43         /// <summary>
44         /// The host address of the request.
45         /// </summary>
46         /// <since_tizen> 3 </since_tizen>
47         /// <value>The host address of the request.</value>
48         public string HostAddress { get; internal set; }
49
50         /// <summary>
51         /// The representation of the request.
52         /// </summary>
53         /// <since_tizen> 3 </since_tizen>
54         /// <value>The representation of the request.</value>
55         public Representation Representation { get; internal set; }
56
57         /// <summary>
58         /// The query of the request.
59         /// </summary>
60         /// <since_tizen> 3 </since_tizen>
61         /// <value>The query of the request.</value>
62         public ResourceQuery Query { get; internal set; }
63
64         /// <summary>
65         /// The options related to the request.
66         /// </summary>
67         /// <since_tizen> 3 </since_tizen>
68         /// <value>The options related to the request.</value>
69         public ResourceOptions Options { get; internal set; }
70
71         /// <summary>
72         /// Releases any unmanaged resources used by this object.
73         /// </summary>
74         /// <since_tizen> 3 </since_tizen>
75         /// <feature>http://tizen.org/feature/iot.ocf</feature>
76         public void Dispose()
77         {
78             Dispose(true);
79             GC.SuppressFinalize(this);
80         }
81
82         /// <summary>
83         /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
84         /// </summary>
85         /// <since_tizen> 3 </since_tizen>
86         /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
87         /// <feature>http://tizen.org/feature/iot.ocf</feature>
88         protected virtual void Dispose(bool disposing)
89         {
90             if (_disposed)
91                 return;
92
93             if (disposing)
94             {
95                 Representation?.Dispose();
96                 Query?.Dispose();
97                 Options?.Dispose();
98             }
99
100             _disposed = true;
101         }
102     }
103 }