-
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.
Updated entities based on latest GraphQL schema (2023-05-20)
- Loading branch information
1 parent
7ef809b
commit e3f5fa2
Showing
8 changed files
with
266 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,22 @@ | ||
namespace Sdk4me.GraphQL.Tests | ||
{ | ||
[TestClass] | ||
public class SyncSetTest | ||
{ | ||
private readonly Sdk4meClient client = Client.Get(); | ||
|
||
[TestMethod] | ||
public void Get() | ||
{ | ||
DataList<SyncSet> syncSets = client.Get(Query.SyncSet | ||
.View(DefaultView.None) | ||
.SelectAll() | ||
.SelectDescriptionAttachments(new AttachmentQuery() | ||
.SelectAll()) | ||
).Result; | ||
|
||
Assert.IsNotNull(syncSets); | ||
Console.WriteLine($"Count: {syncSets.Count}"); | ||
} | ||
} | ||
} |
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,50 @@ | ||
using System.Diagnostics; | ||
|
||
namespace Sdk4me.GraphQL | ||
{ | ||
/// <summary> | ||
/// The <see href="https://developer.4me.com/graphql/object/snapshot/">Snapshot</see> object. | ||
/// </summary> | ||
[Sdk4meEntity(ignoreIdentifier: true)] | ||
public class Snapshot : Node | ||
{ | ||
/// <summary> | ||
/// The display debugger value. | ||
/// </summary> | ||
[DebuggerBrowsable(DebuggerBrowsableState.Never)] | ||
internal override string? DebuggerValue | ||
{ | ||
get => ToString(); | ||
} | ||
|
||
/// <summary> | ||
/// The unique identifier used by <see cref="DataList{T}"/>. | ||
/// </summary> | ||
[DebuggerBrowsable(DebuggerBrowsableState.Never)] | ||
internal override string UniqueIdentifier | ||
{ | ||
get => GetHashCode().ToString(); | ||
} | ||
|
||
/// <summary> | ||
/// Expiring link to the snapshot content. | ||
/// </summary> | ||
[JsonProperty("downloadUrl")] | ||
public string? DownloadUrl { get; internal set; } | ||
|
||
/// <summary> | ||
/// Time at which snapshot was taken. | ||
/// </summary> | ||
[JsonProperty("startedAt")] | ||
public DateTime? StartedAt { get; internal set; } | ||
|
||
internal override HashSet<QueryPageInfo> GetQueryPageInfo(string fieldName, int depth) | ||
{ | ||
return new HashSet<QueryPageInfo>(); | ||
} | ||
|
||
internal override void AddToCollection(object data) | ||
{ | ||
} | ||
} | ||
} |
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,73 @@ | ||
namespace Sdk4me.GraphQL | ||
{ | ||
/// <summary> | ||
/// The <see href="https://developer.4me.com/graphql/object/syncset/">SyncSet</see> object. | ||
/// </summary> | ||
public class SyncSet : Node | ||
{ | ||
/// <summary> | ||
/// The account this record belongs to. | ||
/// </summary> | ||
[JsonProperty("account")] | ||
public Account? Account { get; internal set; } | ||
|
||
/// <summary> | ||
/// The date and time at which the record was created. | ||
/// </summary> | ||
[JsonProperty("createdAt")] | ||
public DateTime? CreatedAt { get; internal set; } | ||
|
||
/// <summary> | ||
/// Description of the sync set. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string? Description { get; internal set; } | ||
|
||
[JsonProperty("descriptionAttachments")] | ||
internal NodeCollection<Attachment>? DescriptionAttachmentsCollection { get; set; } | ||
|
||
/// <summary> | ||
/// Files and inline images linked to the <c>description</c> field. | ||
/// </summary> | ||
public DataList<Attachment>? DescriptionAttachments | ||
{ | ||
get => DescriptionAttachmentsCollection?.Data; | ||
} | ||
|
||
/// <summary> | ||
/// The latest completed snapshot of this sync set. | ||
/// </summary> | ||
[JsonProperty("lastSnapshot")] | ||
public Snapshot? LastSnapshot { get; internal set; } | ||
|
||
/// <summary> | ||
/// The name of the sync set. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string? Name { get; internal set; } | ||
|
||
/// <summary> | ||
/// Record types included in the sync set. The types match the values supported for the <see href="https://developer.4me.com/v1/import/#parameters"><c>type</c> parameter of CSV import</see>. | ||
/// </summary> | ||
[JsonProperty("types")] | ||
public List<string>? Types { get; internal set; } | ||
|
||
/// <summary> | ||
/// The date and time of the last update of the record. If the record has no updates it contains the <c>createdAt</c> value. | ||
/// </summary> | ||
[JsonProperty("updatedAt")] | ||
public DateTime? UpdatedAt { get; internal set; } | ||
|
||
internal override HashSet<QueryPageInfo> GetQueryPageInfo(string fieldName, int depth) | ||
{ | ||
HashSet<QueryPageInfo> retval = new(); | ||
retval.AddRange(DescriptionAttachmentsCollection?.GetQueryPageInfo("descriptionAttachments", depth + 1)); | ||
return retval; | ||
} | ||
|
||
internal override void AddToCollection(object data) | ||
{ | ||
DescriptionAttachments?.AddRange((data as SyncSet)?.DescriptionAttachments); | ||
} | ||
} | ||
} |
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,25 @@ | ||
namespace Sdk4me.GraphQL | ||
{ | ||
/// <summary> | ||
/// Root connection for retrieving SyncSet records. | ||
/// </summary> | ||
public class SyncSetQuery : Query<SyncSetQuery, SyncSetField, DefaultView, DefaultOrderField> | ||
{ | ||
/// <summary> | ||
/// Initialize a new sync set query instance. | ||
/// </summary> | ||
public SyncSetQuery() | ||
: base("syncSets", typeof(SyncSet), true) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Files and inline images linked to the <c>description</c> field. | ||
/// </summary> | ||
public SyncSetQuery SelectDescriptionAttachments(AttachmentQuery query) | ||
{ | ||
query.FieldName = "descriptionAttachments"; | ||
return Select(query); | ||
} | ||
} | ||
} |