| | 1 | | // <auto-generated> |
| | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 4 | | // regenerated. |
| | 5 | | // </auto-generated> |
| | 6 | |
|
| | 7 | | namespace Microsoft.Azure.CognitiveServices.ContentModerator |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Microsoft.Rest.Serialization; |
| | 11 | | using Models; |
| | 12 | | using Newtonsoft.Json; |
| | 13 | | using System.Collections; |
| | 14 | | using System.Collections.Generic; |
| | 15 | | using System.Net; |
| | 16 | | using System.Net.Http; |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// You use the API to scan your content as it is generated. Content |
| | 20 | | /// Moderator then processes your content and sends the results along with |
| | 21 | | /// relevant information either back to your systems or to the built-in |
| | 22 | | /// review tool. You can use this information to take decisions e.g. take |
| | 23 | | /// it down, send to human judge, etc. |
| | 24 | | /// |
| | 25 | | /// When using the API, images need to have a minimum of 128 pixels and a |
| | 26 | | /// maximum file size of 4MB. |
| | 27 | | /// Text can be at most 1024 characters long. |
| | 28 | | /// If the content passed to the text API or the image API exceeds the size |
| | 29 | | /// limits, the API will return an error code that informs about the issue. |
| | 30 | | /// </summary> |
| | 31 | | public partial class ContentModeratorClient : ServiceClient<ContentModeratorClient>, IContentModeratorClient |
| | 32 | | { |
| | 33 | | /// <summary> |
| | 34 | | /// The base URI of the service. |
| | 35 | | /// </summary> |
| 10 | 36 | | internal string BaseUri {get; set;} |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Gets or sets json serialization settings. |
| | 40 | | /// </summary> |
| 9 | 41 | | public JsonSerializerSettings SerializationSettings { get; private set; } |
| | 42 | |
|
| | 43 | | /// <summary> |
| | 44 | | /// Gets or sets json deserialization settings. |
| | 45 | | /// </summary> |
| 10 | 46 | | public JsonSerializerSettings DeserializationSettings { get; private set; } |
| | 47 | |
|
| | 48 | | /// <summary> |
| | 49 | | /// Supported Cognitive Services endpoints (protocol and hostname, for example: |
| | 50 | | /// https://westus.api.cognitive.microsoft.com). |
| | 51 | | /// </summary> |
| 15 | 52 | | public string Endpoint { get; set; } |
| | 53 | |
|
| | 54 | | /// <summary> |
| | 55 | | /// Subscription credentials which uniquely identify client subscription. |
| | 56 | | /// </summary> |
| 25 | 57 | | public ServiceClientCredentials Credentials { get; private set; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Gets the IImageModeration. |
| | 61 | | /// </summary> |
| 0 | 62 | | public virtual IImageModeration ImageModeration { get; private set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets the ITextModeration. |
| | 66 | | /// </summary> |
| 0 | 67 | | public virtual ITextModeration TextModeration { get; private set; } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// Gets the IListManagementImageLists. |
| | 71 | | /// </summary> |
| 0 | 72 | | public virtual IListManagementImageLists ListManagementImageLists { get; private set; } |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// Gets the IListManagementTermLists. |
| | 76 | | /// </summary> |
| 0 | 77 | | public virtual IListManagementTermLists ListManagementTermLists { get; private set; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Gets the IListManagementImage. |
| | 81 | | /// </summary> |
| 0 | 82 | | public virtual IListManagementImage ListManagementImage { get; private set; } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// Gets the IListManagementTerm. |
| | 86 | | /// </summary> |
| 0 | 87 | | public virtual IListManagementTerm ListManagementTerm { get; private set; } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Gets the IReviews. |
| | 91 | | /// </summary> |
| 10 | 92 | | public virtual IReviews Reviews { get; private set; } |
| | 93 | |
|
| | 94 | | /// <summary> |
| | 95 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 96 | | /// </summary> |
| | 97 | | /// <param name='httpClient'> |
| | 98 | | /// HttpClient to be used |
| | 99 | | /// </param> |
| | 100 | | /// <param name='disposeHttpClient'> |
| | 101 | | /// True: will dispose the provided httpClient on calling ContentModeratorClient.Dispose(). False: will not disp |
| 0 | 102 | | protected ContentModeratorClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpCl |
| | 103 | | { |
| 0 | 104 | | Initialize(); |
| 0 | 105 | | } |
| | 106 | |
|
| | 107 | | /// <summary> |
| | 108 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 109 | | /// </summary> |
| | 110 | | /// <param name='handlers'> |
| | 111 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 112 | | /// </param> |
| 5 | 113 | | protected ContentModeratorClient(params DelegatingHandler[] handlers) : base(handlers) |
| | 114 | | { |
| 5 | 115 | | Initialize(); |
| 5 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> |
| | 119 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 120 | | /// </summary> |
| | 121 | | /// <param name='rootHandler'> |
| | 122 | | /// Optional. The http client handler used to handle http transport. |
| | 123 | | /// </param> |
| | 124 | | /// <param name='handlers'> |
| | 125 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 126 | | /// </param> |
| 0 | 127 | | protected ContentModeratorClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(root |
| | 128 | | { |
| 0 | 129 | | Initialize(); |
| 0 | 130 | | } |
| | 131 | |
|
| | 132 | | /// <summary> |
| | 133 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 134 | | /// </summary> |
| | 135 | | /// <param name='credentials'> |
| | 136 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 137 | | /// </param> |
| | 138 | | /// <param name='handlers'> |
| | 139 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 140 | | /// </param> |
| | 141 | | /// <exception cref="System.ArgumentNullException"> |
| | 142 | | /// Thrown when a required parameter is null |
| | 143 | | /// </exception> |
| 5 | 144 | | public ContentModeratorClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this( |
| | 145 | | { |
| 5 | 146 | | if (credentials == null) |
| | 147 | | { |
| 0 | 148 | | throw new System.ArgumentNullException("credentials"); |
| | 149 | | } |
| 5 | 150 | | Credentials = credentials; |
| 5 | 151 | | if (Credentials != null) |
| | 152 | | { |
| 5 | 153 | | Credentials.InitializeServiceClient(this); |
| | 154 | | } |
| 5 | 155 | | } |
| | 156 | |
|
| | 157 | | /// <summary> |
| | 158 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 159 | | /// </summary> |
| | 160 | | /// <param name='credentials'> |
| | 161 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 162 | | /// </param> |
| | 163 | | /// <param name='httpClient'> |
| | 164 | | /// HttpClient to be used |
| | 165 | | /// </param> |
| | 166 | | /// <param name='disposeHttpClient'> |
| | 167 | | /// True: will dispose the provided httpClient on calling ContentModeratorClient.Dispose(). False: will not disp |
| | 168 | | /// <exception cref="System.ArgumentNullException"> |
| | 169 | | /// Thrown when a required parameter is null |
| | 170 | | /// </exception> |
| 0 | 171 | | public ContentModeratorClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClien |
| | 172 | | { |
| 0 | 173 | | if (credentials == null) |
| | 174 | | { |
| 0 | 175 | | throw new System.ArgumentNullException("credentials"); |
| | 176 | | } |
| 0 | 177 | | Credentials = credentials; |
| 0 | 178 | | if (Credentials != null) |
| | 179 | | { |
| 0 | 180 | | Credentials.InitializeServiceClient(this); |
| | 181 | | } |
| 0 | 182 | | } |
| | 183 | |
|
| | 184 | | /// <summary> |
| | 185 | | /// Initializes a new instance of the ContentModeratorClient class. |
| | 186 | | /// </summary> |
| | 187 | | /// <param name='credentials'> |
| | 188 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 189 | | /// </param> |
| | 190 | | /// <param name='rootHandler'> |
| | 191 | | /// Optional. The http client handler used to handle http transport. |
| | 192 | | /// </param> |
| | 193 | | /// <param name='handlers'> |
| | 194 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 195 | | /// </param> |
| | 196 | | /// <exception cref="System.ArgumentNullException"> |
| | 197 | | /// Thrown when a required parameter is null |
| | 198 | | /// </exception> |
| 0 | 199 | | public ContentModeratorClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delega |
| | 200 | | { |
| 0 | 201 | | if (credentials == null) |
| | 202 | | { |
| 0 | 203 | | throw new System.ArgumentNullException("credentials"); |
| | 204 | | } |
| 0 | 205 | | Credentials = credentials; |
| 0 | 206 | | if (Credentials != null) |
| | 207 | | { |
| 0 | 208 | | Credentials.InitializeServiceClient(this); |
| | 209 | | } |
| 0 | 210 | | } |
| | 211 | |
|
| | 212 | | /// <summary> |
| | 213 | | /// An optional partial-method to perform custom initialization. |
| | 214 | | ///</summary> |
| | 215 | | partial void CustomInitialize(); |
| | 216 | | /// <summary> |
| | 217 | | /// Initializes client properties. |
| | 218 | | /// </summary> |
| | 219 | | private void Initialize() |
| | 220 | | { |
| 5 | 221 | | ImageModeration = new ImageModeration(this); |
| 5 | 222 | | TextModeration = new TextModeration(this); |
| 5 | 223 | | ListManagementImageLists = new ListManagementImageLists(this); |
| 5 | 224 | | ListManagementTermLists = new ListManagementTermLists(this); |
| 5 | 225 | | ListManagementImage = new ListManagementImage(this); |
| 5 | 226 | | ListManagementTerm = new ListManagementTerm(this); |
| 5 | 227 | | Reviews = new Reviews(this); |
| 5 | 228 | | BaseUri = "{Endpoint}"; |
| 5 | 229 | | SerializationSettings = new JsonSerializerSettings |
| 5 | 230 | | { |
| 5 | 231 | | Formatting = Newtonsoft.Json.Formatting.Indented, |
| 5 | 232 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 5 | 233 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 5 | 234 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 5 | 235 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 5 | 236 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 5 | 237 | | Converters = new List<JsonConverter> |
| 5 | 238 | | { |
| 5 | 239 | | new Iso8601TimeSpanConverter() |
| 5 | 240 | | } |
| 5 | 241 | | }; |
| 5 | 242 | | DeserializationSettings = new JsonSerializerSettings |
| 5 | 243 | | { |
| 5 | 244 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 5 | 245 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 5 | 246 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 5 | 247 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 5 | 248 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 5 | 249 | | Converters = new List<JsonConverter> |
| 5 | 250 | | { |
| 5 | 251 | | new Iso8601TimeSpanConverter() |
| 5 | 252 | | } |
| 5 | 253 | | }; |
| | 254 | | CustomInitialize(); |
| 5 | 255 | | } |
| | 256 | | } |
| | 257 | | } |