forked from Inventor22/FindyBot3000
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added base CommandResponse class for all specific responses
- Loading branch information
1 parent
6028fe5
commit 8b06c55
Showing
12 changed files
with
157 additions
and
96 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
13 changes: 13 additions & 0 deletions
13
FindyBot3000AzureFunction/FindyBot3000AzureFunction/DatabaseModels/TaggedItem.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,13 @@ | ||
| ||
|
||
namespace FindyBot3000.AzureFunction | ||
{ | ||
using System.Collections.Generic; | ||
|
||
public class TaggedItem : Item | ||
{ | ||
public int? TagsMatched { get; set; } | ||
|
||
public HashSet<string> Tags { get; set; } | ||
} | ||
} |
18 changes: 4 additions & 14 deletions
18
FindyBot3000AzureFunction/FindyBot3000AzureFunction/Responses/AddTagsResponse.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 |
---|---|---|
@@ -1,28 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
| ||
|
||
namespace FindyBot3000.AzureFunction | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
public class AddTagsResponse : ICommandCountResponse, ICommandFlagResponse, ICommandResponse | ||
public class AddTagsResponse : CommandResponse, ICommandCountResponse, ICommandFlagResponse | ||
{ | ||
public AddTagsResponse(bool success, int count) | ||
{ | ||
this.Command = Commands.AddTags; | ||
this.Success = success; | ||
this.Count = count; | ||
} | ||
|
||
public string Command => Commands.AddTags; | ||
|
||
|
||
public int Count { get; set; } | ||
|
||
public bool Success { get; set; } | ||
|
||
public string ToJsonString(bool indent = false) | ||
{ | ||
return JsonConvert.SerializeObject(this, indent ? Formatting.Indented : Formatting.None); | ||
} | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
FindyBot3000AzureFunction/FindyBot3000AzureFunction/Responses/CommandResponse.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,17 @@ | ||
| ||
|
||
|
||
namespace FindyBot3000.AzureFunction | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
public abstract class CommandResponse : ICommandResponse | ||
{ | ||
public string Command { get; protected set; } | ||
|
||
public string ToJsonString(bool indent = false) | ||
{ | ||
return JsonConvert.SerializeObject(this, indent ? Formatting.Indented : Formatting.None); | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.