Skip to content

talon-one/TalonOne.cs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TalonOne - the C# library for the Talon.One API

The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the Integration API section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. ### Where is the API? The API is available at the same hostname as these docs. For example, if you are reading this page at https://mycompany.talon.one/docs/api/, the URL for the [updateCustomerProfile][] operation is https://mycompany.talon.one/v1/customer_profiles/id [updateCustomerProfile]: #operation- -v1-customer_profiles- -integrationId- -put

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • SDK version: 2.0.0
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using TalonOne.Api;
using TalonOne.Client;
using TalonOne.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out TalonOne.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

Integration API

using System;
using System.Diagnostics;
using TalonOne.Api;
using TalonOne.Client;
using TalonOne.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            // Configure BasePath & API key authorization: api_key_v1
            var integrationConfig = new Configuration {
                BasePath = "https://mycompany.talon.one",
                ApiKey = new Dictionary<string, string> {
                    { "Authorization", "e18149e88f42205432281c9d3d0e711111302722577ad60dcebc86c43aabfe70" }
                },
                ApiKeyPrefix = new Dictionary<string, string> {
                    { "Authorization", "ApiKey-v1" }
                }
            };

            // Or via the "global" Default configuration:
            //   Configuration.Default.BasePath = "https://mycompany.talon.one";
            //   Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
            //   Configuration.Default.ApiKeyPrefix.Add("Authorization", "ApiKey-v1");
            
            // ************************************************
            // Integration API example to send a session update
            // ************************************************

            // When using the default approach, the next initiation of `IntegrationApi`
            // could be using the empty constructor
            var integrationApi = new IntegrationApi(integrationConfig);
            var customerSessionId = "my_unique_session_integration_id";  // string | The custom identifier for this session, must be unique within the account.
            var customerSessionPayload = new NewCustomerSession {
                ProfileId = "DADBOOF",
                State = NewCustomerSession.StateEnum.Open, // `Open` would be the default value anyway
                Total = (decimal)42.234
            };

            try
            {
                // Create/update a customer session using `UpdateCustomerSession` function
                IntegrationState result = apiInstance.UpdateCustomerSession(customerSessionId, customerSessionPayload);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling IntegrationApi.UpdateCustomerSession: " + e.Message );
            }
        }
    }
}

Application API

using System;
using System.Diagnostics;
using TalonOne.Api;
using TalonOne.Client;
using TalonOne.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            // Configure BasePath
            var managementConfig = new Configuration {
                BasePath = "https://mycompany.talon.one"
            };

            // Or via the "global" Default configuration:
            //   Configuration.Default.BasePath = "https://mycompany.talon.one";
            
            // ****************************************************
            // Management API example to load application with id 7
            // ****************************************************

            // When using the default approach, the next initiation of `ManagementApi`
            // could be using the empty constructor
            var managementApi = new ManagementApi(managementConfig);

            try
            {
                // Obtain session token
                var loginParams = new LoginParams("admin@talon.one", "https://whatthecommit.com/17fe05217dbe10af4d1158c71914faeb");
                var session = instance.CreateSession(loginParams);

                // Save token in the configuration for future management API calls
                managementConfig.ApiKey.Add("Authorization", session.Token);
                managementConfig.ApiKeyPrefix.Add("Authorization", "Bearer");

                // Or again, via the "global" Default configuration:
                //   Configuration.Default.ApiKey.Add("Authorization", session.Token);
                //   Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");

                // Calling `GetApplication` function with the desired id (7)
                Application result = instance.GetApplication(7);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling ManagementApi.GetApplication: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://localhost

Class Method HTTP request Description
IntegrationApi CreateCouponReservation POST /v1/coupon_reservations/{couponValue} Create a new coupon reservation
IntegrationApi CreateReferral POST /v1/referrals Create a referral code for an advocate
IntegrationApi DeleteCouponReservation DELETE /v1/coupon_reservations/{couponValue} Delete coupon reservations
IntegrationApi DeleteCustomerData DELETE /v1/customer_data/{integrationId} Delete the personal data of a customer.
IntegrationApi GetReservedCoupons GET /v1/coupon_reservations/coupons/{integrationId} Get all valid reserved coupons
IntegrationApi GetReservedCustomers GET /v1/coupon_reservations/customerprofiles/{couponValue} Get the users that have this coupon reserved
IntegrationApi TrackEvent POST /v1/events Track an Event
IntegrationApi UpdateCustomerProfile PUT /v1/customer_profiles/{integrationId} Update a Customer Profile
IntegrationApi UpdateCustomerSession PUT /v1/customer_sessions/{customerSessionId} Update a Customer Session
ManagementApi AddLoyaltyPoints PUT /v1/loyalty_programs/{programID}/profile/{integrationID}/add_points Add points in a certain loyalty program for the specified customer
ManagementApi CopyCampaignToApplications POST /v1/applications/{applicationId}/campaigns/{campaignId}/copy Copy the campaign into every specified application
ManagementApi CreateCampaign POST /v1/applications/{applicationId}/campaigns Create a Campaign
ManagementApi CreateCoupons POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Create Coupons
ManagementApi CreatePasswordRecoveryEmail POST /v1/password_recovery_emails Request a password reset
ManagementApi CreateRuleset POST /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets Create a Ruleset
ManagementApi CreateSession POST /v1/sessions Create a Session
ManagementApi DeleteCampaign DELETE /v1/applications/{applicationId}/campaigns/{campaignId} Delete a Campaign
ManagementApi DeleteCoupon DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Delete one Coupon
ManagementApi DeleteCoupons DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Delete Coupons
ManagementApi DeleteReferral DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId} Delete one Referral
ManagementApi DeleteRuleset DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId} Delete a Ruleset
ManagementApi GetAccessLogs GET /v1/applications/{applicationId}/access_logs Get access logs for application
ManagementApi GetAccessLogsWithoutTotalCount GET /v1/applications/{applicationId}/access_logs/no_total Get access logs for application
ManagementApi GetAccount GET /v1/accounts/{accountId} Get Account Details
ManagementApi GetAccountAnalytics GET /v1/accounts/{accountId}/analytics Get Account Analytics
ManagementApi GetAccountLimits GET /v1/accounts/{accountId}/limits Get Account Limits
ManagementApi GetAllAccessLogs GET /v1/access_logs Get all access logs
ManagementApi GetAllRoles GET /v1/roles Get all roles.
ManagementApi GetApplication GET /v1/applications/{applicationId} Get Application
ManagementApi GetApplicationApiHealth GET /v1/applications/{applicationId}/health_report Get report of health of application API
ManagementApi GetApplicationCustomer GET /v1/applications/{applicationId}/customers/{customerId} Get Application Customer
ManagementApi GetApplicationCustomers GET /v1/applications/{applicationId}/customers List Application Customers
ManagementApi GetApplicationCustomersByAttributes POST /v1/application_customer_search Get a list of the customer profiles that match the given attributes
ManagementApi GetApplicationEventTypes GET /v1/applications/{applicationId}/event_types List Applications Event Types
ManagementApi GetApplicationEvents GET /v1/applications/{applicationId}/events List Applications Events
ManagementApi GetApplicationEventsWithoutTotalCount GET /v1/applications/{applicationId}/events/no_total List Applications Events
ManagementApi GetApplicationSession GET /v1/applications/{applicationId}/sessions/{sessionId} Get Application Session
ManagementApi GetApplicationSessions GET /v1/applications/{applicationId}/sessions List Application Sessions
ManagementApi GetApplications GET /v1/applications List Applications
ManagementApi GetAttribute GET /v1/attributes/{attributeId} Get a custom attribute
ManagementApi GetCampaign GET /v1/applications/{applicationId}/campaigns/{campaignId} Get a Campaign
ManagementApi GetCampaignAnalytics GET /v1/applications/{applicationId}/campaigns/{campaignId}/analytics Get analytics of campaigns
ManagementApi GetCampaignByAttributes POST /v1/applications/{applicationId}/campaigns_search Get a list of all campaigns that match the given attributes
ManagementApi GetCampaignSet GET /v1/applications/{applicationId}/campaign_set List CampaignSet
ManagementApi GetCampaigns GET /v1/applications/{applicationId}/campaigns List your Campaigns
ManagementApi GetChanges GET /v1/changes Get audit log for an account
ManagementApi GetCoupons GET /v1/applications/{applicationId}/campaigns/{campaignId}/coupons List Coupons
ManagementApi GetCouponsByAttributes POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search Get a list of the coupons that match the given attributes
ManagementApi GetCouponsByAttributesApplicationWide POST /v1/applications/{applicationId}/coupons_search Get a list of the coupons that match the given attributes in all active campaigns of an application
ManagementApi GetCouponsWithoutTotalCount GET /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/no_total List Coupons
ManagementApi GetCustomerActivityReport GET /v1/applications/{applicationId}/customer_activity_reports/{customerId} Get Activity Report for Single Customer
ManagementApi GetCustomerActivityReports GET /v1/applications/{applicationId}/customer_activity_reports Get Activity Reports for Application Customers
ManagementApi GetCustomerActivityReportsWithoutTotalCount GET /v1/applications/{applicationId}/customer_activity_reports/no_total Get Activity Reports for Application Customers
ManagementApi GetCustomerAnalytics GET /v1/applications/{applicationId}/customers/{customerId}/analytics Get Analytics Report for a Customer
ManagementApi GetCustomerProfile GET /v1/customers/{customerId} Get Customer Profile
ManagementApi GetCustomerProfiles GET /v1/customers/no_total List Customer Profiles
ManagementApi GetCustomersByAttributes POST /v1/customer_search/no_total Get a list of the customer profiles that match the given attributes
ManagementApi GetEventTypes GET /v1/event_types List Event Types
ManagementApi GetExports GET /v1/exports Get Exports
ManagementApi GetImports GET /v1/imports Get Imports
ManagementApi GetLoyaltyPoints GET /v1/loyalty_programs/{programID}/profile/{integrationID} get the Loyalty Ledger for this integrationID
ManagementApi GetLoyaltyProgram GET /v1/loyalty_programs/{programID} Get a loyalty program
ManagementApi GetLoyaltyPrograms GET /v1/loyalty_programs List all loyalty Programs
ManagementApi GetReferrals GET /v1/applications/{applicationId}/campaigns/{campaignId}/referrals List Referrals
ManagementApi GetReferralsWithoutTotalCount GET /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/no_total List Referrals
ManagementApi GetRole GET /v1/roles/{roleId} Get information for the specified role.
ManagementApi GetRuleset GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId} Get a Ruleset
ManagementApi GetRulesets GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets List Campaign Rulesets
ManagementApi GetUser GET /v1/users/{userId} Get a single User
ManagementApi GetUsers GET /v1/users List Users in your account
ManagementApi GetWebhook GET /v1/webhooks/{webhookId} Get Webhook
ManagementApi GetWebhookActivationLogs GET /v1/webhook_activation_logs List Webhook activation Log Entries
ManagementApi GetWebhookLogs GET /v1/webhook_logs List Webhook Log Entries
ManagementApi GetWebhooks GET /v1/webhooks List Webhooks
ManagementApi RefreshAnalytics POST /v1/refresh_analytics Trigger refresh on stale analytics.
ManagementApi RemoveLoyaltyPoints PUT /v1/loyalty_programs/{programID}/profile/{integrationID}/deduct_points Deduct points in a certain loyalty program for the specified customer
ManagementApi ResetPassword POST /v1/reset_password Reset password
ManagementApi SearchCouponsAdvanced POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search_advanced Get a list of the coupons that match the given attributes
ManagementApi SearchCouponsAdvancedApplicationWide POST /v1/applications/{applicationId}/coupons_search_advanced Get a list of the coupons that match the given attributes in all active campaigns of an application
ManagementApi SearchCouponsAdvancedApplicationWideWithoutTotalCount POST /v1/applications/{applicationId}/coupons_search_advanced/no_total Get a list of the coupons that match the given attributes in all active campaigns of an application
ManagementApi SearchCouponsAdvancedWithoutTotalCount POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search_advanced/no_total Get a list of the coupons that match the given attributes
ManagementApi SetAccountLimits PUT /v1/accounts/{accountId}/limits Set account limits
ManagementApi UpdateCampaign PUT /v1/applications/{applicationId}/campaigns/{campaignId} Update a Campaign
ManagementApi UpdateCampaignSet PUT /v1/applications/{applicationId}/campaign_set Update a Campaign Set
ManagementApi UpdateCoupon PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Update a Coupon
ManagementApi UpdateCouponBatch PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Update a Batch of Coupons
ManagementApi UpdateRuleset PUT /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId} Update a Ruleset

Documentation for Models

Documentation for Authorization

api_key_v1

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

integration_auth

  • Type: API key
  • API key parameter name: Content-Signature
  • Location: HTTP header

manager_auth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header