瀏覽代碼

mock the registration endpoint since livetv etc. still uses it

Claus Vium 6 年之前
父節點
當前提交
4a03ac4022
共有 1 個文件被更改,包括 30 次插入2 次删除
  1. 30 2
      MediaBrowser.Api/PluginService.cs

+ 30 - 2
MediaBrowser.Api/PluginService.cs

@@ -76,7 +76,22 @@ namespace MediaBrowser.Api
         public Stream RequestStream { get; set; }
         public Stream RequestStream { get; set; }
     }
     }
 
 
-
+    [Route("/Registrations/{Name}", "GET", Summary = "Gets registration status for a feature", IsHidden = true)]
+    [Authenticated]
+    public class GetRegistration : IReturn<RegistrationInfo>
+    {
+        [ApiMember(Name = "Name", Description = "Feature Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
+        public string Name { get; set; }
+    }
+	
+    public class RegistrationInfo
+    {
+        public string Name { get; set; }
+        public DateTime ExpirationDate { get; set; }
+        public bool IsTrial { get; set; }
+        public bool IsRegistered { get; set; }
+    }
+    
     /// <summary>
     /// <summary>
     /// Class PluginsService
     /// Class PluginsService
     /// </summary>
     /// </summary>
@@ -109,7 +124,20 @@ namespace MediaBrowser.Api
             _deviceManager = deviceManager;
             _deviceManager = deviceManager;
             _jsonSerializer = jsonSerializer;
             _jsonSerializer = jsonSerializer;
         }
         }
-
+        
+        
+        public async Task<object> Get(GetRegistration request)
+        {	
+            var info = new RegistrationInfo
+            {
+                ExpirationDate = DateTime.Now.AddYears(100),
+                IsRegistered = true,
+                IsTrial = false,
+                Name = request.Name
+            };
+	
+            return ToOptimizedResult(info);
+        }
 
 
         /// <summary>
         /// <summary>
         /// Gets the specified request.
         /// Gets the specified request.