Ticketmaster.Discovery
2.0.0
See the version list below for details.
dotnet add package Ticketmaster.Discovery --version 2.0.0
NuGet\Install-Package Ticketmaster.Discovery -Version 2.0.0
<PackageReference Include="Ticketmaster.Discovery" Version="2.0.0" />
paket add Ticketmaster.Discovery --version 2.0.0
#r "nuget: Ticketmaster.Discovery, 2.0.0"
// Install Ticketmaster.Discovery as a Cake Addin #addin nuget:?package=Ticketmaster.Discovery&version=2.0.0 // Install Ticketmaster.Discovery as a Cake Tool #tool nuget:?package=Ticketmaster.Discovery&version=2.0.0
Ticketmaster.Discovery
This project contains clients for Second version V2 of Ticketmaster Discovery API with base models for response.
Installetion
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.
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 Me
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
- Ticketmaster.Core (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.