Skip to content

Commit

Permalink
Added API to to API configuration, updated the SDK version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeygrant committed Jul 10, 2024
1 parent fbde44e commit 21f7112
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
15 changes: 13 additions & 2 deletions MYOB.API.SDK/SDK/ApiConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ static ApiConfiguration()
/// <param name="redirectUrl">The redirect uri for the application (OAuth related)</param>
/// <param name="apiBaseUrl">The AccountRight API endpoint, defaults to 'https://api.myob.com/accountright'</param>
/// <param name="generateUris">Should the returned entities have the <see cref="BaseEntity.URI"/> and <see cref="BaseLink.URI"/> fields populated</param>
public ApiConfiguration(string clientId, string clientSecret, string redirectUrl, string apiBaseUrl = "https://api.myob.com/accountright", bool generateUris = true)
public ApiConfiguration(string clientId, string clientSecret, string redirectUrl, string apiBaseUrl = "https://api.myob.com/accountright", bool generateUris = true, string apiKey = null)
{
ApiBaseUrl = apiBaseUrl;
ClientId = clientId;
AuthApiKey = apiKey ?? clientId;
ClientSecret = clientSecret;
RedirectUrl = redirectUrl;
GenerateUris = generateUris;
Expand Down Expand Up @@ -80,10 +81,20 @@ public ApiConfiguration(string apiBaseUrl) : this(null, null, null, apiBaseUrl)
/// </summary>
public bool GenerateUris { get; private set; }

/// <summary>
/// The username for password flow
/// </summary>
public string AuthUsername { get; }

/// <summary>
/// The password for password flow
/// </summary>
public string AuthPassword { get; }

/// <summary>
/// The Api key used for making api request
/// </summary>
public string AuthApiKey { get; private set; }
public string AuthApiKey { get; }

#if !PORTABLE
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion MYOB.API.SDK/SDK/Communication/OAuthRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private string BuildRequestTokenData(string code)
{
var data = string.Format("client_id={0}&client_secret={1}&redirect_uri={2}&scope=CompanyFile&code={3}&grant_type=authorization_code",
_configuration.ClientId, _configuration.ClientSecret, Uri.EscapeDataString(_configuration.RedirectUrl), code);

return data;
}

Expand Down
11 changes: 10 additions & 1 deletion MYOB.API.SDK/SDK/IApiConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ public interface IApiConfiguration
string ApiBaseUrl { get; }

/// <summary>
/// The Api key used for making api request
/// The username for password flow
/// </summary>
string AuthUsername { get; }

/// <summary>
/// The password for password flow
/// </summary>
string AuthPassword { get; }
/// <summary>
/// The api for password flow
/// </summary>
string AuthApiKey { get; }

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2024.5.{build}
version: 2024.6.{build}
shallow_clone: true
assembly_info:
patch: true
Expand Down Expand Up @@ -30,4 +30,4 @@ deploy:
artifact: Release
on_success:
- cmd: >-
.\packages\coveralls.io.1.3.4\tools\coveralls.net.exe --opencover .\Artefacts\Coverage\output.xml
.\packages\coveralls.io.1.3.4\tools\coveralls.net.exe --opencover .\Artefacts\Coverage\output.xml

0 comments on commit 21f7112

Please sign in to comment.