Skip to content

Commit 25fc6e6

Browse files
EMAILCLOUD-34 Generating Cloud SDKs using Swagger-Codegen
1 parent 7c7d66e commit 25fc6e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6045
-0
lines changed

src/Api/ApiException.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="ApiException.cs">
3+
// Copyright (c) 2018 Aspose.Email for Cloud
4+
// </copyright>
5+
// <summary>
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
// </summary>
24+
// --------------------------------------------------------------------------------------------------------------------
25+
26+
namespace Aspose.Email.Cloud.Sdk
27+
{
28+
using System;
29+
30+
/// <summary>
31+
/// API exception.
32+
/// </summary>
33+
public class ApiException : Exception
34+
{
35+
private readonly int errorCode;
36+
37+
/// <summary>
38+
/// Initializes a new instance of the <see cref="ApiException"/> class.
39+
/// </summary>
40+
/// <param name="errorCode">
41+
/// The error code.
42+
/// </param>
43+
/// <param name="message">
44+
/// The message.
45+
/// </param>
46+
public ApiException(int errorCode, string message) : base(message)
47+
{
48+
this.errorCode = errorCode;
49+
}
50+
51+
/// <summary>
52+
/// Error code.
53+
/// </summary>
54+
public int ErrorCode
55+
{
56+
get
57+
{
58+
return this.errorCode;
59+
}
60+
}
61+
}
62+
}

src/Api/AuthType.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="AuthType.cs">
3+
// Copyright (c) 2018 Aspose.Email for Cloud
4+
// </copyright>
5+
// <summary>
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
// </summary>
24+
// --------------------------------------------------------------------------------------------------------------------
25+
26+
namespace Aspose.Email.Cloud.Sdk
27+
{
28+
/// <summary>
29+
/// Supported types of authentification.
30+
/// </summary>
31+
public enum AuthType
32+
{
33+
/// <summary>
34+
/// OAuth2.0
35+
/// </summary>
36+
OAuth2 = 0,
37+
38+
/// <summary>
39+
/// Authentification with signing of url.
40+
/// </summary>
41+
RequestSignature = 1
42+
}
43+
}

src/Api/Configuration.cs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="Configuration.cs">
3+
// Copyright (c) 2018 Aspose.Email for Cloud
4+
// </copyright>
5+
// <summary>
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
// </summary>
24+
// --------------------------------------------------------------------------------------------------------------------
25+
26+
namespace Aspose.Email.Cloud.Sdk
27+
{
28+
/// <summary>
29+
/// Represents a set of configuration settings.
30+
/// </summary>
31+
public class Configuration
32+
{
33+
private string apiBaseUrl = "https://api.aspose.cloud";
34+
private string version = "v1.1";
35+
36+
private bool debugMode = false;
37+
38+
/// <summary>
39+
/// Aspose Cloud API base URL.
40+
/// </summary>
41+
public string ApiBaseUrl
42+
{
43+
get
44+
{
45+
return this.apiBaseUrl;
46+
}
47+
48+
set
49+
{
50+
this.apiBaseUrl = value;
51+
}
52+
}
53+
54+
/// <summary>
55+
/// Gets or sets the app key.
56+
/// </summary>
57+
public string AppKey { get; set; }
58+
59+
/// <summary>
60+
/// Gets or sets the app sid.
61+
/// </summary>
62+
public string AppSid { get; set; }
63+
64+
/// <summary>
65+
/// Gets or sets a value indicating whether debug mode.
66+
/// </summary>
67+
public bool DebugMode
68+
{
69+
get
70+
{
71+
return this.debugMode;
72+
}
73+
74+
set
75+
{
76+
this.debugMode = value;
77+
}
78+
}
79+
80+
/// <summary>
81+
/// Authentification type.
82+
/// Default is OAuth 2.0
83+
/// </summary>
84+
public AuthType AuthType { get; set; }
85+
86+
internal string GetApiRootUrl()
87+
{
88+
var result = this.ApiBaseUrl + "/" + this.version;
89+
90+
return result.EndsWith("/") ? result.Substring(0, result.Length - 1) : result;
91+
}
92+
}
93+
}

0 commit comments

Comments
 (0)