From e06ee5f78dc67c8efb68e6a0deeff4ae72c3d699 Mon Sep 17 00:00:00 2001 From: Klaas Vandeweerdt Date: Mon, 10 Apr 2023 03:24:41 +0200 Subject: [PATCH] Updated entities based on latest GraphQL schema (2023-04-08) --- .../KnowledgeArticleTemplateTest.cs | 22 +++++ .../KnowledgeArticleTest.cs | 2 + Scr/Sdk4me.GraphQL.Tests/NoteTest.cs | 2 +- .../Entities/KnowledgeArticle.cs | 27 +++++- .../Entities/KnowledgeArticleCreateInput.cs | 67 +++++++++++---- .../Entities/KnowledgeArticleTemplate.cs | 85 +++++++++++++++++++ .../Entities/KnowledgeArticleUpdateInput.cs | 67 +++++++++++---- Scr/Sdk4me.GraphQL/Enumerators/Enumerators.cs | 5 ++ .../Enumerators/FieldEnumerators.cs | 77 +++++++++++++++++ .../Enumerators/OrderByEnumerators.cs | 32 +++++++ .../Enumerators/ViewEnumerators.cs | 17 ++++ .../Extensions/Sdk4meClientQueryExtension.cs | 12 +++ .../Queries/KnowledgeArticleQuery.cs | 48 ++++++++++- .../Queries/KnowledgeArticleTemplateQuery.cs | 25 ++++++ Scr/Sdk4me.GraphQL/Queries/Queries.cs | 5 ++ 15 files changed, 456 insertions(+), 37 deletions(-) create mode 100644 Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTemplateTest.cs create mode 100644 Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleTemplate.cs create mode 100644 Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleTemplateQuery.cs diff --git a/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTemplateTest.cs b/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTemplateTest.cs new file mode 100644 index 0000000..63b050b --- /dev/null +++ b/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTemplateTest.cs @@ -0,0 +1,22 @@ +namespace Sdk4me.GraphQL.Tests +{ + [TestClass] + public class KnowledgeArticleTemplateTest + { + private readonly Sdk4meClient client = Client.Get(); + + [TestMethod] + public void Get() + { + DataList knowledgeArticleTemplates = client.Get(Query.KnowledgeArticleTemplate + .View(KnowledgeArticleTemplateView.All) + .SelectAll() + .SelectServiceInstances(new ServiceInstanceQuery() + .SelectAll()) + ).Result; + + Assert.IsNotNull(knowledgeArticleTemplates); + Console.WriteLine($"Count: {knowledgeArticleTemplates.Count}"); + } + } +} diff --git a/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTest.cs b/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTest.cs index 4388ab5..24136f8 100644 --- a/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTest.cs +++ b/Scr/Sdk4me.GraphQL.Tests/KnowledgeArticleTest.cs @@ -11,6 +11,8 @@ public void Get() DataList knowledgeArticles = client.Get(Query.KnowledgeArticle .View(KnowledgeArticleView.All) .SelectAll() + .SelectCustomFieldsAttachments(new AttachmentQuery() + .SelectAll()) .SelectDescriptionAttachments(new AttachmentQuery() .SelectAll()) .SelectInstructionsAttachments(new AttachmentQuery() diff --git a/Scr/Sdk4me.GraphQL.Tests/NoteTest.cs b/Scr/Sdk4me.GraphQL.Tests/NoteTest.cs index 91f31fc..155e589 100644 --- a/Scr/Sdk4me.GraphQL.Tests/NoteTest.cs +++ b/Scr/Sdk4me.GraphQL.Tests/NoteTest.cs @@ -12,7 +12,7 @@ public void AddNote() { Text = "Hello World !!!", Internal = true, - OwnerId = "NG1lMjQuMjMwMzE5MjI1MDU5QDRtZS1kZW1vLmNvbS9SZXEvNzA1MzE" + OwnerId = "NG1lMjQuMjMwNDEwMDAyODU3QDRtZS1kZW1vLmNvbS9SZXEvNzA1MzE" } ).Result; diff --git a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticle.cs b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticle.cs index 916002f..2f16116 100644 --- a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticle.cs +++ b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticle.cs @@ -35,6 +35,23 @@ public class KnowledgeArticle : Node [JsonProperty("createdBy")] public Person? CreatedBy { get; internal set; } + /// + /// Values of custom fields. + /// + [JsonProperty("customFields")] + public CustomFieldCollection? CustomFields { get; internal set; } + + [JsonProperty("customFieldsAttachments")] + internal NodeCollection? CustomFieldsAttachmentsCollection { get; set; } + + /// + /// Inline images linked to one of the custom fields. + /// + public DataList? CustomFieldsAttachments + { + get => CustomFieldsAttachmentsCollection?.Data; + } + /// /// Describes the situation and/or environment in which the instructions of the knowledge article may be helpful. /// @@ -120,7 +137,7 @@ public DataList? Requests internal NodeCollection? ServiceInstancesCollection { get; set; } /// - /// Services linked to this knowledge article. + /// Service instances linked to this knowledge article. /// public DataList? ServiceInstances { @@ -151,6 +168,12 @@ public DataList? ServiceInstances [JsonProperty("subject"), Sdk4meField(true)] public string? Subject { get; internal set; } + /// + /// The knowledge article template that this knowledge article is based on. + /// + [JsonProperty("template")] + public KnowledgeArticleTemplate? Template { get; internal set; } + [JsonProperty("translations")] internal NodeCollection? TranslationsCollection { get; set; } @@ -177,6 +200,7 @@ public DataList? Translations internal override HashSet GetQueryPageInfo(string fieldName, int depth) { HashSet retval = new(); + retval.AddRange(CustomFieldsAttachmentsCollection?.GetQueryPageInfo("customFieldsAttachments", depth + 1)); retval.AddRange(DescriptionAttachmentsCollection?.GetQueryPageInfo("descriptionAttachments", depth + 1)); retval.AddRange(InstructionsAttachmentsCollection?.GetQueryPageInfo("instructionsAttachments", depth + 1)); retval.AddRange(RequestsCollection?.GetQueryPageInfo("requests", depth + 1)); @@ -187,6 +211,7 @@ internal override HashSet GetQueryPageInfo(string fieldName, int internal override void AddToCollection(object data) { + CustomFieldsAttachments?.AddRange((data as KnowledgeArticle)?.CustomFieldsAttachments); DescriptionAttachments?.AddRange((data as KnowledgeArticle)?.DescriptionAttachments); InstructionsAttachments?.AddRange((data as KnowledgeArticle)?.InstructionsAttachments); Requests?.AddRange((data as KnowledgeArticle)?.Requests); diff --git a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleCreateInput.cs b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleCreateInput.cs index 874e5c8..17d516d 100644 --- a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleCreateInput.cs +++ b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleCreateInput.cs @@ -7,6 +7,9 @@ public class KnowledgeArticleCreateInput : PropertyChangeSet { private string? source; private string? sourceID; + private CustomFieldCollection? customFields; + private List? customFieldsAttachments; + private DateOnly? archiveDate; private bool? coveredSpecialists; private string? createdById; private string? description; @@ -17,10 +20,10 @@ public class KnowledgeArticleCreateInput : PropertyChangeSet private bool? keyContacts; private string? keywords; private string? serviceId; + private List? serviceInstanceIds; private KnowledgeArticleStatus? status; private string? subject; - private DateOnly? archiveDate; - private List? serviceInstanceIds; + private string? templateId; private string? clientMutationId; /// @@ -43,6 +46,36 @@ public string? SourceID set => sourceID = Set("sourceID", value); } + /// + /// Values for custom fields to be used by the UI Extension that is linked to the record. + /// + [JsonProperty("customFields")] + public CustomFieldCollection? CustomFields + { + get => customFields; + set => customFields = Set("customFields", value); + } + + /// + /// The attachments used in the custom fields' values. + /// + [JsonProperty("customFieldsAttachments")] + public List? CustomFieldsAttachments + { + get => customFieldsAttachments; + set => customFieldsAttachments = Set("customFieldsAttachments", value); + } + + /// + /// The date until which the knowledge article will be active. The knowledge article will be archived at the beginning of this day. When the knowledge article is archived, its status will automatically be set to "Archived". + /// + [JsonProperty("archiveDate")] + public DateOnly? ArchiveDate + { + get => archiveDate; + set => archiveDate = Set("archiveDate", value); + } + /// /// Whether the knowledge article needs to be available to the people who are a member of the support team of one of the service instances that are selected in the Coverage section of an active SLA for the service that is linked to the article. /// @@ -143,6 +176,16 @@ public string? ServiceId set => serviceId = Set("serviceId", value); } + /// + /// Identifiers of service instances linked to this knowledge article. + /// + [JsonProperty("serviceInstanceIds")] + public List? ServiceInstanceIds + { + get => serviceInstanceIds; + set => serviceInstanceIds = Set("serviceInstanceIds", value); + } + /// /// The current status of the knowledge article. /// @@ -164,23 +207,13 @@ public string? Subject } /// - /// The date until which the knowledge article will be active. The knowledge article will be archived at the beginning of this day. When the knowledge article is archived, its status will automatically be set to "Archived". + /// Identifier of the knowledge article template that this knowledge article is based on. /// - [JsonProperty("archiveDate")] - public DateOnly? ArchiveDate + [JsonProperty("templateId")] + public string? TemplateId { - get => archiveDate; - set => archiveDate = Set("archiveDate", value); - } - - /// - /// Identifiers of services linked to this knowledge article. - /// - [JsonProperty("serviceInstanceIds")] - public List? ServiceInstanceIds - { - get => serviceInstanceIds; - set => serviceInstanceIds = Set("serviceInstanceIds", value); + get => templateId; + set => templateId = Set("templateId", value); } /// diff --git a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleTemplate.cs b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleTemplate.cs new file mode 100644 index 0000000..52da87d --- /dev/null +++ b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleTemplate.cs @@ -0,0 +1,85 @@ +namespace Sdk4me.GraphQL +{ + /// + /// The KnowledgeArticleTemplate object. + /// + public class KnowledgeArticleTemplate : Node + { + /// + /// The account this record belongs to. + /// + [JsonProperty("account"), Sdk4meField(true)] + public Account? Account { get; internal set; } + + /// + /// The date and time at which the record was created. + /// + [JsonProperty("createdAt"), Sdk4meField(true)] + public DateTime? CreatedAt { get; internal set; } + + /// + /// Whether the knowledge article template may no longer be used to create knowledge articles. + /// + [JsonProperty("disabled"), Sdk4meField(true)] + public bool? Disabled { get; internal set; } + + /// + /// Service that is applied to knowledge articles using this template. + /// + [JsonProperty("service"), Sdk4meField(true)] + public Service? Service { get; internal set; } + + [JsonProperty("serviceInstances")] + internal NodeCollection? ServiceInstancesCollection { get; set; } + + /// + /// Service instances that are applied to knowledge articles using this template. + /// + public DataList? ServiceInstances + { + get => ServiceInstancesCollection?.Data; + } + + /// + /// An identifier for the client application submitting the resource or the name of an external system. + /// + [JsonProperty("source"), Sdk4meField(true)] + public string? Source { get; internal set; } + + /// + /// The unique identifier of the resource in an external system. + /// + [JsonProperty("sourceID"), Sdk4meField(true)] + public string? SourceID { get; internal set; } + + /// + /// A short description of the knowledge article template. + /// + [JsonProperty("subject"), Sdk4meField(true)] + public string? Subject { get; internal set; } + + /// + /// The UI extension that is applied to knowledge articles using this template. + /// + [JsonProperty("uiExtension")] + public UiExtension? UiExtension { get; internal set; } + + /// + /// The date and time of the last update of the record. If the record has no updates it contains the createdAt value. + /// + [JsonProperty("updatedAt"), Sdk4meField(true)] + public DateTime? UpdatedAt { get; internal set; } + + internal override HashSet GetQueryPageInfo(string fieldName, int depth) + { + HashSet retval = new(); + retval.AddRange(ServiceInstancesCollection?.GetQueryPageInfo("serviceInstances", depth + 1)); + return retval; + } + + internal override void AddToCollection(object data) + { + ServiceInstances?.AddRange((data as KnowledgeArticleTemplate)?.ServiceInstances); + } + } +} diff --git a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleUpdateInput.cs b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleUpdateInput.cs index 3ce46d0..a2d1759 100644 --- a/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleUpdateInput.cs +++ b/Scr/Sdk4me.GraphQL/Entities/KnowledgeArticleUpdateInput.cs @@ -7,6 +7,9 @@ public class KnowledgeArticleUpdateInput : PropertyChangeSet { private string? source; private string? sourceID; + private CustomFieldCollection? customFields; + private List? customFieldsAttachments; + private DateOnly? archiveDate; private bool? coveredSpecialists; private string? createdById; private string? description; @@ -17,10 +20,10 @@ public class KnowledgeArticleUpdateInput : PropertyChangeSet private bool? keyContacts; private string? keywords; private string? serviceId; + private List? serviceInstanceIds; private KnowledgeArticleStatus? status; private string? subject; - private DateOnly? archiveDate; - private List? serviceInstanceIds; + private string? templateId; private string? id; private List? translationsToDelete; private string? clientMutationId; @@ -45,6 +48,36 @@ public string? SourceID set => sourceID = Set("sourceID", value); } + /// + /// Values for custom fields to be used by the UI Extension that is linked to the record. + /// + [JsonProperty("customFields")] + public CustomFieldCollection? CustomFields + { + get => customFields; + set => customFields = Set("customFields", value); + } + + /// + /// The attachments used in the custom fields' values. + /// + [JsonProperty("customFieldsAttachments")] + public List? CustomFieldsAttachments + { + get => customFieldsAttachments; + set => customFieldsAttachments = Set("customFieldsAttachments", value); + } + + /// + /// The date until which the knowledge article will be active. The knowledge article will be archived at the beginning of this day. When the knowledge article is archived, its status will automatically be set to "Archived". + /// + [JsonProperty("archiveDate")] + public DateOnly? ArchiveDate + { + get => archiveDate; + set => archiveDate = Set("archiveDate", value); + } + /// /// Whether the knowledge article needs to be available to the people who are a member of the support team of one of the service instances that are selected in the Coverage section of an active SLA for the service that is linked to the article. /// @@ -145,6 +178,16 @@ public string? ServiceId set => serviceId = Set("serviceId", value); } + /// + /// Identifiers of service instances linked to this knowledge article. + /// + [JsonProperty("serviceInstanceIds")] + public List? ServiceInstanceIds + { + get => serviceInstanceIds; + set => serviceInstanceIds = Set("serviceInstanceIds", value); + } + /// /// The current status of the knowledge article. /// @@ -166,23 +209,13 @@ public string? Subject } /// - /// The date until which the knowledge article will be active. The knowledge article will be archived at the beginning of this day. When the knowledge article is archived, its status will automatically be set to "Archived". + /// Identifier of the knowledge article template that this knowledge article is based on. /// - [JsonProperty("archiveDate")] - public DateOnly? ArchiveDate + [JsonProperty("templateId")] + public string? TemplateId { - get => archiveDate; - set => archiveDate = Set("archiveDate", value); - } - - /// - /// Identifiers of services linked to this knowledge article. - /// - [JsonProperty("serviceInstanceIds")] - public List? ServiceInstanceIds - { - get => serviceInstanceIds; - set => serviceInstanceIds = Set("serviceInstanceIds", value); + get => templateId; + set => templateId = Set("templateId", value); } /// diff --git a/Scr/Sdk4me.GraphQL/Enumerators/Enumerators.cs b/Scr/Sdk4me.GraphQL/Enumerators/Enumerators.cs index 753ce91..12562b0 100644 --- a/Scr/Sdk4me.GraphQL/Enumerators/Enumerators.cs +++ b/Scr/Sdk4me.GraphQL/Enumerators/Enumerators.cs @@ -2553,6 +2553,11 @@ public enum UiExtensionCategory [EnumMember(Value = "custom_collection")] CustomCollection, /// + /// Knowledge Article Template. + /// + [EnumMember(Value = "knowledge_article_template")] + KnowledgeArticleTemplate, + /// /// Organization. /// [EnumMember(Value = "organization")] diff --git a/Scr/Sdk4me.GraphQL/Enumerators/FieldEnumerators.cs b/Scr/Sdk4me.GraphQL/Enumerators/FieldEnumerators.cs index 5c91445..623a30c 100644 --- a/Scr/Sdk4me.GraphQL/Enumerators/FieldEnumerators.cs +++ b/Scr/Sdk4me.GraphQL/Enumerators/FieldEnumerators.cs @@ -2486,6 +2486,16 @@ public enum KnowledgeArticleField [EnumMember(Value = "createdBy")] CreatedBy, /// + /// The custom fields field. + /// + [EnumMember(Value = "customFields")] + CustomFields, + /// + /// The custom fields attachments field. + /// + [EnumMember(Value = "customFieldsAttachments")] + CustomFieldsAttachments, + /// /// The description field. /// [EnumMember(Value = "description")] @@ -2571,6 +2581,11 @@ public enum KnowledgeArticleField [EnumMember(Value = "subject")] Subject, /// + /// The template field. + /// + [EnumMember(Value = "template")] + Template, + /// /// The translations field. /// [EnumMember(Value = "translations")] @@ -2587,6 +2602,68 @@ public enum KnowledgeArticleField UpdatedBy, } + /// + /// The KnowledgeArticleTemplate fields. + /// + public enum KnowledgeArticleTemplateField + { + /// + /// The account field. + /// + [EnumMember(Value = "account")] + Account, + /// + /// The created at field. + /// + [EnumMember(Value = "createdAt")] + CreatedAt, + /// + /// The disabled field. + /// + [EnumMember(Value = "disabled")] + Disabled, + /// + /// The id field. + /// + [EnumMember(Value = "id")] + ID, + /// + /// The service field. + /// + [EnumMember(Value = "service")] + Service, + /// + /// The service instances field. + /// + [EnumMember(Value = "serviceInstances")] + ServiceInstances, + /// + /// The source field. + /// + [EnumMember(Value = "source")] + Source, + /// + /// The source id field. + /// + [EnumMember(Value = "sourceID")] + SourceID, + /// + /// The subject field. + /// + [EnumMember(Value = "subject")] + Subject, + /// + /// The ui extension field. + /// + [EnumMember(Value = "uiExtension")] + UiExtension, + /// + /// The updated at field. + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt, + } + /// /// The Note fields. /// diff --git a/Scr/Sdk4me.GraphQL/Enumerators/OrderByEnumerators.cs b/Scr/Sdk4me.GraphQL/Enumerators/OrderByEnumerators.cs index c0a98a7..94fc5d6 100644 --- a/Scr/Sdk4me.GraphQL/Enumerators/OrderByEnumerators.cs +++ b/Scr/Sdk4me.GraphQL/Enumerators/OrderByEnumerators.cs @@ -491,6 +491,38 @@ public enum KnowledgeArticleOrderField UpdatedAt, } + /// + /// The knowledge article template order. + /// + public enum KnowledgeArticleTemplateOrderField + { + /// + /// Order by created at. + /// + [EnumMember(Value = "createdAt")] + CreatedAt, + /// + /// Order by disabled. + /// + [EnumMember(Value = "disabled")] + Disabled, + /// + /// Order by service name. + /// + [EnumMember(Value = "serviceName")] + ServiceName, + /// + /// Order by subject. + /// + [EnumMember(Value = "subject")] + Subject, + /// + /// Order by updated at. + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt, + } + /// /// The organization order. /// diff --git a/Scr/Sdk4me.GraphQL/Enumerators/ViewEnumerators.cs b/Scr/Sdk4me.GraphQL/Enumerators/ViewEnumerators.cs index f991d63..6f35950 100644 --- a/Scr/Sdk4me.GraphQL/Enumerators/ViewEnumerators.cs +++ b/Scr/Sdk4me.GraphQL/Enumerators/ViewEnumerators.cs @@ -219,6 +219,23 @@ public enum InvoiceView All, } + /// + /// The knowledge article template view. + /// + public enum KnowledgeArticleTemplateView + { + /// + /// All knowledge article templates which account equals the value supplied via the `x-4me-account` header. + /// + [EnumMember(Value = "current_account")] + CurrentAccount, + /// + /// Knowledge article templates. + /// + [EnumMember(Value = "all")] + All, + } + /// /// The knowledge article view. /// diff --git a/Scr/Sdk4me.GraphQL/Extensions/Sdk4meClientQueryExtension.cs b/Scr/Sdk4me.GraphQL/Extensions/Sdk4meClientQueryExtension.cs index bf9c804..34b79f5 100644 --- a/Scr/Sdk4me.GraphQL/Extensions/Sdk4meClientQueryExtension.cs +++ b/Scr/Sdk4me.GraphQL/Extensions/Sdk4meClientQueryExtension.cs @@ -221,6 +221,18 @@ public static async Task> Get(this Sdk4meClient client, Invoic return await client.Get(query); } + /// + /// Root connection for retrieving KnowledgeArticleTemplate records. + /// + /// The . + /// The query to execute. + /// The task object representing the asynchronous operation. + /// + public static async Task> Get(this Sdk4meClient client, KnowledgeArticleTemplateQuery query) + { + return await client.Get(query); + } + /// /// Root connection for retrieving KnowledgeArticle records. /// diff --git a/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleQuery.cs b/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleQuery.cs index 1978c65..4421c33 100644 --- a/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleQuery.cs +++ b/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleQuery.cs @@ -13,6 +13,15 @@ public KnowledgeArticleQuery() { } + /// + /// Inline images linked to one of the custom fields. + /// + public KnowledgeArticleQuery SelectCustomFieldsAttachments(AttachmentQuery query) + { + query.FieldName = "customFieldsAttachments"; + return Select(query); + } + /// /// Inline images linked to the Description field. /// @@ -41,7 +50,7 @@ public KnowledgeArticleQuery SelectRequests(RequestQuery query) } /// - /// Services linked to this knowledge article. + /// Service instances linked to this knowledge article. /// public KnowledgeArticleQuery SelectServiceInstances(ServiceInstanceQuery query) { @@ -57,5 +66,42 @@ public KnowledgeArticleQuery SelectTranslations(TranslationQuery query) query.FieldName = "translations"; return Select(query); } + + /// + ///
Filter the 'KnowledgeArticle' by their custom fields that have been marked as 'Filterable' in their UI Extension.
+ ///
Additional information is available on the 4me developer site.
+ ///
+ /// The name of the custom filter (i.e. value of the data-filterable-name attribute of the field in the UI Extension). + /// The filter operator. + /// The filter values. + ///
Use value null to indicate "None".
+ ///

+ ///
For "text" fields:
+ ///
• One can start the value with ~ to get partial matches (start with '~ to match on a value starting with ~).
+ ///

+ ///
For "number" and "time" fields:
+ ///
• One can start the value with <, >, <=, >= to get relative matches.
+ ///
• Times should be formatted as HH:mm:ss (e.g. 16:00:00). The seconds part, :ss, is optional so 16:00 is also valid.
+ ///
>{lower}<{upper} can be used to get matches where the value is more than '{lower}' and less than '{upper}'.
+ ///
>={lower}<={upper} can be used to get matches where the value is between '{lower}' and '{upper}'.
+ ///
>={lower}<{upper} can be used to get matches where the value is at least '{lower}' and less than '{upper}'.
+ ///

+ ///
For "date" and "date-time" fields:
+ ///
• One must supply a single value (and null is not supported).
+ ///
• Matches are always relative with an optional upper bound.
+ ///
• Dates should be formatted as yyyy-MM-dd (e.g. 2020-05-20).
+ ///
• Date and time should be formatted as yyyy-MM-ddTHH:mm:ssZ (e.g. 2020-05-20T16:00:00Z).
+ ///
>={lower} should be used to get matches where the value is at least '{lower}'.
+ ///
>={lower}<{upper} can be used to get matches where the value is at least '{lower}' and before '{upper}'.
+ ///

+ ///
For "select" fields:
+ ///
• One must supply labels to match in the language of the account (i.e. not the value attributes of the HTML options).
+ ///
• Matches are case-sensitive.
+ /// + /// + public KnowledgeArticleQuery CustomFilter(string name, FilterOperator filterOperator, params string[] values) + { + return AddCustomFilter(name, filterOperator, values); + } } } diff --git a/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleTemplateQuery.cs b/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleTemplateQuery.cs new file mode 100644 index 0000000..b8843f0 --- /dev/null +++ b/Scr/Sdk4me.GraphQL/Queries/KnowledgeArticleTemplateQuery.cs @@ -0,0 +1,25 @@ +namespace Sdk4me.GraphQL +{ + /// + /// Root connection for retrieving KnowledgeArticleTemplate records. + /// + public class KnowledgeArticleTemplateQuery : Query + { + /// + /// Initialize a new knowledge article template query instance. + /// + public KnowledgeArticleTemplateQuery() + : base("knowledgeArticleTemplates", typeof(KnowledgeArticleTemplate), true) + { + } + + /// + /// Service instances that are applied to knowledge articles using this template. + /// + public KnowledgeArticleTemplateQuery SelectServiceInstances(ServiceInstanceQuery query) + { + query.FieldName = "serviceInstances"; + return Select(query); + } + } +} diff --git a/Scr/Sdk4me.GraphQL/Queries/Queries.cs b/Scr/Sdk4me.GraphQL/Queries/Queries.cs index a607c87..aeee68b 100644 --- a/Scr/Sdk4me.GraphQL/Queries/Queries.cs +++ b/Scr/Sdk4me.GraphQL/Queries/Queries.cs @@ -95,6 +95,11 @@ public sealed class Query ///
public static InvoiceQuery Invoice => new(); + /// + /// Returns a new instance of the with a default field selection. + /// + public static KnowledgeArticleTemplateQuery KnowledgeArticleTemplate => new(); + /// /// Returns a new instance of the with a default field selection. ///