aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/TestService.cs
blob: 5340b816cfd81c7e7f42c829c096721f8286fb0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;

namespace MediaBrowser.Api
{
    [Route("/Test/String", "GET")]
    public class GetString
    {
    }

    [Route("/Test/OptimizedString", "GET")]
    public class GetOptimizedString
    {
    }

    [Route("/Test/Bytes", "GET")]
    public class GetBytes
    {
    }

    [Route("/Test/OptimizedBytes", "GET")]
    public class GetOptimizedBytes
    {
    }

    [Route("/Test/Stream", "GET")]
    public class GetStream
    {
    }

    [Route("/Test/OptimizedStream", "GET")]
    public class GetOptimizedStream
    {
    }

    [Route("/Test/BytesWithContentType", "GET")]
    public class GetBytesWithContentType
    {
    }

    public class TestService : BaseApiService
    {
        public object Get(GetString request)
        {
            return "Welcome to Emby!";
        }
        public object Get(GetOptimizedString request)
        {
            return ToOptimizedResult("Welcome to Emby!");
        }
        public object Get(GetBytes request)
        {
            return Encoding.UTF8.GetBytes("Welcome to Emby!");
        }
        public object Get(GetOptimizedBytes request)
        {
            return ToOptimizedResult(Encoding.UTF8.GetBytes("Welcome to Emby!"));
        }
        public object Get(GetBytesWithContentType request)
        {
            return ApiEntryPoint.Instance.ResultFactory.GetResult(Encoding.UTF8.GetBytes("Welcome to Emby!"), "text/html");
        }
        public object Get(GetStream request)
        {
            return new MemoryStream(Encoding.UTF8.GetBytes("Welcome to Emby!"));
        }
        public object Get(GetOptimizedStream request)
        {
            return ToOptimizedResult(new MemoryStream(Encoding.UTF8.GetBytes("Welcome to Emby!")));
        }
    }
}