-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
partially implemented search functionality
- Loading branch information
Showing
16 changed files
with
207 additions
and
12 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using Close.Helpers; | ||
using Close.Models; | ||
using Close.Models; | ||
|
||
namespace Close; | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Close.Models; | ||
|
||
public class Condition | ||
{ | ||
[JsonPropertyName("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonPropertyName("values")] | ||
public List<string> Values { get; 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 |
---|---|---|
|
@@ -5,5 +5,9 @@ public enum EmailType | |
office, | ||
home, | ||
direct, | ||
work, | ||
fax, | ||
url, | ||
mobile, | ||
other | ||
} |
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,6 @@ | ||
namespace Close.Models.Enums; | ||
|
||
public enum FieldType | ||
{ | ||
regular_field | ||
} |
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,6 @@ | ||
namespace Close.Models.Enums; | ||
|
||
public enum Mode | ||
{ | ||
beginning_of_words | ||
} |
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 |
---|---|---|
|
@@ -7,5 +7,6 @@ public enum ObjectType | |
call, | ||
opportunity, | ||
sms, | ||
taskcompleted | ||
taskcompleted, | ||
custom_object, | ||
} |
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,12 @@ | ||
namespace Close.Models.Enums; | ||
|
||
public enum QueryType | ||
{ | ||
and, | ||
or, | ||
object_type, | ||
field_condition, | ||
has_related, | ||
text, | ||
match_all | ||
} |
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,16 @@ | ||
using System.Text.Json.Serialization; | ||
using Close.Models.Enums; | ||
|
||
namespace Close.Models; | ||
|
||
public class Field | ||
{ | ||
[JsonPropertyName("field_name")] | ||
public string FieldName { get; set; } | ||
|
||
[JsonPropertyName("object_type")] | ||
public ObjectType ObjectType { get; set; } | ||
|
||
[JsonPropertyName("type")] | ||
public FieldType Type { get; 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,44 @@ | ||
using System.Text.Json.Serialization; | ||
using Close.Models.Enums; | ||
|
||
namespace Close.Models; | ||
|
||
public abstract class Query | ||
{ | ||
[JsonPropertyName("negate")] | ||
public bool Negate { get; set; } = false; | ||
|
||
[JsonPropertyName("object_type")] | ||
public ObjectType? ObjectType { get; set; } = null; | ||
|
||
[JsonPropertyName("type")] | ||
public QueryType Type { get; set; } = QueryType.and; | ||
|
||
[JsonPropertyName("queries")] | ||
public List<Query> Queries { get; set; } = null; | ||
|
||
[JsonPropertyName("related_object_type")] | ||
public ObjectType? RelatedObjectType { get; set; } = null; | ||
|
||
[JsonPropertyName("related_query")] | ||
public Query RelatedQuery { get; set; } = null; | ||
|
||
[JsonPropertyName("this_object_type")] | ||
public ObjectType? ThisObjectType { get; set; } = null; | ||
|
||
[JsonPropertyName("condition")] | ||
public Condition Condition { get; set; } = null; | ||
|
||
[JsonPropertyName("field")] | ||
public Field Field { get; set; } = null; | ||
|
||
[JsonPropertyName("mode")] | ||
public Mode? Mode { get; set; } = null; | ||
|
||
[JsonPropertyName("value")] | ||
public string Value { get; set; } = null; | ||
} | ||
|
||
public class SearchQuery : Query | ||
{ | ||
} |
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,27 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Close.Models; | ||
|
||
public class SearchRequest | ||
{ | ||
[JsonPropertyName("query")] | ||
public Query Query { get; set; } | ||
|
||
[JsonPropertyName("results_limit")] | ||
public int? ResultsLimit { get; set; } = null; | ||
|
||
[JsonPropertyName("limit")] | ||
public int? Limit { get; set; } = null; | ||
|
||
[JsonPropertyName("sort")] | ||
public List<Sorting> Sort { get; set; } | ||
|
||
[JsonPropertyName("include_counts")] | ||
public bool IncludeCounts { get; set; } = true; | ||
|
||
[JsonPropertyName("cursor")] | ||
public string Cursor { get; set; } = null; | ||
|
||
[JsonPropertyName("_fields")] | ||
public Dictionary<string, string[]> Fields { get; 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,25 @@ | ||
using System.Text.Json.Serialization; | ||
using Close.Models.Interfaces; | ||
|
||
namespace Close.Models; | ||
|
||
public class SearchResults<T> : ICloseEntity where T : ICloseEntity | ||
{ | ||
[JsonPropertyName("data")] | ||
public List<T> Data { get; set; } | ||
|
||
[JsonPropertyName("count")] | ||
public Count Count { get; set; } | ||
|
||
[JsonPropertyName("cursor")] | ||
public string Cursor { get; set; } | ||
} | ||
|
||
public class Count | ||
{ | ||
[JsonPropertyName("limited")] | ||
public int Limited { get; set; } | ||
|
||
[JsonPropertyName("total")] | ||
public int Total { get; 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,12 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Close.Models; | ||
|
||
public class Sorting | ||
{ | ||
[JsonPropertyName("direction")] | ||
public string Direction { get; set; } | ||
|
||
[JsonPropertyName("field")] | ||
public Field Field { get; set; } | ||
} |