Skip to content

Commit 3114763

Browse files
Merge pull request #1 from aspose-email-cloud/develop
Aspose.Email Cloud 19.11 released
2 parents a55a671 + 7e5cd80 commit 3114763

File tree

198 files changed

+15269
-4234
lines changed

Some content is hidden

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

198 files changed

+15269
-4234
lines changed

.gitignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/src/packages
2-
/src/obj/Debug
3-
/src/bin/Debug
4-
/src/.vs
5-
/src/Aspose.Email-Cloud.csproj.user
6-
/src/obj/Release
7-
/src/bin/Release
1+
packages/
2+
obj/
3+
bin/
4+
.vs
5+
*.csproj.user
6+
.idea/

Api/EmailApi.cs

Lines changed: 4565 additions & 0 deletions
Large diffs are not rendered by default.

Aspose.Email-Cloud.csproj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="MSBuild.Sdk.Extras">
3+
<PropertyGroup>
4+
<Title>Aspose.Email Cloud SDK for .NET</Title>
5+
<TargetFrameworks>net452;netstandard2.0;net20;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid60</TargetFrameworks>
6+
<Description>Aspose.Email Cloud is a REST API for creating email applications that work with common email file formats. It lets developers manipulate message formats such as Outlook MSG, EML and MHT files.</Description>
7+
<Copyright>Copyright (c) 2002-2018 Aspose Pty Ltd</Copyright>
8+
<PackageProjectUrl>https://github.com/aspose-email-cloud/aspose-email-cloud-dotnet</PackageProjectUrl>
9+
<License>MIT</License>
10+
<PackageIcon>aspose_email-for-cloud-icon.png</PackageIcon>
11+
<RepositoryUrl>https://github.com/aspose-email-cloud/aspose-email-cloud-dotnet</RepositoryUrl>
12+
<PackageTags>ASPOSE EMAIL CLOUD SDK Outlook MSG EML MHT</PackageTags>
13+
<RootNamespace>Aspose.Email.Cloud.Sdk</RootNamespace>
14+
<Version>19.11.0</Version>
15+
</PropertyGroup>
16+
<ItemGroup Condition=" '$(TargetFramework)' == 'Xamarin.iOS10' OR '$(TargetFramework)' == 'Xamarin.Mac20' OR '$(TargetFramework)' == 'MonoAndroid60'">
17+
<PackageReference Include="Newtonsoft.Json" Version="8.0.3" />
18+
<PackageReference Include="RestSharp" Version="106.6.10" />
19+
</ItemGroup>
20+
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' OR '$(TargetFramework)' == 'netstandard2.0'">
21+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
22+
<PackageReference Include="RestSharp" Version="106.6.10" />
23+
</ItemGroup>
24+
<ItemGroup Condition="'$(TargetFramework)' == 'net20'">
25+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
26+
<PackageReference Include="RestSharp.Net2" Version="1.1.11" />
27+
</ItemGroup>
28+
<ItemGroup>
29+
<None Include="resources\aspose_email-for-cloud-icon.png">
30+
<Pack>True</Pack>
31+
<PackagePath>
32+
</PackagePath>
33+
</None>
34+
</ItemGroup>
35+
</Project>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ public class ApiException : Exception {
1515
/// Gets or sets the error content (body json object)
1616
/// </summary>
1717
/// <value>The error content (Http response body).</value>
18-
public dynamic ErrorContent { get; private set; }
18+
public object ErrorContent { get; private set; }
1919

2020
/// <summary>
2121
/// Initializes a new instance of the <see cref="ApiException"/> class.
2222
/// </summary>
23-
/// <param name="basePath">The base path.</param>
2423
public ApiException() {}
2524

2625
/// <summary>
@@ -38,7 +37,7 @@ public ApiException(int errorCode, string message) : base(message) {
3837
/// <param name="errorCode">HTTP status code.</param>
3938
/// <param name="message">Error message.</param>
4039
/// <param name="errorContent">Error content.</param>
41-
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) {
40+
public ApiException(int errorCode, string message, object errorContent = null) : base(message) {
4241
this.ErrorCode = errorCode;
4342
this.ErrorContent = errorContent;
4443
}
Lines changed: 63 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// --------------------------------------------------------------------------------------------------------------------
1+
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright company="Aspose" file="Configuration.cs">
3-
// Copyright (c) 2018 Aspose.Email for Cloud
3+
// Copyright (c) 2018-2019 Aspose Pty Ltd. All rights reserved.
44
// </copyright>
55
// <summary>
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,34 +23,72 @@
2323
// </summary>
2424
// --------------------------------------------------------------------------------------------------------------------
2525

26-
namespace Aspose.Email.Cloud.Sdk
26+
27+
namespace Aspose.Email.Cloud.Sdk.Client
2728
{
29+
using System;
30+
2831
/// <summary>
2932
/// Represents a set of configuration settings.
3033
/// </summary>
3134
public class Configuration
3235
{
33-
private string apiBaseUrl = "https://api.aspose.cloud";
34-
private string version = "v1.1";
36+
#region Consts
37+
38+
/// <summary>
39+
/// The default base URL
40+
/// </summary>
41+
private const string DefaultBaseUrl = "https://api.aspose.cloud/";
42+
43+
/// <summary>
44+
/// The default API version
45+
/// </summary>
46+
private const string DefaultApiVersion = "v3.0";
3547

36-
private bool debugMode = false;
48+
#endregion
49+
50+
#region Fields
51+
52+
/// <summary>
53+
/// The API base URL
54+
/// </summary>
55+
private string apiBaseUrl = DefaultBaseUrl;
56+
57+
#endregion
58+
59+
#region Properties
3760

3861
/// <summary>
3962
/// Aspose Cloud API base URL.
4063
/// </summary>
4164
public string ApiBaseUrl
4265
{
43-
get
44-
{
45-
return this.apiBaseUrl;
46-
}
66+
get => apiBaseUrl;
4767

4868
set
4969
{
70+
if (value.StartsWith("v1") || value.StartsWith("v2"))
71+
{
72+
throw new Exception("This SDK is intended to be used only with API v3 " +
73+
"and higher due to breaking changes!");
74+
}
75+
5076
this.apiBaseUrl = value;
77+
if (!this.apiBaseUrl.EndsWith("/"))
78+
{
79+
this.apiBaseUrl += "/";
80+
}
5181
}
5282
}
5383

84+
/// <summary>
85+
/// Gets or sets the API version.
86+
/// </summary>
87+
/// <value>
88+
/// The API version.
89+
/// </value>
90+
public string ApiVersion { get; set; } = DefaultApiVersion;
91+
5492
/// <summary>
5593
/// Gets or sets the app key.
5694
/// </summary>
@@ -64,30 +102,27 @@ public string ApiBaseUrl
64102
/// <summary>
65103
/// Gets or sets a value indicating whether debug mode.
66104
/// </summary>
67-
public bool DebugMode
68-
{
69-
get
70-
{
71-
return this.debugMode;
72-
}
73-
74-
set
75-
{
76-
this.debugMode = value;
77-
}
78-
}
105+
public bool DebugMode { get; set; } = false;
79106

80107
/// <summary>
81-
/// Authentification type.
82-
/// Default is OAuth 2.0
108+
/// If you use custom on-premise server with metered license.
109+
/// This way, you only need to specify the API base URL.
83110
/// </summary>
84-
public AuthType AuthType { get; set; }
111+
public bool OnPremise { get; set; } = false;
112+
113+
#endregion
114+
115+
#region Methods
85116

117+
/// <summary>
118+
/// Gets the API root URL.
119+
/// </summary>
120+
/// <returns></returns>
86121
internal string GetApiRootUrl()
87122
{
88-
var result = this.ApiBaseUrl + "/" + this.version;
89-
90-
return result.EndsWith("/") ? result.Substring(0, result.Length - 1) : result;
123+
return this.ApiBaseUrl + this.ApiVersion;
91124
}
125+
126+
#endregion
92127
}
93128
}

Internal/ApiErrorModel.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
3+
namespace Aspose.Email.Cloud.Sdk
4+
{
5+
public class ApiErrorModel
6+
{
7+
public ApiErrorDataModel Error { get; set; }
8+
}
9+
10+
public class ApiErrorDataModel
11+
{
12+
public string Code { get; set; }
13+
public string Message { get; set; }
14+
public string Description { get; set; }
15+
public InnerApiErrorModel InnerError { get; set; }
16+
}
17+
18+
public class InnerApiErrorModel
19+
{
20+
public string RequestId { get; set; }
21+
public DateTime Date { get; set; }
22+
}
23+
}

0 commit comments

Comments
 (0)