Ticketmaster.Discovery 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ticketmaster.Discovery --version 2.0.1
NuGet\Install-Package Ticketmaster.Discovery -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ticketmaster.Discovery" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ticketmaster.Discovery --version 2.0.1
#r "nuget: Ticketmaster.Discovery, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ticketmaster.Discovery as a Cake Addin
#addin nuget:?package=Ticketmaster.Discovery&version=2.0.1

// Install Ticketmaster.Discovery as a Cake Tool
#tool nuget:?package=Ticketmaster.Discovery&version=2.0.1

Ticketmaster.Discovery

This project contains clients for Second version V2 of Ticketmaster Discovery API with base models for response.

Installetion

NuGet

You can install the last stable version of Ticketmaster.Discovery SDK using nuget.

PM> Install-Package Ticketmaster.Discovery

For more details about package please visit this.

Usage

Configuration

Usage of any client require <code>IClientConfig</code> to be implemented.

public interface IClientConfig
{
	// Your API Key like : 'K1uJLzJ5mdt3oBKNSzjcEEEzxHuJJXiX'
	string ConsumerKey { get; }

	/*The 'https://app.ticketmaster.com/discovery/'
	url to ticketmaster discovery api.*/
	string ApiRootUrl { get; }
}

This interface common for implementation for all clients in SDK. To simplify usage of this <code>IClientConfig</code> I already added implementation inside this package. Just use Config class.

var config = new Config("Your API Key");

Global API Clients

To Access Discovery API endpoints you can use instance of particular client:

  • IAttractionsClient → AttractionsClient;
  • IClassificationsClient → ClassificationsClient;
  • IEventsClient → EventsClient;
  • IVenuesClient → VenuesClient;

Just in case if we need to access some particular endpoint and don't want to create instances of all clients. Or we can use ClientFactory class to create global API access point DiscoveryApi class like this:

var config = new Config("Your API Key");
var factory = new ClientFactory();
var discovery = factory.Create<DiscoveryApi>(config);

Or simply create instance of DiscoveryApi class and call method .Configure(config).

var config = new Config("Your API Key");
var discovery = new DiscoveryApi().Configure(config);

Then we will be able to access all clients in this api. To access the endpoints for Events we can use Events Client like this:

discovery.Events.SearchEventsAsync(new SearchEventsRequest());
Events Client

The IEventsClient interface contains methods for Searching events and obtaining information about them. It has default implementation in EventsClient. The EventClient class has only one public constructor with two parameters

public EventsClient(IRestClient client, IClientConfig config)

All direct calls to API goings via IRestClient, that mean we have to set base URL for it from IClientConfig.

Basic creation of EventsClient
var client = new EventsClient(new RestClient(config.ApiRootUrl), config);
SearchEventsAsync Method

There are few methods what call "Event Search" endpoint in API. With different level of abstraction.

  • public Task<SearchEventsResponse> SearchEventsAsync(SearchEventsRequest request)
  • public Task<SearchEventsResponse> SearchEventsAsync(IApiRequest request)
  • public Task<IRestResponse> CallSearchEventsAsync(SearchEventsRequest request)
  • public Task<IRestResponse> CallSearchEventsAsync(IApiRequest request)

Preferable the first one.

For using SearchEventsAsync method you will need to create SearchEventsRequest. Which inherited from BaseQuery abstract class.

namespace Ticketmaster.Core
{
	using System.Collections.Generic;

	public abstract class BaseQuery<TK, T> : IApiRequest
	{
		/// <summary>
		/// The parameters dictionary.
		/// </summary>
		protected Dictionary<string, string> ParametersDictionary;

		protected BaseQuery()
		{
			ParametersDictionary = new Dictionary<string, string>();
		}

		/// <summary>
		/// Gets the query parameters.
		/// </summary>
		/// <value>
		/// The query parameters.
		/// </value>
		public IEnumerable<KeyValuePair<string, string>> QueryParameters => ParametersDictionary;

		/// <summary>
		/// Adds the query parameter.
		/// </summary>
		/// <param name="parameterName">Name of the parameter.</param>
		/// <param name="value">The value of the parameter.</param>
		/// <returns>This class instance.</returns>
		public abstract TK AddQueryParameter(T parameterName, string value);
	}
}

Because of this it's possible to add query parameters to request like described in Event Search.

All QueryParameters stored in enum:

namespace Ticketmaster.Discovery.V2.Models
{
	public enum SearchEventsQueryParameters
	{
		keyword = 1,
		attractionId = 2,
		venueId = 3,
		postalCode = 4,
		latlong = 5,
		radius = 6,
		unit = 7,
		source = 8,
		locale = 9,
		marketId = 10,
		startDateTime = 11,
		endDateTime = 12,
		includeTBA = 13,
		includeTBD = 14,
		includeTest = 15,
		size = 16,
		page = 17,
		sort = 18,
		onsaleStartDateTime = 19,
		onsaleEndDateTime = 20,
		city = 21,
		countryCode = 22,
		stateCode = 23,
		classificationName = 24,
		classificationId = 25,
		dmaId = 26,
		onsaleOnStartDate = 27,
		onsaleOnAfterStartDate = 28,
		segmentId = 29,
		segmentName = 30,
		promoterId = 31,
		clientVisibility = 32,
		nlp = 33,
		geoPoint = 34,
		includeLicensedContent = 35
	}
}

How to use search event?

 var request = new SearchEventsRequest();
 request.AddQueryParameter(SearchEventsQueryParameters.source, "ticketmaster");
 var result = await client.SearchEventsAsync(request);

GetEventDetailsAsync Method

There are few methods what call "Get Event Details" endpoint in API. With different level of abstraction.

  • public Task<Event> GetEventDetailsAsync(GetRequest request)
  • public Task<Event> GetEventDetailsAsync(IApiGetRequest request)
  • public Task<IRestResponse> CallGetEventDetailsAsync(GetRequest request)
  • public Task<IRestResponse> CallGetEventDetailsAsync(IApiGetRequest request)

Basic usage

var eventId = "G5diZfkn0B-bh";
var response = await cliet.CallGetEventDetailsAsync(new GetRequest(eventId));

For all another classes a methods please check source code : here


With any questions please contact <a href="mailto:serhiivoznyi@gmail.com?subject=Issue%20with%20Ticketmaster-sdk&">Me</a>

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.1 83 3/23/2024
3.0.0 283 6/5/2023
2.0.5 4,328 6/6/2021
2.0.4 2,671 5/11/2020
2.0.3 482 5/11/2020
2.0.2 12,154 6/22/2019
2.0.1 672 12/23/2018
2.0.0 934 7/16/2018
1.0.2 886 3/18/2018
1.0.1 1,157 1/23/2018

Added ClientFactory class to create global API access point DiscoveryApi class like this:

var config = new Config("Your API Key");
var factory = new ClientFactory();
var discovery = factory.Create<DiscoveryApi>(config);
Or simply create instance of DiscoveryApi class and call method .Configure(config).

var config = new Config("Your API Key");
var discovery = new DiscoveryApi().Configure(config);
Then we will be able to access all clients in this api. To access the endpoints for Events we can use Events Client like this:

discovery.Events.SearchEventsAsync(new SearchEventsRequest());