more updates for api docs

This commit is contained in:
LukePulverenti 2013-03-08 16:06:02 -05:00
parent 9ffb44244c
commit 34cc4eee9d
4 changed files with 37 additions and 35 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using ServiceStack.ServiceHost;
namespace MediaBrowser.Api.Images
{
@ -10,28 +11,39 @@ namespace MediaBrowser.Api.Images
/// <summary>
/// The max width
/// </summary>
[ApiMember(Name = "MaxWidth", Description = "The maximum image width to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MaxWidth { get; set; }
/// <summary>
/// The max height
/// </summary>
[ApiMember(Name = "MaxHeight", Description = "The maximum image height to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MaxHeight { get; set; }
/// <summary>
/// The width
/// </summary>
[ApiMember(Name = "Width", Description = "The fixed image width to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Width { get; set; }
/// <summary>
/// The height
/// </summary>
[ApiMember(Name = "Height", Description = "The fixed image height to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Height { get; set; }
/// <summary>
/// Gets or sets the quality.
/// </summary>
/// <value>The quality.</value>
[ApiMember(Name = "Quality", Description = "Optional quality setting, from 0-100. Defaults to 90 and should suffice in most cases.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Quality { get; set; }
/// <summary>
/// Gets or sets the tag.
/// </summary>
/// <value>The tag.</value>
[ApiMember(Name = "Tag", Description = "Optional. Supply the cache tag from the item object to receive strong caching headers.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Tag { get; set; }
}
@ -44,11 +56,18 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
[ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
[ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
[ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public ImageType Type { get; set; }
/// <summary>
/// Gets or sets the index.
/// </summary>
/// <value>The index.</value>
[ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
[ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
[ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "DELETE")]
public int? Index { get; set; }
}
}

View File

@ -28,6 +28,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
@ -43,6 +44,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[ApiMember(Name = "Name", Description = "Person name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@ -58,6 +60,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[ApiMember(Name = "Name", Description = "Studio name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@ -73,6 +76,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@ -88,6 +92,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the year.
/// </summary>
/// <value>The year.</value>
[ApiMember(Name = "Year", Description = "Year", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "GET")]
public int Year { get; set; }
}
@ -103,6 +108,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public Guid Id { get; set; }
}
@ -118,6 +124,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; }
}
@ -130,6 +137,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; }
/// <summary>
@ -316,8 +324,7 @@ namespace MediaBrowser.Api.Images
Item = item,
Request = request,
CropWhiteSpace = request.Type == ImageType.Logo || request.Type == ImageType.Art,
OriginalImageDateModified = originalFileImageDateModified,
ContentType = contentType
OriginalImageDateModified = originalFileImageDateModified
}, contentType);
}

View File

@ -1,9 +1,7 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using ServiceStack.Service;
using ServiceStack.ServiceHost;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
@ -12,7 +10,7 @@ namespace MediaBrowser.Api.Images
/// <summary>
/// Class ImageWriter
/// </summary>
public class ImageWriter : IStreamWriter, IHasOptions
public class ImageWriter : IStreamWriter
{
/// <summary>
/// Gets or sets the request.
@ -33,11 +31,6 @@ namespace MediaBrowser.Api.Images
/// The original image date modified
/// </summary>
public DateTime OriginalImageDateModified;
/// <summary>
/// Gets or sets the type of the content.
/// </summary>
/// <value>The type of the content.</value>
public string ContentType { get; set; }
/// <summary>
/// Writes to.
@ -45,8 +38,6 @@ namespace MediaBrowser.Api.Images
/// <param name="responseStream">The response stream.</param>
public void WriteTo(Stream responseStream)
{
Options["Content-Type"] = ContentType;
var task = WriteToAsync(responseStream);
Task.WaitAll(task);
@ -63,18 +54,5 @@ namespace MediaBrowser.Api.Images
OriginalImageDateModified, responseStream, Request.Width, Request.Height, Request.MaxWidth,
Request.MaxHeight, Request.Quality);
}
/// <summary>
/// The _options
/// </summary>
private readonly IDictionary<string, string> _options = new Dictionary<string, string> { };
/// <summary>
/// Gets the options.
/// </summary>
/// <value>The options.</value>
public IDictionary<string, string> Options
{
get { return _options; }
}
}
}

View File

@ -83,7 +83,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var key = cacheKey.ToString("N");
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, string.Empty);
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@ -117,9 +117,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw new ArgumentNullException("factoryFn");
}
Response.ContentType = contentType;
var key = cacheKey.ToString("N");
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, contentType);
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@ -183,7 +185,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var key = cacheKey.ToString("N");
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, contentType);
Response.ContentType = contentType;
var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@ -278,9 +282,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="cacheKeyString">The cache key string.</param>
/// <param name="lastDateModified">The last date modified.</param>
/// <param name="cacheDuration">Duration of the cache.</param>
/// <param name="contentType">Type of the content.</param>
/// <returns>System.Object.</returns>
private object PreProcessCachedResult(Guid cacheKey, string cacheKeyString, DateTime? lastDateModified, TimeSpan? cacheDuration, string contentType)
private object PreProcessCachedResult(Guid cacheKey, string cacheKeyString, DateTime? lastDateModified, TimeSpan? cacheDuration)
{
Response.AddHeader("ETag", cacheKeyString);
@ -290,11 +293,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
AddExpiresHeader(cacheKeyString, cacheDuration);
//ctx.Response.SendChunked = false;
if (!string.IsNullOrEmpty(contentType))
{
Response.ContentType = contentType;
}
Response.StatusCode = 304;
return new byte[]{};