ssf-restapiclient - SymphonyOSS.RestApiClient 0.5.0-beta00007
Symphony REST API Client Library for .NET
PM> Install-Package SymphonyOSS.RestApiClient -Version 0.5.0-beta00007 -Source https://www.myget.org/F/ssf-restapiclient/api/v3/index.json
> nuget.exe install SymphonyOSS.RestApiClient -Version 0.5.0-beta00007 -Source https://www.myget.org/F/ssf-restapiclient/api/v3/index.json
> dotnet add package SymphonyOSS.RestApiClient --version 0.5.0-beta00007 --source https://www.myget.org/F/ssf-restapiclient/api/v3/index.json
<PackageReference Include="SymphonyOSS.RestApiClient" Version="0.5.0-beta00007" />
Copy to clipboard
source https://www.myget.org/F/ssf-restapiclient/api/v3/index.json
nuget SymphonyOSS.RestApiClient ~> 0.5.0-beta00007
Copy to clipboard
> choco install SymphonyOSS.RestApiClient --version 0.5.0-beta00007 --source https://www.myget.org/F/ssf-restapiclient/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "ssf-restapiclient" -SourceLocation "https://www.myget.org/F/ssf-restapiclient/api/v2"
Install-Module -Name "SymphonyOSS.RestApiClient" -RequiredVersion "0.5.0-beta00007" -Repository "ssf-restapiclient" -AllowPreRelease
Copy to clipboard
Browse the sources in this package using Visual Studio or WinDbg by configuring the following legacy symbol server URL: https://www.myget.org/F/ssf-restapiclient/symbols/
Symphony REST API Client Library for .NET
This is a .NET client library for the Symphony REST API, the technology used to create integrated bots on the Symphony platform. Detailed documentation of the Symphony REST API can be found at developers.symphony.com.
Features
- Client code and model objects for all API endpoints.
- Automatic token management for authentication.
- Event-based data feed for processing inbound messages.
- Builder for constructing formatted messages (MessageML).
Supported Platforms
This project targets .NET Standard 1.3 which is supported by .NET Framework 4.6 and .NET Core 1.0, more details here.
Getting Started
Symphony's REST API have been logically divided into sub-APIs. To use the client library, a SessionManager is first created to handle authentication for a bot user, and relevant instances of the sub-APIs are created depending on what functions the bot user requires.
This example shows how to subscribe to a bot user's incoming messages using the DatafeedAPI:
var certificate = new X509Certificate2(@"botuser.p12", "password");
var sessionManager = new UserSessionManager("https://keymanager:8444/sessionauth/", "https://keymanager:8444/keyauth/", certificate);
var agentApiFactory = new AgentApiFactory("https://agentapi:8446/agent");
var datafeedApi = agentApiFactory.CreateDatafeedApi(sessionManager);
datafeedApi.OnMessage += (sender, event) =>
{
var message = e.Message;
Console.WriteLine(message.Body);
// Write any attachments to disk.
foreach (var attachmentInfo in message.Attachments)
{
var bytes = attachmentsApi.DownloadAttachment(message.StreamId, message.Id, attachmentInfo.Id);
File.WriteAllBytes(attachmentInfo.Name, bytes);
}
};
datafeedApi.Listen();
The following code snippet shows how to find a user by email address and send a formatted message:
var podApiFactory = new PodApiFactory("https://agentapi:8446/pod");
var usersApi = podApiFactory.CreateUsersApi(sessionManager);
var streamsApi = podApiFactory.CreateStreamsApi(sessionManager);
var userId = usersApi.GetUserId("jforsell@factset.com");
var streamId = streamsApi.CreateStream(new List<long> {userId});
var body = new MessageBuilder().Text("hello ").Bold("world").ToString();
messagesApi.PostMessage(new MessageSubmit(streamId, body));
Building
After cloning or downloading the source, it can be built in Visual Studio or with MSBuild.
Generated Code
The library depends on code that has been generated from Symphony's YAML spec files using nswag. The generated files live under the src/SymphonyOSS.RestClientApi/Generated folder.
In case there is a need to regenerate the code from Symphony's YAML specs:
- Make sure Node Package Manager is installed
- Install nswag via command line:
npm install nswag -g
- Install api-spec-converter via command line:
npm install api-spec-converter -g
- Run SymphonyOSS.RestApiClient\Generated\OpenApi\generate.bat
The details of the generation process are outlined in generate.bat
Contribute
This project was initiated at FactSet and has been developed as open-source from the very beginning.
Contributions are accepted via GitHub pull requests. All contributors must be covered by contributor license agreements to comply with the Code Contribution Process.
Release Notes
Release 0.5.0 (October 2017):
- Support for .NET Core
- Switched to using NSwag for Swagger code generation due to direct use of System.Net.Http.HttpClient; Swagger codegen uses FubarCoder's RestSharp library which is not thread safe
- All generated classes are no longer exposed externally
- App Authentication APIs now available
Release 0.4.0 (November 22, 2016):
- New entity classes have been introduced: Attachment, Connection, Message, Presence, User, Room, and Stream replace their generated counterparts (eg V2Message, UserV2, etc).
- SessionApi method GetUserId replaces GetSessionInfo.
- StreamsApi method CreateStream returns stream ID instead of Stream object.
- UsersApi GetUserId method replaces GetUser method (which returned a userId wrapped in a simple class).
- UtilApi methods return string instead of SimpleMessage.
Release 0.3.4 (October 10, 2016):
- Added a new framework dependency to the nuspec file.
Release 0.3.3 (October 10, 2016):
- Regenerated classes using latest swagger-codegen to fix bugs with optional parameters.
- Updated dependencies to latest versions.
Release 0.3.2 (September 27, 2016):
- Support for sending messages using both normal and on-behalf-of authentication.
Release 0.3.1 (September 19, 2016):
- Support for on-behalf-of operations,
- Method to get user details by user ID,
- Small fixes.
Release 0.3.0 (September 6, 2016):
- New APIs.
- New session management to support app sessions (breaking change).
- Improved datafeed error handling.
- MessageML to plain text parsing.
- And more...
Release 0.2.0 (June 28, 2016)
- New APIs added: attachments, room membership, security, user admin, and util.
- Support for attachments when sending and receiving messages (breaking change).
Release 0.1.0 (June 6, 2016)
- Initial release. Code generated from agentAPI v1.38.0, authenticatorAPI v1.0, and podAPI v1.38.0, found in agent-sdk-1.38.0-2016-05-27.tar.gz.
-
.NETStandard 1.3
- Microsoft.Extensions.Logging (>= 1.0.2)
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 10.0.3)
- System.ComponentModel.Annotations (>= 4.4.0)
- System.Net.Http (>= 4.3.2)
- System.Security.Cryptography.X509Certificates (>= 4.3.0)
- .NETStandard 1.3: 1.3.0.0
Assembly | Assembly hash | Match |
---|---|---|
/lib/netstandard1.3/symphonyoss.restapiclient.dll | 42be497efaab469faa32c7e6a066cf321 |
Ownersfinos malaysf Tanvi |
AuthorsSymphonyOSS.RestApiClient |
Project URLhttps://github.com/symphonyoss/RestApiClient/ |
LicenseApache-2.0 |
Info463 total downloads |
15 downloads for version 0.5.0-beta00007 |
Download (168.44 KB) |
Download legacy symbols (367.86 KB) |
Found on the current feed only |
Package history
Version | Size | Last updated | Downloads | Mirrored? | |||
---|---|---|---|---|---|---|---|
0.5.1-devmshahsf00033 | 166.03 KB | Fri, 08 Dec 2017 23:26:44 GMT | 14 | ||||
0.5.1-devmshahsf00032 | 167.16 KB | Thu, 07 Dec 2017 19:03:43 GMT | 13 | ||||
0.5.1-devmshahsf00031 | 165.84 KB | Fri, 13 Oct 2017 00:30:33 GMT | 13 | ||||
0.5.1-devmshahsf00030 | 165.54 KB | Thu, 12 Oct 2017 23:30:40 GMT | 15 | ||||
0.5.1-devmshahsf00029 | 165.53 KB | Wed, 11 Oct 2017 23:36:39 GMT | 13 | ||||
0.5.1-devmshahsf00028 | 164.99 KB | Tue, 10 Oct 2017 21:16:43 GMT | 14 | ||||
0.5.1-devmshahsf00027 | 163.53 KB | Tue, 10 Oct 2017 00:08:23 GMT | 13 | ||||
0.5.0-beta00008 | 168.87 KB | Tue, 06 Mar 2018 18:53:15 GMT | 16 | ||||
0.5.0-beta00007 | 168.44 KB | Mon, 22 Jan 2018 18:54:38 GMT | 15 | ||||
0.5.0-beta00006 | 168.43 KB | Fri, 19 Jan 2018 02:18:34 GMT | 16 | ||||
0.5.0-beta00005 | 166.72 KB | Tue, 09 Jan 2018 23:53:00 GMT | 15 | ||||
0.5.0-beta00004 | 166.11 KB | Sat, 09 Dec 2017 02:29:08 GMT | 15 | ||||
0.5.0-beta00003 | 167.14 KB | Tue, 28 Nov 2017 00:53:41 GMT | 17 | ||||
0.5.0-beta00002 | 165.83 KB | Fri, 13 Oct 2017 00:32:58 GMT | 16 | ||||
0.5.0-beta00001 | 165.52 KB | Thu, 12 Oct 2017 21:28:33 GMT | 16 | ||||
0.4.3-devmshahsf00026 | 163.45 KB | Tue, 26 Sep 2017 02:21:38 GMT | 15 | ||||
0.4.3-devmshahsf00025 | 240.44 KB | Thu, 07 Sep 2017 19:48:44 GMT | 14 | ||||
0.4.3-devmshahsf00024 | 240.43 KB | Thu, 07 Sep 2017 19:34:21 GMT | 15 | ||||
0.4.3-devmshahsf00023 | 240.43 KB | Thu, 31 Aug 2017 04:18:54 GMT | 15 | ||||
0.4.3-devmshahsf00022 | 239.96 KB | Wed, 30 Aug 2017 18:22:49 GMT | 15 | ||||
0.4.3-devmshahsf00021 | 239.97 KB | Mon, 28 Aug 2017 21:55:00 GMT | 13 | ||||
0.4.3-devmshahsf00020 | 239.7 KB | Mon, 28 Aug 2017 17:48:43 GMT | 12 | ||||
0.4.3-devmshahsf00019 | 239.7 KB | Mon, 21 Aug 2017 22:59:51 GMT | 14 | ||||
0.4.3-devmshahsf00018 | 239.96 KB | Mon, 21 Aug 2017 22:48:25 GMT | 8 | ||||
0.4.3-devmshahsf00011 | 239.96 KB | Mon, 21 Aug 2017 21:25:06 GMT | 9 | ||||
0.4.3-beta00005 | 240.44 KB | Tue, 26 Sep 2017 01:14:49 GMT | 8 | ||||
0.4.3-beta00004 | 240.43 KB | Thu, 07 Sep 2017 19:52:29 GMT | 11 | ||||
0.4.3-beta00003 | 240.42 KB | Thu, 31 Aug 2017 04:30:53 GMT | 8 | ||||
0.4.3-beta00002 | 239.96 KB | Mon, 28 Aug 2017 23:08:11 GMT | 8 | ||||
0.4.3-beta00001 | 239.69 KB | Tue, 22 Aug 2017 03:32:33 GMT | 8 | ||||
0.4.3-beta00000 | 238.51 KB | Thu, 20 Jul 2017 21:55:48 GMT | 6 | ||||
0.4.2-dev-mshahsf-CI00004 | 238.53 KB | Thu, 20 Jul 2017 20:43:42 GMT | 4 | ||||
0.4.2-dev-mshahsf-CI00003 | 238.55 KB | Fri, 14 Jul 2017 18:18:15 GMT | 6 | ||||
0.4.2-dev-mshahsf-CI00002 | 238.52 KB | Thu, 13 Jul 2017 23:03:45 GMT | 4 | ||||
0.4.2-dev-mshahsf-CI00000 | 272.91 KB | Fri, 07 Jul 2017 16:34:19 GMT | 6 | ||||
0.4.2-beta00020 | 272.86 KB | Sun, 02 Jul 2017 14:07:24 GMT | 8 | ||||
0.4.2-beta00019 | 199.87 KB | Mon, 27 Feb 2017 14:39:32 GMT | 5 | ||||
0.4.2-beta00018 | 199.87 KB | Mon, 27 Feb 2017 14:36:38 GMT | 6 | ||||
0.4.2-beta00016 | 199.86 KB | Tue, 03 Jan 2017 15:23:00 GMT | 5 | ||||
0.4.2-beta00015 | 199.87 KB | Tue, 03 Jan 2017 15:10:09 GMT | 5 | ||||
0.4.2-beta00014 | 199.85 KB | Mon, 02 Jan 2017 22:02:16 GMT | 4 | ||||
0.4.2-beta00013 | 199.86 KB | Mon, 02 Jan 2017 21:57:00 GMT | 3 | ||||
0.4.2-beta00012 | 199.86 KB | Mon, 02 Jan 2017 21:47:31 GMT | 3 | ||||
0.4.1-beta4 | 199.84 KB | Mon, 19 Dec 2016 19:01:50 GMT | 4 |