// Code generated by github.com/Khan/genqlient, DO NOT EDIT. package repositories import ( "context" "time" "github.com/Khan/genqlient/graphql" ) // Fragment for authors type Author struct { Name string `json:"name"` Email string `json:"email"` Bio string `json:"bio"` } // GetName returns Author.Name, and is useful for accessing the field via an interface. func (v *Author) GetName() string { return v.Name } // GetEmail returns Author.Email, and is useful for accessing the field via an interface. func (v *Author) GetEmail() string { return v.Email } // GetBio returns Author.Bio, and is useful for accessing the field via an interface. func (v *Author) GetBio() string { return v.Bio } // Fragment for featured image type FeaturedImage struct { Name string `json:"name"` Url string `json:"url"` } // GetName returns FeaturedImage.Name, and is useful for accessing the field via an interface. func (v *FeaturedImage) GetName() string { return v.Name } // GetUrl returns FeaturedImage.Url, and is useful for accessing the field via an interface. func (v *FeaturedImage) GetUrl() string { return v.Url } // GetAllAuthorsResponse is returned by GetAllAuthors on success. type GetAllAuthorsResponse struct { Authors []Author `json:"authors"` } // GetAuthors returns GetAllAuthorsResponse.Authors, and is useful for accessing the field via an interface. func (v *GetAllAuthorsResponse) GetAuthors() []Author { return v.Authors } // GetAllPostsResponse is returned by GetAllPosts on success. type GetAllPostsResponse struct { Posts []Post `json:"posts"` } // GetPosts returns GetAllPostsResponse.Posts, and is useful for accessing the field via an interface. func (v *GetAllPostsResponse) GetPosts() []Post { return v.Posts } // GetAllTagsResponse is returned by GetAllTags on success. type GetAllTagsResponse struct { Tags []Tag `json:"tags"` } // GetTags returns GetAllTagsResponse.Tags, and is useful for accessing the field via an interface. func (v *GetAllTagsResponse) GetTags() []Tag { return v.Tags } // GetFeaturedPostsResponse is returned by GetFeaturedPosts on success. type GetFeaturedPostsResponse struct { Posts []PostSummary `json:"posts"` } // GetPosts returns GetFeaturedPostsResponse.Posts, and is useful for accessing the field via an interface. func (v *GetFeaturedPostsResponse) GetPosts() []PostSummary { return v.Posts } // GetPostResponse is returned by GetPost on success. type GetPostResponse struct { Posts []Post `json:"posts"` } // GetPosts returns GetPostResponse.Posts, and is useful for accessing the field via an interface. func (v *GetPostResponse) GetPosts() []Post { return v.Posts } // GetPostSummariesResponse is returned by GetPostSummaries on success. type GetPostSummariesResponse struct { Posts []PostSummary `json:"posts"` } // GetPosts returns GetPostSummariesResponse.Posts, and is useful for accessing the field via an interface. func (v *GetPostSummariesResponse) GetPosts() []PostSummary { return v.Posts } // GetPostsByTagResponse is returned by GetPostsByTag on success. type GetPostsByTagResponse struct { Posts []PostSummary `json:"posts"` } // GetPosts returns GetPostsByTagResponse.Posts, and is useful for accessing the field via an interface. func (v *GetPostsByTagResponse) GetPosts() []PostSummary { return v.Posts } // Fragment for full post content type Post struct { Title string `json:"title"` Slug string `json:"slug"` MetaTitle string `json:"meta_title"` MetaDescription string `json:"meta_description"` Featured bool `json:"featured"` ReadingTime int `json:"reading_time"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Author Author `json:"author"` Tags []Tag `json:"tags"` Excerpt string `json:"excerpt"` Content string `json:"content"` FeaturedImage FeaturedImage `json:"featured_image"` } // GetTitle returns Post.Title, and is useful for accessing the field via an interface. func (v *Post) GetTitle() string { return v.Title } // GetSlug returns Post.Slug, and is useful for accessing the field via an interface. func (v *Post) GetSlug() string { return v.Slug } // GetMetaTitle returns Post.MetaTitle, and is useful for accessing the field via an interface. func (v *Post) GetMetaTitle() string { return v.MetaTitle } // GetMetaDescription returns Post.MetaDescription, and is useful for accessing the field via an interface. func (v *Post) GetMetaDescription() string { return v.MetaDescription } // GetFeatured returns Post.Featured, and is useful for accessing the field via an interface. func (v *Post) GetFeatured() bool { return v.Featured } // GetReadingTime returns Post.ReadingTime, and is useful for accessing the field via an interface. func (v *Post) GetReadingTime() int { return v.ReadingTime } // GetCreatedAt returns Post.CreatedAt, and is useful for accessing the field via an interface. func (v *Post) GetCreatedAt() time.Time { return v.CreatedAt } // GetUpdatedAt returns Post.UpdatedAt, and is useful for accessing the field via an interface. func (v *Post) GetUpdatedAt() time.Time { return v.UpdatedAt } // GetAuthor returns Post.Author, and is useful for accessing the field via an interface. func (v *Post) GetAuthor() Author { return v.Author } // GetTags returns Post.Tags, and is useful for accessing the field via an interface. func (v *Post) GetTags() []Tag { return v.Tags } // GetExcerpt returns Post.Excerpt, and is useful for accessing the field via an interface. func (v *Post) GetExcerpt() string { return v.Excerpt } // GetContent returns Post.Content, and is useful for accessing the field via an interface. func (v *Post) GetContent() string { return v.Content } // GetFeaturedImage returns Post.FeaturedImage, and is useful for accessing the field via an interface. func (v *Post) GetFeaturedImage() FeaturedImage { return v.FeaturedImage } // Fragment for post summary type PostSummary struct { Title string `json:"title"` Slug string `json:"slug"` Featured bool `json:"featured"` ReadingTime int `json:"reading_time"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Author Author `json:"author"` Tags []Tag `json:"tags"` Excerpt string `json:"excerpt"` FeaturedImage FeaturedImage `json:"featured_image"` } // GetTitle returns PostSummary.Title, and is useful for accessing the field via an interface. func (v *PostSummary) GetTitle() string { return v.Title } // GetSlug returns PostSummary.Slug, and is useful for accessing the field via an interface. func (v *PostSummary) GetSlug() string { return v.Slug } // GetFeatured returns PostSummary.Featured, and is useful for accessing the field via an interface. func (v *PostSummary) GetFeatured() bool { return v.Featured } // GetReadingTime returns PostSummary.ReadingTime, and is useful for accessing the field via an interface. func (v *PostSummary) GetReadingTime() int { return v.ReadingTime } // GetCreatedAt returns PostSummary.CreatedAt, and is useful for accessing the field via an interface. func (v *PostSummary) GetCreatedAt() time.Time { return v.CreatedAt } // GetUpdatedAt returns PostSummary.UpdatedAt, and is useful for accessing the field via an interface. func (v *PostSummary) GetUpdatedAt() time.Time { return v.UpdatedAt } // GetAuthor returns PostSummary.Author, and is useful for accessing the field via an interface. func (v *PostSummary) GetAuthor() Author { return v.Author } // GetTags returns PostSummary.Tags, and is useful for accessing the field via an interface. func (v *PostSummary) GetTags() []Tag { return v.Tags } // GetExcerpt returns PostSummary.Excerpt, and is useful for accessing the field via an interface. func (v *PostSummary) GetExcerpt() string { return v.Excerpt } // GetFeaturedImage returns PostSummary.FeaturedImage, and is useful for accessing the field via an interface. func (v *PostSummary) GetFeaturedImage() FeaturedImage { return v.FeaturedImage } // Fragment for tag type Tag struct { Name string `json:"name"` Slug string `json:"slug"` } // GetName returns Tag.Name, and is useful for accessing the field via an interface. func (v *Tag) GetName() string { return v.Name } // GetSlug returns Tag.Slug, and is useful for accessing the field via an interface. func (v *Tag) GetSlug() string { return v.Slug } // __GetAllAuthorsInput is used internally by genqlient type __GetAllAuthorsInput struct { PageSize int `json:"pageSize"` Page int `json:"page"` } // GetPageSize returns __GetAllAuthorsInput.PageSize, and is useful for accessing the field via an interface. func (v *__GetAllAuthorsInput) GetPageSize() int { return v.PageSize } // GetPage returns __GetAllAuthorsInput.Page, and is useful for accessing the field via an interface. func (v *__GetAllAuthorsInput) GetPage() int { return v.Page } // __GetAllPostsInput is used internally by genqlient type __GetAllPostsInput struct { PageSize int `json:"pageSize"` Page int `json:"page"` } // GetPageSize returns __GetAllPostsInput.PageSize, and is useful for accessing the field via an interface. func (v *__GetAllPostsInput) GetPageSize() int { return v.PageSize } // GetPage returns __GetAllPostsInput.Page, and is useful for accessing the field via an interface. func (v *__GetAllPostsInput) GetPage() int { return v.Page } // __GetFeaturedPostsInput is used internally by genqlient type __GetFeaturedPostsInput struct { PageSize int `json:"pageSize"` Page int `json:"page"` } // GetPageSize returns __GetFeaturedPostsInput.PageSize, and is useful for accessing the field via an interface. func (v *__GetFeaturedPostsInput) GetPageSize() int { return v.PageSize } // GetPage returns __GetFeaturedPostsInput.Page, and is useful for accessing the field via an interface. func (v *__GetFeaturedPostsInput) GetPage() int { return v.Page } // __GetPostInput is used internally by genqlient type __GetPostInput struct { Slug string `json:"slug"` } // GetSlug returns __GetPostInput.Slug, and is useful for accessing the field via an interface. func (v *__GetPostInput) GetSlug() string { return v.Slug } // __GetPostSummariesInput is used internally by genqlient type __GetPostSummariesInput struct { PageSize int `json:"pageSize"` Page int `json:"page"` } // GetPageSize returns __GetPostSummariesInput.PageSize, and is useful for accessing the field via an interface. func (v *__GetPostSummariesInput) GetPageSize() int { return v.PageSize } // GetPage returns __GetPostSummariesInput.Page, and is useful for accessing the field via an interface. func (v *__GetPostSummariesInput) GetPage() int { return v.Page } // __GetPostsByTagInput is used internally by genqlient type __GetPostsByTagInput struct { Tag string `json:"tag"` PageSize int `json:"pageSize"` Page int `json:"page"` } // GetTag returns __GetPostsByTagInput.Tag, and is useful for accessing the field via an interface. func (v *__GetPostsByTagInput) GetTag() string { return v.Tag } // GetPageSize returns __GetPostsByTagInput.PageSize, and is useful for accessing the field via an interface. func (v *__GetPostsByTagInput) GetPageSize() int { return v.PageSize } // GetPage returns __GetPostsByTagInput.Page, and is useful for accessing the field via an interface. func (v *__GetPostsByTagInput) GetPage() int { return v.Page } // The query executed by GetAllAuthors. const GetAllAuthors_Operation = ` query GetAllAuthors ($pageSize: Int = 10, $page: Int = 1) { authors(pagination: {pageSize:$pageSize,page:$page}) { ... Author } } fragment Author on Author { name email bio } ` // Gets all authors func GetAllAuthors( ctx_ context.Context, client_ graphql.Client, pageSize int, page int, ) (data_ *GetAllAuthorsResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetAllAuthors", Query: GetAllAuthors_Operation, Variables: &__GetAllAuthorsInput{ PageSize: pageSize, Page: page, }, } data_ = &GetAllAuthorsResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetAllPosts. const GetAllPosts_Operation = ` query GetAllPosts ($pageSize: Int = 10, $page: Int = 1) { posts(pagination: {pageSize:$pageSize,page:$page}) { ... Post } } fragment Post on Post { title slug meta_title meta_description featured reading_time createdAt updatedAt author { ... Author } tags { ... Tag } excerpt content featured_image { ... FeaturedImage } } fragment Author on Author { name email bio } fragment Tag on Tag { name slug } fragment FeaturedImage on UploadFile { name url } ` // Get all posts func GetAllPosts( ctx_ context.Context, client_ graphql.Client, pageSize int, page int, ) (data_ *GetAllPostsResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetAllPosts", Query: GetAllPosts_Operation, Variables: &__GetAllPostsInput{ PageSize: pageSize, Page: page, }, } data_ = &GetAllPostsResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetAllTags. const GetAllTags_Operation = ` query GetAllTags { tags { ... Tag } } fragment Tag on Tag { name slug } ` // Get all tags func GetAllTags( ctx_ context.Context, client_ graphql.Client, ) (data_ *GetAllTagsResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetAllTags", Query: GetAllTags_Operation, } data_ = &GetAllTagsResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetFeaturedPosts. const GetFeaturedPosts_Operation = ` query GetFeaturedPosts ($pageSize: Int = 10, $page: Int = 1) { posts(pagination: {pageSize:$pageSize,page:$page}, filters: {featured:{eq:true}}) { ... PostSummary } } fragment PostSummary on Post { title slug featured reading_time createdAt updatedAt author { ... Author } tags { ... Tag } excerpt featured_image { ... FeaturedImage } } fragment Author on Author { name email bio } fragment Tag on Tag { name slug } fragment FeaturedImage on UploadFile { name url } ` // Get featured posts func GetFeaturedPosts( ctx_ context.Context, client_ graphql.Client, pageSize int, page int, ) (data_ *GetFeaturedPostsResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetFeaturedPosts", Query: GetFeaturedPosts_Operation, Variables: &__GetFeaturedPostsInput{ PageSize: pageSize, Page: page, }, } data_ = &GetFeaturedPostsResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetPost. const GetPost_Operation = ` query GetPost ($slug: String!) { posts(filters: {slug:{eq:$slug}}) { ... Post } } fragment Post on Post { title slug meta_title meta_description featured reading_time createdAt updatedAt author { ... Author } tags { ... Tag } excerpt content featured_image { ... FeaturedImage } } fragment Author on Author { name email bio } fragment Tag on Tag { name slug } fragment FeaturedImage on UploadFile { name url } ` // Get specific post (by slug) func GetPost( ctx_ context.Context, client_ graphql.Client, slug string, ) (data_ *GetPostResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetPost", Query: GetPost_Operation, Variables: &__GetPostInput{ Slug: slug, }, } data_ = &GetPostResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetPostSummaries. const GetPostSummaries_Operation = ` query GetPostSummaries ($pageSize: Int = 10, $page: Int = 1) { posts(pagination: {pageSize:$pageSize,page:$page}) { ... PostSummary } } fragment PostSummary on Post { title slug featured reading_time createdAt updatedAt author { ... Author } tags { ... Tag } excerpt featured_image { ... FeaturedImage } } fragment Author on Author { name email bio } fragment Tag on Tag { name slug } fragment FeaturedImage on UploadFile { name url } ` // Get post summaries func GetPostSummaries( ctx_ context.Context, client_ graphql.Client, pageSize int, page int, ) (data_ *GetPostSummariesResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetPostSummaries", Query: GetPostSummaries_Operation, Variables: &__GetPostSummariesInput{ PageSize: pageSize, Page: page, }, } data_ = &GetPostSummariesResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ } // The query executed by GetPostsByTag. const GetPostsByTag_Operation = ` query GetPostsByTag ($tag: String!, $pageSize: Int = 10, $page: Int = 1) { posts(pagination: {pageSize:$pageSize,page:$page}, filters: {tags:{slug:{eq:$tag}}}) { ... PostSummary } } fragment PostSummary on Post { title slug featured reading_time createdAt updatedAt author { ... Author } tags { ... Tag } excerpt featured_image { ... FeaturedImage } } fragment Author on Author { name email bio } fragment Tag on Tag { name slug } fragment FeaturedImage on UploadFile { name url } ` // Get posts by tag (slug) func GetPostsByTag( ctx_ context.Context, client_ graphql.Client, tag string, pageSize int, page int, ) (data_ *GetPostsByTagResponse, err_ error) { req_ := &graphql.Request{ OpName: "GetPostsByTag", Query: GetPostsByTag_Operation, Variables: &__GetPostsByTagInput{ Tag: tag, PageSize: pageSize, Page: page, }, } data_ = &GetPostsByTagResponse{} resp_ := &graphql.Response{Data: data_} err_ = client_.MakeRequest( ctx_, req_, resp_, ) return data_, err_ }