-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ReikanYsora/feature/run_pipeline
feat: Add GetPipelinesList method
- Loading branch information
Showing
5 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace HassClient.Models | ||
{ | ||
/// <summary> | ||
/// Defines information related with a Home Assistant 'Assist Pipeline' definition. | ||
/// </summary> | ||
public class PipelineInfo | ||
{ | ||
/// <summary> | ||
/// Gets the pipeline conversation engine. | ||
/// </summary> | ||
[JsonProperty("conversation_engine")] | ||
public string ConversationEngine { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the pipeline conversation defined language. | ||
/// </summary> | ||
[JsonProperty("conversation_language")] | ||
public string ConversationLanguage { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the pipeline defined language. | ||
/// </summary> | ||
[JsonProperty("language")] | ||
public string Language { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the pipeline name. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the SpeechToText engine. | ||
/// </summary> | ||
[JsonProperty("stt_engine")] | ||
public string STTEngine { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the SpeechToText defined language. | ||
/// </summary> | ||
[JsonProperty("stt_language")] | ||
public string STTLanguage { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the TextToSpeach engine. | ||
/// </summary> | ||
[JsonProperty("tts_engine")] | ||
public string TTSEngine { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the TextToSpeach defined language. | ||
/// </summary> | ||
[JsonProperty("tts_language")] | ||
public string TTSLanguage { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the name of TextToSpeach defined voice. | ||
/// </summary> | ||
[JsonProperty("tts_voice")] | ||
public string TTSVoice { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the name of pipeline id. | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string ID { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace HassClient.Models | ||
{ | ||
/// <summary> | ||
/// Defines information related with Home Assistant list of 'Assist Pipeline' definitions. | ||
/// </summary> | ||
public class PipelineList | ||
{ | ||
/// <summary> | ||
/// Gets all defined 'Assist Pipelines' definitions. | ||
/// </summary>[SerializeField] | ||
[JsonProperty("pipelines")] | ||
public List<PipelineInfo> Pipelines { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the preferred defined Assist Pipeline. | ||
/// </summary>[SerializeField] | ||
[JsonProperty("preferred_pipeline")] | ||
public string PreferredPipeline; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using HassClient.Models; | ||
using NUnit.Framework; | ||
using System.Threading.Tasks; | ||
|
||
namespace HassClient.WS.Tests | ||
{ | ||
public class PipelinesApiTests : BaseHassWSApiTest | ||
{ | ||
private PipelineList pipelines; | ||
|
||
[OneTimeSetUp] | ||
[Test] | ||
public async Task GetPipelines() | ||
{ | ||
if (this.pipelines != null) | ||
{ | ||
return; | ||
} | ||
|
||
this.pipelines = await this.hassWSApi.GetPipelinesListAsync(); | ||
|
||
Assert.IsNotNull(this.pipelines); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/HassClient.WS/Messages/Commands/Pipeline/PipelineListMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace HassClient.WS.Messages | ||
{ | ||
internal class PipelineListMessage : BaseOutgoingMessage | ||
{ | ||
public PipelineListMessage() | ||
: base("assist_pipeline/pipeline/list") | ||
{ | ||
} | ||
} | ||
} |