24SevenOffice.MappedApi
0.1.1
See the version list below for details.
dotnet add package 24SevenOffice.MappedApi --version 0.1.1
NuGet\Install-Package 24SevenOffice.MappedApi -Version 0.1.1
<PackageReference Include="24SevenOffice.MappedApi" Version="0.1.1" />
paket add 24SevenOffice.MappedApi --version 0.1.1
#r "nuget: 24SevenOffice.MappedApi, 0.1.1"
// Install 24SevenOffice.MappedApi as a Cake Addin #addin nuget:?package=24SevenOffice.MappedApi&version=0.1.1 // Install 24SevenOffice.MappedApi as a Cake Tool #tool nuget:?package=24SevenOffice.MappedApi&version=0.1.1
Mapped 24SevenOffice API
Mapped 24SevenOffice API is a library intended to be reused by various integrations in order to save time implementing common scenarios of interaction with 24SevenOffice WCF SOAP services. This library targets .NET Standard 2.0, which means it's usable both with full .NET framework and .NET core (also other things that .NET Standard 2.0 supports).
You no longer need to
- add service references (instead, they are added within this library!);
- implement identity and session info management (instead, use provided abstractions e.g.
ISessionInfo
!); - invent bycicle to properly unit- and integration-test your code (instead, use interfaces!);
- call web-services synchronously (instead, use async/await!)
Core concepts
TfsoApiFactory
TfsoApiFactory
is a type that is used to create API service clients.
It can be reused because it has no state of it's own.
Service clients
Each service provided by 24SevenOffice can be consumed with corresponding service client. Currently supported 24SevenOffice services:
- Authenticate (
IAuthenticateClient
implemented byAuthenticateSoapClient
) - AccountService (
IAccountClient
implemented byAccountServiceSoapClient
) - AttachmentService (
IAttachmentClient
implemented byAttachmentServiceSoapClient
) - ClientService (
IClientClient
implemented byClientServiceSoapClient
) - CompanyService (
ICompanyClient
implemented byCompanyServiceSoapClient
) - FileService (
IFileClient
implemented byFileServiceSoapClient
) - FileInfoService (
IFileInfoClient
implemented byFileInfoServiceSoapClient
) - InvitationService (
IInvitationClient
implemented byInvitationServiceSoapClient
) - InvoiceService (
IInvoiceClient
implemented byInvoiceServiceSoapClient
) - PaymentService (
IPaymentClient
implemented byPaymentServiceSoapClient
) - PersonService (
IPersonClient
implemented byPersonServiceSoapClient
) - ProductService (
IProductClient
implemented byProductServiceSoapClient
) - ProjectService (
IProjectClient
implemented byProjectServiceSoapClient
) - SalesOppService (
ISalesOppClient
implemented bySalesOppServiceSoapClient
) - TemplateService (
ITemplateClient
implemented byTemplateServiceSoapClient
) - TimeService (
ITimeClient
implemented byTimeServiceSoapClient
) - TransactionService (
ITransactionClient
implemented byTransactionServiceSoapClient
)
Full list of services is available here.
Service clients shouldn't be reused because there are no thread safety guarantees.
24SevenOffice session and Identities
Upon logging in to 24SevenOffice, you receive a sessionId
string.
With this library, you actually receive ISessionInfo
object.
ISessionInfo
ISessionInfo
object is an aggregate of sessionId
string, ICredentials
and IIdentityCollection
objects and UTC timestamp of it's creation date.
This interface was designed to be shallow-immutable.
public interface ISessionInfo
{
string SessionId { get; }
ICredentials Credentials { get; }
IIdentityCollection Identities { get; }
DateTime CreatedOn { get; }
}
ICredentials
Represents credentials user has logged in with. It may be useful if you want to prolong user session without bothering the user.
This interface is designed to be immutable.
public interface ICredentials : IEquatable<Credentials>
{
bool IsEmpty {get;}
string Login { get; }
string Password { get; }
}
IIdentityCollection
By logging in to 24SevenOffice, you are also assigned an identity, which
represents the company you've logged in into. There may be multiple that
the user is a part of, hence the identity concept. 24SevenOffice supports
switching identities, and to make this easier, IIdentityCollection
was
created.
The purpose of this interface is to manage the current state of the session
regarding identities. When you use AuthenticateSoapClient
to log in, or
change identity, or set identity by id, AuthenticateSoapClient
performs
necessary calls to the IIdentityCollection
to reflect the current identity,
the default identity and list of available identities.
This interface was designed to be mutable, but you shouldn't need to mutate it directly from your code.
public interface IIdentityCollection
{
// returns a copy of identities stored within
[NotNull] IReadOnlyList<Identity> List { get; }
// gets or sets current identity
Identity CurrentIdentity { [CanBeNull] get; [NotNull] set; }
// gets default identity, can't set it here
[CanBeNull] Identity DefaultIdentity { get; }
// finds identity by id in a list of stored identities. if not found, returns null
[CanBeNull] Identity FindById(Guid id);
// indicates, whether there any identities stored within
bool HasIdentities { get; }
// clears the inner identity list, and populates it from "identities" parameter
void PopulateFrom([NotNull] Identity[] identities);
}
All of these are designed to be testable and extensible. For example,
SessionInfo
constructor allows you to specify your own implementation
of both ICredentials
and IIdentityCollection
.
public class SessionInfo : ISessionInfo
{
public SessionInfo([NotNull] string sessionId,
[NotNull] ICredentials credentials,
[NotNull] IIdentityCollection identityCollection)
{
SessionId = sessionId ?? throw new ArgumentNullException(nameof(sessionId));
Credentials = credentials ?? throw new ArgumentNullException(nameof(credentials));
Identities = identityCollection ?? throw new ArgumentNullException(nameof(identityCollection));
CreatedOn = DateTime.UtcNow;
}
// ... omitted for brevity
}
Examples
Generally, the best way to discover a library is to see it's unit-tests. However, some examples will be provided in this readme.
Authentication
using System;
using System.Threading.Tasks;
using MappedTfsoApi.Common.Facade;
using MappedTfsoApi.References.Authenticate;
namespace YourGreatApplication
{
public class SomeClass
{
public Task<ISessionInfo> AuthenticationExample()
{
var factory = new TfsoApiFactory();
var auth = factory.AuthenticateService();
return auth.AuthenticateAndGetSessionInfoAsync(new Credential
{
ApplicationId = Guid.Parse("<your application key>"),
Username = "<your login>",
Password = "<your password>"
});
}
}
}
Running this code and examining ISessionInfo
object will yield following results:
{
"SessionId": "<your session id>",
"Credentials": {
"IsEmpty": false,
"Login": "<your login>",
"Password": "<your password>"
},
"Identities": {
"List": [
list of identities
],
"CurrentIdentity": {
current identity, if any
},
"DefaultIdentity": {
default identity, if any
},
"HasIdentities": true (or false, depending on whether there are any identities)
},
"CreatedOn": "UTC timestamp of session creation time"
}
Notes
This library is still in it's early stages, so any contributions/bug reports/feature requests are welcome!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JetBrains.Annotations (>= 11.1.0)
- System.Diagnostics.TraceSource (>= 4.3.0)
- System.ServiceModel.Duplex (>= 4.5.0)
- System.ServiceModel.Http (>= 4.5.0)
- System.ServiceModel.NetTcp (>= 4.5.0)
- System.ServiceModel.Security (>= 4.5.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on 24SevenOffice.MappedApi:
Package | Downloads |
---|---|
24SevenOffice.MappedApi.Fakers
Provides a set of Bogus-powered Fakers for 24SevenOffice objects to ease unit-testing. |
|
24SevenOffice.MappedGeneralLedgerApi
Provides a wrapper for General Ledger REST API that handles license information utilizing ISessionInfo. |
|
24SevenOffice.MappedAccountAggregationApi
Provides a wrapper for Account Aggregation REST API that handles license information utilizing ISessionInfo. |
|
24SevenOffice.MappedApi.Resilience
Provides a set of 24SevenOffice SOAP API wrappers covered by Polly resiliency policies for .NET Standard. Includes support for 24SevenOffice-specific session id cookies. |
|
24SevenOffice.Decorated
Provides a decorated wrappers for 24SevenOffice SOAP and REST APIs that handles license information utilizing ISessionInfo. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.2 | 264 | 5/13/2024 |
3.0.0 | 1,538 | 5/9/2024 |
2.3.4 | 2,039 | 1/22/2024 |
2.3.0 | 516 | 11/17/2023 |
2.2.0 | 324 | 11/2/2023 |
2.1.0 | 301 | 10/31/2023 |
2.0.0 | 373 | 10/24/2023 |
1.0.22 | 1,939 | 9/21/2023 |
1.0.21 | 726 | 6/28/2023 |
1.0.20 | 470 | 6/20/2023 |
1.0.19 | 427 | 6/14/2023 |
1.0.18 | 461 | 6/13/2023 |
1.0.17 | 464 | 6/12/2023 |
1.0.16 | 576 | 5/31/2023 |
1.0.15 | 474 | 5/25/2023 |
1.0.14 | 432 | 5/25/2023 |
1.0.13 | 448 | 5/25/2023 |
1.0.12 | 8,620 | 6/3/2022 |
1.0.11 | 2,640 | 5/18/2022 |
1.0.10 | 2,508 | 4/21/2022 |
1.0.9 | 1,979 | 4/11/2022 |
1.0.8 | 15,755 | 11/3/2021 |
1.0.7 | 17,945 | 9/23/2021 |
1.0.6 | 2,444 | 3/16/2021 |
1.0.5 | 1,363 | 2/9/2021 |
1.0.4 | 2,042 | 12/18/2020 |
1.0.3 | 1,494 | 11/12/2020 |
1.0.2 | 1,712 | 11/9/2020 |
1.0.1 | 1,637 | 10/7/2020 |
1.0.0 | 1,635 | 9/30/2020 |
0.14.1 | 1,923 | 9/7/2020 |
0.14.0 | 1,811 | 6/26/2020 |
0.13.18 | 1,794 | 6/23/2020 |
0.13.17 | 1,827 | 6/16/2020 |
0.13.16 | 2,010 | 6/16/2020 |
0.13.15 | 1,916 | 6/13/2020 |
0.13.14 | 1,855 | 6/13/2020 |
0.13.13 | 1,825 | 6/12/2020 |
0.13.12 | 1,816 | 6/11/2020 |
0.13.11 | 1,772 | 6/11/2020 |
0.13.10 | 1,912 | 6/10/2020 |
0.13.9 | 1,799 | 6/9/2020 |
0.13.8 | 1,794 | 6/9/2020 |
0.13.7 | 1,871 | 6/4/2020 |
0.13.6 | 1,842 | 6/2/2020 |
0.13.5 | 1,892 | 6/2/2020 |
0.13.4 | 1,887 | 6/2/2020 |
0.13.3 | 1,848 | 6/2/2020 |
0.13.2 | 1,802 | 6/1/2020 |
0.13.1 | 1,813 | 6/1/2020 |
0.13.0 | 1,903 | 4/28/2020 |
0.12.6 | 2,059 | 3/26/2020 |
0.12.5 | 1,677 | 3/13/2020 |
0.12.4 | 1,656 | 3/12/2020 |
0.12.3 | 1,581 | 3/10/2020 |
0.12.2 | 1,555 | 3/10/2020 |
0.12.1 | 1,783 | 12/17/2019 |
0.12.0 | 1,545 | 12/9/2019 |
0.11.1 | 1,584 | 11/28/2019 |
0.11.0 | 1,604 | 11/27/2019 |
0.10.4 | 1,832 | 11/19/2019 |
0.10.3 | 1,735 | 10/3/2019 |
0.10.2 | 1,724 | 9/18/2019 |
0.10.0 | 1,736 | 9/3/2019 |
0.9.0 | 1,697 | 6/11/2019 |
0.8.0 | 2,595 | 5/14/2019 |
0.7.0 | 1,244 | 4/12/2019 |
0.6.0 | 938 | 3/26/2019 |
0.5.2 | 927 | 3/25/2019 |
0.5.0 | 854 | 2/26/2019 |
0.4.0 | 975 | 1/18/2019 |
0.3.0 | 1,022 | 11/23/2018 |
0.2.0 | 958 | 11/14/2018 |
0.1.2 | 1,186 | 8/14/2018 |
0.1.1 | 1,407 | 7/9/2018 |