Refinitiv.EDP.AutoRest.Alerts 1.0.0

The source code is generated by AutoRest.

Install-Package Refinitiv.EDP.AutoRest.Alerts -Version 1.0.0
dotnet add package Refinitiv.EDP.AutoRest.Alerts --version 1.0.0
<PackageReference Include="Refinitiv.EDP.AutoRest.Alerts" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Refinitiv.EDP.AutoRest.Alerts --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Refinitiv.EDP.AutoRest.Alerts

The classes in this package are generated by AutoRest tool. The swagger file for this package is from the Elektron Data Platform APIs.

Version

  • 1.0.0 => /alerts/v1

Creation

The following commands are used to create classes in the package.

  1. It uses a tool from https://github.com/TR-API-Samples/Article.EDP.REST.AutoRest to modify the swagger file
node app.js --input alerts_v1.json --output alerts_v1_mod.json
  1. It uses the AutoRest command to generate the C# code
autorest --input-file=alerts_v1_mod.json --csharp --output-folder=CSharp_auth_alerts --namespace=Refinitiv.EDP.AutoRest.Alerts --add-credentials

Usage

The generated C# classes support both synchronous and asynchronous methods. The following code demonstrates how to use the synchronous method.

using Refinitiv.EDP.AutoRest.Alerts;
using Refinitiv.EDP.AutoRest.Alerts.Models;
using AlertsError = Refinitiv.EDP.AutoRest.Alerts.Models.Error;
...

        public NewsSubscriptionDetails SubscribeNewsHeadlines(
            Tokenresponse token, 
            JObject newsFilter, 
            out string error)
        {
            TokenCredentials cred = new TokenCredentials(token.AccessToken);

            SubscriptionstocontentalertsAPI alerts = new SubscriptionstocontentalertsAPI(cred);

            var response = alerts.PostNewsHeadlinesSubscriptions(new NewNewsSubscription { Filter = newsFilter });

            
            if (response is NewsSubscriptionDetails)
            {
                error = null;
                return (NewsSubscriptionDetails)response;
            }
            else if(response is AlertsError)
            {                
                error = ((AlertsError)response).ErrorProperty.Message;
                return null;
            }
            else
            {
                error = "Unknown Type";
                return null;
            }
        }

The Tokenresponse object is from Refinitiv.EDP.AutoRest.Auth.OAuth2.

Refinitiv.EDP.AutoRest.Alerts

The classes in this package are generated by AutoRest tool. The swagger file for this package is from the Elektron Data Platform APIs.

Version

  • 1.0.0 => /alerts/v1

Creation

The following commands are used to create classes in the package.

  1. It uses a tool from https://github.com/TR-API-Samples/Article.EDP.REST.AutoRest to modify the swagger file
node app.js --input alerts_v1.json --output alerts_v1_mod.json
  1. It uses the AutoRest command to generate the C# code
autorest --input-file=alerts_v1_mod.json --csharp --output-folder=CSharp_auth_alerts --namespace=Refinitiv.EDP.AutoRest.Alerts --add-credentials

Usage

The generated C# classes support both synchronous and asynchronous methods. The following code demonstrates how to use the synchronous method.

using Refinitiv.EDP.AutoRest.Alerts;
using Refinitiv.EDP.AutoRest.Alerts.Models;
using AlertsError = Refinitiv.EDP.AutoRest.Alerts.Models.Error;
...

        public NewsSubscriptionDetails SubscribeNewsHeadlines(
            Tokenresponse token, 
            JObject newsFilter, 
            out string error)
        {
            TokenCredentials cred = new TokenCredentials(token.AccessToken);

            SubscriptionstocontentalertsAPI alerts = new SubscriptionstocontentalertsAPI(cred);

            var response = alerts.PostNewsHeadlinesSubscriptions(new NewNewsSubscription { Filter = newsFilter });

            
            if (response is NewsSubscriptionDetails)
            {
                error = null;
                return (NewsSubscriptionDetails)response;
            }
            else if(response is AlertsError)
            {                
                error = ((AlertsError)response).ErrorProperty.Message;
                return null;
            }
            else
            {
                error = "Unknown Type";
                return null;
            }
        }

The Tokenresponse object is from Refinitiv.EDP.AutoRest.Auth.OAuth2.

Version History

Version Downloads Last updated
1.0.0 91 4/30/2019