generated from DFE-Digital/govuk-dotnet-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
387 additions
and
21 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
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
78 changes: 78 additions & 0 deletions
78
Childrens-Social-Care-CPD/GraphQL/Queries/GetContentTags.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,78 @@ | ||
using GraphQL; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Childrens_Social_Care_CPD.GraphQL.Queries; | ||
|
||
public class GetContentTags | ||
{ | ||
public static GraphQLRequest Query(string id, bool preview = false) | ||
{ | ||
return new GraphQLRequest | ||
{ | ||
Query = @" | ||
query GetContentTags($id: String!, $preview: Boolean) { | ||
contentCollection(where: { | ||
id : $id, | ||
}, preview: $preview) { | ||
total | ||
items { | ||
id | ||
sys { | ||
publishedAt | ||
firstPublishedAt | ||
} | ||
contentfulMetadata { | ||
tags { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
} | ||
}", | ||
OperationName = "GetContentTags", | ||
Variables = new | ||
{ | ||
id, | ||
preview, | ||
} | ||
}; | ||
} | ||
|
||
public class ResponseType | ||
{ | ||
[JsonPropertyName("contentCollection")] | ||
public ContentCollection ContentCollection { get; set; } | ||
} | ||
|
||
public class ContentCollection | ||
{ | ||
[JsonPropertyName("items")] | ||
public ICollection<ContentItem> Items { get; set; } | ||
public int Total { get; set; } | ||
} | ||
|
||
public class ContentItem | ||
{ | ||
public string Id { get; set; } | ||
public PublishedInfo Sys { get; set; } | ||
public MetaData ContentfulMetaData { get; set; } | ||
} | ||
|
||
public class PublishedInfo | ||
{ | ||
public DateTime? PublishedAt { get; set; } | ||
public DateTime? FirstPublishedAt { get; set; } | ||
} | ||
|
||
public class MetaData | ||
{ | ||
public List<Tag> Tags { get; set; } | ||
} | ||
|
||
public class Tag | ||
{ | ||
public string Id { get; set; } | ||
public string Name { 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
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.