/// <summary> /// Creates a ByTitleRequest used to obtain information regarding a Movie, TV Series, or TV Series Episode by specifying its exact title. /// </summary> /// <param name="title">The exact title of the item to be searched for.</param> /// <param name="videoType">>Apply a filter for the video type (movie, tv series, episode).</param> /// <param name="year">Apply a filter for the year of release.</param> /// <param name="plotSize">Specify whether you want a short plot summary of a full-length plot summary in the response. Default is a short plot summary.</param> public ByTitleRequest(string title, VideoType?videoType = null, uint?year = null, PlotSize plotSize = PlotSize.Short) { Title = title; VideoType = videoType; Year = year; PlotSize = plotSize; }
/// <summary> /// Creates a ByTitleRequest used to obtain information regarding TV Series Season or TV Series Episode, by specifying its exact title and season number. /// </summary> /// <param name="title">The exact title of the TV Series Season or TV Series Episode to be searched for.</param> /// <param name="season">The season number of the TV Series Season or TV Series Episode.</param> /// <param name="episode">Not specifying a specific episode number will return information about all episodes in the season.</param> /// <param name="year">Apply a filter for the year of release.</param> /// <param name="plotSize">Specify whether you want a short plot summary of a full-length plot summary in the response. Default is a short plot summary.</param> public ByTitleRequest(string title, uint season, uint?episode = null, uint?year = null, PlotSize plotSize = PlotSize.Short) { Title = title; VideoType = Models.VideoType.Series; Season = season; Episode = episode; Year = year; PlotSize = PlotSize; }
public MovieInput(string title, int year, PlotSize plotSize) { Title = title; Year = year; PlotSize = plotSize; }
/// <summary> /// Creates a ByIDRequest used for obtaining an item by its IMDB (International Movie Database) ID. /// </summary> /// <param name="imdb_id">The unique ID of the item used by the International Movie Database.</param> /// <param name="plotSize">Specify whether you want a short plot summary of a full-length plot summary in the response. Default is a short plot summary.</param> public ByIDRequest(string imdb_id, PlotSize plotSize = PlotSize.Short) { IMDB_ID = imdb_id; PlotSize = plotSize; }
public async Task <ActionResult <Movie> > GetAsync([FromHeader(Name = "apikey")][Required] string apiKey, [FromQuery(Name = "title")][Required] string title, [FromQuery(Name = "year")] int year, [FromQuery(Name = "plotsize")] PlotSize plotSize) { MovieInput movieInput = new MovieInput(title, year, plotSize); try { var movieRequest = await _movieRequest.GetMovieAsync(apiKey, movieInput); return(movieRequest); } catch (HttpRequestException) { return(new ContentResult { Content = "Unable to connect to OMDB", ContentType = "text/plain", StatusCode = 400 }); } catch (Exception e) { return(new ContentResult { Content = e.Message, ContentType = "text/plain", StatusCode = 500 }); } }