Ticketmaster.Discovery 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ticketmaster.Discovery --version 1.0.2                
NuGet\Install-Package Ticketmaster.Discovery -Version 1.0.2                
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="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ticketmaster.Discovery --version 1.0.2                
#r "nuget: Ticketmaster.Discovery, 1.0.2"                
#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=1.0.2

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

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 Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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 923 3/23/2024
3.0.0 322 6/5/2023
2.0.5 4,550 6/6/2021
2.0.4 2,696 5/11/2020
2.0.3 504 5/11/2020
2.0.2 12,186 6/22/2019
2.0.1 698 12/23/2018
2.0.0 959 7/16/2018
1.0.2 913 3/18/2018
1.0.1 1,192 1/23/2018

Added methods to work with Segments, Genre, and Subgenre.
IMPORTANT: Please give me a feedback about this package in any way you like.
you can write me an email or left any message.
serhiivoznyi@gmail.com
https://www.linkedin.com/in/serhii-voznyi/
https://www.facebook.com/voznyiserhii