Skip to content

Commit

Permalink
Merge pull request #1 from indice-co/master
Browse files Browse the repository at this point in the history
Merge Changes
  • Loading branch information
Sorras-Panagiotis authored Nov 26, 2020
2 parents bb0e9b0 + 32298e7 commit 84b5aa9
Show file tree
Hide file tree
Showing 20 changed files with 277 additions and 182 deletions.
10 changes: 1 addition & 9 deletions src/Incontrl.Sdk/Abstractions/IDocumentApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,12 @@ public interface IDocumentApi
/// <returns>Returns the task object representing the asynchronous operation.</returns>
Task<Document> UpdateAsync(UpdateDocumentRequest request, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Updates a document's mark.
/// </summary>
/// <param name="request">An object of type <see cref="UpdateDocumentAadeFieldsRequest"/> that contains information about the document to update.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns the task object representing the asynchronous operation.</returns>
Task<Document> UpdateMarkAsync(UpdateDocumentAadeFieldsRequest request, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Submits the specified document to Aade.
/// </summary>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns the task object representing the asynchronous operation.</returns>
Task<MyDataResponse> SendToIAPR(CancellationToken cancellationToken = default(CancellationToken));
Task<MyDataResponse> SendToIapr(CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Permanently deletes the specified document.
Expand Down
10 changes: 9 additions & 1 deletion src/Incontrl.Sdk/Abstractions/ILookupTimeZonesApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@

namespace Incontrl.Sdk.Abstractions
{
/// <summary>
///
/// </summary>
public interface ILookupTimeZonesApi
{
Task<ResultSet<TimeZone>> ListAsync(ListOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
///
/// </summary>
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
Task<ResultSet<TimeZone>> ListAsync(ListOptions options = null, CancellationToken cancellationToken = default);
}
}
24 changes: 24 additions & 0 deletions src/Incontrl.Sdk/Abstractions/ILookupsApi.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
namespace Incontrl.Sdk.Abstractions
{
/// <summary>
///
/// </summary>
public interface ILookupsApi
{
/// <summary>
///
/// </summary>
/// <returns></returns>
ILookupTimeZonesApi TimeZones();
/// <summary>
///
/// </summary>
/// <returns></returns>
ILookupCountriesApi Countries();
/// <summary>
///
/// </summary>
/// <param name="countryIso"></param>
/// <returns></returns>
ILookupCountriesDefaultsApi Countries(string countryIso);
/// <summary>
///
/// </summary>
/// <returns></returns>
ILookupCurrenciesApi Currencies();
/// <summary>
///
/// </summary>
/// <returns></returns>
ILookupPlansApi Plans();
ILookupExpenseClassificationCategoriesApi ExpenseCategories();
ILookupExpenseClassificationTypesApi ExpenseTypes();
Expand Down
44 changes: 4 additions & 40 deletions src/Incontrl.Sdk/Abstractions/ISubscriptionApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,160 +12,124 @@ namespace Incontrl.Sdk.Abstractions
public interface ISubscriptionApi
{
/// <summary>
///
/// The id of the subscription.
/// </summary>
string SubscriptionId { get; set; }

/// <summary>
/// Gets a specific subscription by it's unique id or alias.
/// </summary>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns the task object representing the asynchronous operation.</returns>
Task<Subscription> GetAsync(CancellationToken cancellationToken = default(CancellationToken));

Task<Subscription> GetAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Permanently deletes a subscription and all related data.
/// </summary>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns the task object representing the asynchronous operation.</returns>
Task DeleteAsync(CancellationToken cancellationToken = default(CancellationToken));

Task DeleteAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Creates an instance of class <see cref="SubscriptionCompanyApi"/>, that provides functionality to retrieve or update a subscription's company information.
/// </summary>
ISubscriptionCompanyApi Company();

/// <summary>
/// Creates an instance of class <see cref="SubscriptionStatusApi"/>, that provides functionality to retrieve or update a subscription's status.
/// </summary>
ISubscriptionStatusApi Status();

/// <summary>
/// Creates an instance of class <see cref="ContactsApi"/>, that provides functionality to list or create the contacts of the subscription.
/// </summary>
IContactsApi Contacts();

/// <summary>
/// Creates an instance of class <see cref="SubscriptionContactApi"/>, that provides functionality to retrieve or update a subscription's contact information.
/// </summary>
ISubscriptionContactApi Contact();

/// <summary>
/// Creates an instance of class <see cref="ContactApi"/>, that gives access to a contact's allowed operations.
/// </summary>
/// <param name="contactId">The unique id of the contact.</param>
IContactApi Contacts(Guid contactId);

/// <summary>
/// Creates an instance of class <see cref="DocumentsApi"/>, that provides functionality to list or create the documents of a subscription.
/// </summary>
IDocumentsApi Documents();

/// <summary>
/// Creates an instance of class <see cref="DocumentsApi"/>, that gives access to the allowed operations for documents.
/// </summary>
/// <param name="documentId">The unique id of the document.</param>
IDocumentApi Documents(Guid documentId);

/// <summary>
/// Creates an instance of class <see cref="DocumentTypesApi"/>, that provides functionality to list or create the document types of the subscription.
/// </summary>
IDocumentTypesApi DocumentTypes();

/// <summary>
/// Creates an instance of class <see cref="DocumentTypeApi"/>, that gives access to the allowed operations for document types.
/// </summary>
/// <param name="documentTypeId">The unique id of the document type.</param>
IDocumentTypeApi DocumentTypes(Guid documentTypeId);

/// <summary>
/// Creates an instance of class <see cref="OrganisationsApi"/>, that provides functionality to list or create organisations for the subscription.
/// </summary>
IOrganisationsApi Organisations();

/// <summary>
/// Creates an instance of class <see cref="OrganisationApi"/>, that provides functionality to retrieve or update organisations of the subscription.
/// </summary>
/// <param name="organisationId">The unique id of the organisation.</param>
IOrganisationApi Organisations(Guid organisationId);

/// <summary>
/// Creates an instance of class <see cref="ProductsApi"/>, that provides functionality to list or create the products of the subscription.
/// </summary>
IProductsApi Products();

/// <summary>
/// Creates an instance of class ProductApi, that provides functionality to retrieve or update products of the subscription.
/// </summary>
/// <param name="productId">The unique id of the product.</param>
IProductApi Products(Guid productId);

/// <summary>
///
/// </summary>
/// <returns></returns>
ISubscriptionMembersApi Members();

/// <summary>
///
/// </summary>
/// <returns></returns>
ISubscriptionMetricsApi Metrics();

/// <summary>
///
/// Get's the current plan of the subscription.
/// </summary>
/// <returns></returns>
ISubscriptionPlanApi Plan();

/// <summary>
///
/// </summary>
/// <returns></returns>
ISubscriptionTimeZoneApi TimeZone();

/// <summary>
///
/// </summary>
/// <returns></returns>
IPaymentOptionsApi PaymentOptions();

/// <summary>
///
/// </summary>
/// <param name="paymentOptionId"></param>
/// <returns></returns>
IPaymentOptionApi PaymentOptions(Guid paymentOptionId);

/// <summary>
///
/// </summary>
/// <returns></returns>
ITaxesApi Taxes();

/// <summary>
///
/// </summary>
/// <param name="taxId"></param>
/// <returns></returns>
ITaxApi Taxes(Guid taxId);

/// <summary>
/// Creates an instance of class <see cref="SubscriptionActivity"/>, that provides functionality to retrieve the activity of the subscription.
/// </summary>
ISubscriptionActivityApi Activity();

/// <summary>
/// Creates an instance of class <see cref="InvitationApi"/>, that provides functionality to send and accept invitations.
/// </summary>
/// <returns></returns>
IInvitationApi Invitation();

/// <summary>
/// Creates an instance of class <see cref="ReportsApi"/>, that provides functionality to access reporting services.
/// </summary>
IReportApi Reports();

/// <summary>
/// Creates an instance of class <see cref="ReportsApi"/>, that provides functionality to access reporting services.
/// </summary>
Expand Down
22 changes: 12 additions & 10 deletions src/Incontrl.Sdk/Abstractions/ISubscriptionPlanApi.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading;
using System;
using System.Threading;
using System.Threading.Tasks;
using Incontrl.Sdk.Models;

Expand All @@ -10,23 +11,24 @@ namespace Incontrl.Sdk.Abstractions
public interface ISubscriptionPlanApi
{
/// <summary>
///
/// The id of the subscription.
/// </summary>
string SubscriptionId { get; set; }

/// <summary>
/// Provides access to modify the properties of a specified service.
/// </summary>
/// <param name="serviceId">The id of the service.</param>
ISubscriptionPlanServicesApi Services(Guid serviceId);
/// <summary>
///
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<Plan> GetAsync(CancellationToken cancellationToken = default(CancellationToken));

/// <param name="cancellationToken">Returns the task object representing the asynchronous operation.</param>
Task<Plan> GetAsync(CancellationToken cancellationToken = default);
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<Plan> UpdateAsync(Plan request, CancellationToken cancellationToken = default(CancellationToken));
/// <param name="cancellationToken">Returns the task object representing the asynchronous operation.</param>
Task<Plan> UpdateAsync(Plan request, CancellationToken cancellationToken = default);
}
}
27 changes: 27 additions & 0 deletions src/Incontrl.Sdk/Abstractions/ISubscriptionPlanServicesApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Threading;
using System.Threading.Tasks;
using Incontrl.Sdk.Models;

namespace Incontrl.Sdk.Abstractions
{
/// <summary>
/// Contains operations to modify the properties of a specified service.
/// </summary>
public interface ISubscriptionPlanServicesApi
{
/// <summary>
/// The id of the subscription.
/// </summary>
string SubscriptionId { get; set; }
/// <summary>
/// The id of the service.
/// </summary>
string ServiceId { get; set; }
/// <summary>
/// Updates the properties of a specified service based on the <see cref="UpdateServiceRequest"/> model.
/// </summary>
/// <param name="request">Models a request to update a service.</param>
/// <param name="cancellationToken">Returns the task object representing the asynchronous operation.</param>
Task<Service> UpdateAsync(UpdateServiceRequest request, CancellationToken cancellationToken = default);
}
}
19 changes: 16 additions & 3 deletions src/Incontrl.Sdk/Http/JsonRequest.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
using System.Net.Http;
using System.Globalization;
using System.Net.Http;
using System.Text;
using Incontrl.Sdk.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Incontrl.Sdk.Http
{
internal class JsonRequest : StringContent
{
private JsonRequest(string content) : base(content, Encoding.UTF8, "application/json") { }
private static readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings {
Culture = CultureInfo.CurrentCulture,
ContractResolver = new CamelCaseExceptDictionaryKeysResolver(),
DateTimeZoneHandling = DateTimeZoneHandling.Utc
};

public static JsonRequest For<T>(T payload) => new JsonRequest(JsonConvert.SerializeObject(payload));
private JsonRequest(string content) : base(content, Encoding.UTF8, "application/json") {
_serializerSettings.Converters.Add(new StringEnumConverter {
CamelCaseText = false
});
}

public static JsonRequest For<T>(T payload) => new JsonRequest(JsonConvert.SerializeObject(payload, _serializerSettings));
}
}
Loading

0 comments on commit 84b5aa9

Please sign in to comment.