docs(api): document channel state endpoint
This commit is contained in:
@@ -41,6 +41,39 @@ public class OpenApiErrorResponseContractTests
|
||||
schema.TryGetProperty("categories", out _).ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Static_OpenApi_Should_Document_Channel_State_Response()
|
||||
{
|
||||
using JsonDocument document = JsonDocument.Parse(File.ReadAllText(FindOpenApiDocument()));
|
||||
|
||||
JsonElement getState = document.RootElement
|
||||
.GetProperty("paths")
|
||||
.GetProperty("/api/channels/state")
|
||||
.GetProperty("get");
|
||||
|
||||
JsonElement schema = getState
|
||||
.GetProperty("responses")
|
||||
.GetProperty("200")
|
||||
.GetProperty("content")
|
||||
.GetProperty("application/json")
|
||||
.GetProperty("schema");
|
||||
|
||||
schema.GetProperty("type").GetString().ShouldBe("array");
|
||||
schema.GetProperty("items").GetProperty("$ref").GetString()
|
||||
.ShouldBe("#/components/schemas/ChannelStateResponseModel");
|
||||
|
||||
JsonElement stateProperties = document.RootElement
|
||||
.GetProperty("components")
|
||||
.GetProperty("schemas")
|
||||
.GetProperty("ChannelStateResponseModel")
|
||||
.GetProperty("properties");
|
||||
|
||||
stateProperties.TryGetProperty("channelId", out _).ShouldBeTrue();
|
||||
stateProperties.TryGetProperty("channelNumber", out _).ShouldBeTrue();
|
||||
stateProperties.TryGetProperty("onAir", out _).ShouldBeTrue();
|
||||
stateProperties.TryGetProperty("nowPlaying", out _).ShouldBeTrue();
|
||||
}
|
||||
|
||||
[TestCase("/api/channels/{id}", "get", "404")]
|
||||
[TestCase("/api/channels", "post", "404")]
|
||||
[TestCase("/api/channels", "post", "422")]
|
||||
|
||||
@@ -136,6 +136,45 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/channels/state": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Channels"
|
||||
],
|
||||
"summary": "Get channel runtime state",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ChannelStateResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ChannelStateResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ChannelStateResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/channels/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -3387,6 +3426,30 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ChannelNowPlayingResponseModel": {
|
||||
"required": [
|
||||
"title",
|
||||
"startUtc",
|
||||
"finishUtc"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"startUtc": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"finishUtc": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ChannelPlayoutMode": {
|
||||
"enum": [
|
||||
"Continuous",
|
||||
@@ -3482,6 +3545,33 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ChannelStateResponseModel": {
|
||||
"required": [
|
||||
"channelId",
|
||||
"channelNumber",
|
||||
"onAir",
|
||||
"nowPlaying"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channelId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"channelNumber": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"onAir": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"nowPlaying": {
|
||||
"$ref": "#/components/schemas/ChannelNowPlayingResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ChannelStreamSelectorMode": {
|
||||
"enum": [
|
||||
"Default",
|
||||
|
||||
Reference in New Issue
Block a user