Skip to content

Commit 7ba6557

Browse files
Update SDK to use omr cloud v3
1 parent feb745e commit 7ba6557

Some content is hidden

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

53 files changed

+3388
-2210
lines changed

SDK/Aspose.OMR.Cloud.SDK.sln

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.26403.7
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspose.OMR.Cloud.SDK", "Aspose.OMR.Cloud.SDK\Aspose.OMR.Cloud.SDK.csproj", "{5731BAC8-8227-4CE7-833D-CB917BD37C97}"
7-
EndProject
86
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspose.OMR.Demo", "Aspose.OMR.Demo\Aspose.OMR.Demo.csproj", "{85885728-0D8F-4A60-AD03-02A48CAFED18}"
97
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspose.Omr.Cloud.Sdk", "Aspose.OMR.Cloud.SDK\Aspose.Omr.Cloud.Sdk.csproj", "{AD03DF83-506E-4A44-B7BD-EC11159E68CA}"
9+
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1212
Debug|Any CPU = Debug|Any CPU
1313
Release|Any CPU = Release|Any CPU
1414
EndGlobalSection
1515
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{5731BAC8-8227-4CE7-833D-CB917BD37C97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17-
{5731BAC8-8227-4CE7-833D-CB917BD37C97}.Debug|Any CPU.Build.0 = Debug|Any CPU
18-
{5731BAC8-8227-4CE7-833D-CB917BD37C97}.Release|Any CPU.ActiveCfg = Release|Any CPU
19-
{5731BAC8-8227-4CE7-833D-CB917BD37C97}.Release|Any CPU.Build.0 = Release|Any CPU
2016
{85885728-0D8F-4A60-AD03-02A48CAFED18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2117
{85885728-0D8F-4A60-AD03-02A48CAFED18}.Debug|Any CPU.Build.0 = Debug|Any CPU
2218
{85885728-0D8F-4A60-AD03-02A48CAFED18}.Release|Any CPU.ActiveCfg = Release|Any CPU
2319
{85885728-0D8F-4A60-AD03-02A48CAFED18}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{AD03DF83-506E-4A44-B7BD-EC11159E68CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{AD03DF83-506E-4A44-B7BD-EC11159E68CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{AD03DF83-506E-4A44-B7BD-EC11159E68CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{AD03DF83-506E-4A44-B7BD-EC11159E68CA}.Release|Any CPU.Build.0 = Release|Any CPU
2424
EndGlobalSection
2525
GlobalSection(SolutionProperties) = preSolution
2626
HideSolutionNode = FALSE
2727
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {1F7DD495-B48C-4B7B-A0C9-CA57032BF803}
30+
EndGlobalSection
2831
EndGlobal
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
3+
namespace Aspose.Omr.Cloud.Sdk
4+
{
5+
/// <summary>
6+
/// API Exception
7+
/// </summary>
8+
public class ApiException : Exception
9+
{
10+
/// <summary>
11+
/// Gets or sets the error code (HTTP status code)
12+
/// </summary>
13+
/// <value>The error code (HTTP status code).</value>
14+
public int ErrorCode { get; set; }
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="ApiException"/> class.
18+
/// </summary>
19+
/// <param name="basePath">The base path.</param>
20+
public ApiException() { }
21+
22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="ApiException"/> class.
24+
/// </summary>
25+
/// <param name="errorCode">HTTP status code.</param>
26+
/// <param name="message">Error message.</param>
27+
public ApiException(int errorCode, string message) : base(message)
28+
{
29+
this.ErrorCode = errorCode;
30+
}
31+
}
32+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="ApiVersion.cs">
3+
// Copyright (c) 2019 Aspose.Omr 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.Omr.Cloud.Sdk
27+
{
28+
/// <summary>
29+
/// The availiable api versions.
30+
/// </summary>
31+
public class ApiVersion
32+
{
33+
public string Version { get; set; }
34+
private ApiVersion(string version)
35+
{
36+
Version = version;
37+
}
38+
/// <summary>
39+
/// Current API version
40+
/// </summary>
41+
public static ApiVersion V1 = new ApiVersion("1.0");
42+
43+
/// <summary>
44+
/// Stable version
45+
/// </summary>
46+
public static ApiVersion V2 = new ApiVersion("2.0");
47+
48+
/// <summary>
49+
/// Frozen version
50+
/// </summary>
51+
public static ApiVersion V3 = new ApiVersion("3.0");
52+
53+
public override string ToString()
54+
{
55+
return Version;
56+
}
57+
}
58+
59+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="AuthType.cs">
3+
// Copyright (c) 2019 Aspose.Omr 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.Omr.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+
/// <summary>
44+
/// Token for OAuth2 provided by caller
45+
/// </summary>
46+
ExternalAuth = 2,
47+
48+
/// <summary>
49+
/// Token for JWT authorization of OCR
50+
/// </summary>
51+
JWT = 3,
52+
}
53+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="Configuration.cs">
3+
// Copyright (c) 2019 Aspose.Omr 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.Omr.Cloud.Sdk
27+
{
28+
/// <summary>
29+
/// Represents a set of configuration settings
30+
/// </summary>
31+
public class Configuration
32+
{
33+
/// <summary>
34+
/// Aspose Cloud API base URL.
35+
/// </summary>
36+
public string ApiBaseUrl { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets the app key.
40+
/// </summary>
41+
public string AppKey { get; set; }
42+
43+
/// <summary>
44+
/// Gets or sets the app sid.
45+
/// </summary>
46+
public string AppSid { get; set; }
47+
48+
/// <summary>
49+
/// Gets or sets the Jwt token.
50+
/// If set the library would handle auth internally
51+
/// </summary>
52+
public string JwtToken { get; set; }
53+
54+
/// <summary>
55+
/// Gets or sets a value indicating whether debug mode.
56+
/// </summary>
57+
public bool DebugMode { get; set; }
58+
59+
/// <summary>
60+
/// Authentification type.
61+
/// </summary>
62+
public AuthType AuthType { get; set; }
63+
64+
/// <summary>
65+
/// Get or sets Cloud API Version.
66+
/// </summary>
67+
public ApiVersion ApiVersion { get; set; }
68+
69+
public Configuration()
70+
{
71+
ApiBaseUrl = "https://api.aspose.cloud";
72+
DebugMode = false;
73+
ApiVersion = ApiVersion.V3;
74+
AuthType = AuthType.JWT;
75+
}
76+
77+
internal string GetApiRootUrl()
78+
{
79+
var result = this.ApiBaseUrl + "/v" + ApiVersion;
80+
81+
return result.EndsWith("/") ? result.Substring(0, result.Length - 1) : result;
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)