diff --git a/src/managers/misc/misc.manager.ts b/src/managers/misc/misc.manager.ts index e3b1955..42c522f 100644 --- a/src/managers/misc/misc.manager.ts +++ b/src/managers/misc/misc.manager.ts @@ -61,10 +61,10 @@ export class MiscellaneousManager extends BaseManager { } /** - * - * ===================MUTATIONS=================== - * - */ + * + * ===================MUTATIONS=================== + * + */ /** * Follow tags @@ -84,11 +84,11 @@ export class MiscellaneousManager extends BaseManager { /** * Unfollow tags - * + * * @param input - The UnFollowTag input. - * + * * @returns The tag details. - */ + */ async unfollowTags(input: UnfollowTagsInput) { const res = await this.makeRequest<{ unfollowTag: UnfollowTagsPayload }>( 'unfollowTags', @@ -97,6 +97,4 @@ export class MiscellaneousManager extends BaseManager { ); return res.unfollowTag; } - - } diff --git a/src/managers/misc/misc.mutations.ts b/src/managers/misc/misc.mutations.ts index e848ef0..92c54db 100644 --- a/src/managers/misc/misc.mutations.ts +++ b/src/managers/misc/misc.mutations.ts @@ -1,39 +1,39 @@ import { gql } from 'graphql-request'; export const FOLLOW_TAGS_MUTATION = gql` -mutation followTags($input: FollowTagsInput!) { - followTags(input: $input) { - tags { - id - name - slug - logo - tagline - info { - markdown + mutation followTags($input: FollowTagsInput!) { + followTags(input: $input) { + tags { + id + name + slug + logo + tagline + info { + markdown + } + followersCount + postsCount } - followersCount - postsCount } } -} -` +`; export const UNFOLLOW_TAGS_MUTATION = gql` -mutation followTags($input: UnfollowTagsInput!) { - unfollowTags(input: $input) { - tags { - id - name - slug - logo - tagline - info { - markdown + mutation followTags($input: UnfollowTagsInput!) { + unfollowTags(input: $input) { + tags { + id + name + slug + logo + tagline + info { + markdown + } + followersCount + postsCount } - followersCount - postsCount } } -} -` \ No newline at end of file +`; diff --git a/src/managers/posts/post.manager.ts b/src/managers/posts/post.manager.ts index 4df69fe..3786398 100644 --- a/src/managers/posts/post.manager.ts +++ b/src/managers/posts/post.manager.ts @@ -1,4 +1,15 @@ -import type { PublishPostInput, AddPostToSeriesInput, UpdatePostInput, RemovePostInput, LikePostInput, LikePostPayload, RemovePostPayload, UpdatePostPayload, AddPostToSeriesPayload, PublishPostPayload } from './../../generated/gqlQueryTypes'; +import type { + PublishPostInput, + AddPostToSeriesInput, + UpdatePostInput, + RemovePostInput, + LikePostInput, + LikePostPayload, + RemovePostPayload, + UpdatePostPayload, + AddPostToSeriesPayload, + PublishPostPayload, +} from './../../generated/gqlQueryTypes'; import type { HashnodeSDKClient } from '../../client'; import { BaseManager } from '../base.manager'; import { @@ -201,93 +212,91 @@ export class PostManager extends BaseManager { /** * Publish a post - * + * * @param {PublishPostInput} input - The post to be published - * + * * @returns The new post - */ + */ async publishPost(input: PublishPostInput) { const res = await this.makeRequest<{ publishedpost: PublishPostPayload }>( 'publishPost', PUBLISH_POST_MUTATION, { - input - } - ) - return res.publishedpost.post + input, + }, + ); + return res.publishedpost.post; } /** * Add a post to a series - * + * * @param {AddPostToSeriesInput} input - The input of the post to be added to the series - * + * * @return The series - */ + */ async addPostToSeries(input: AddPostToSeriesInput) { const res = await this.makeRequest<{ series: AddPostToSeriesPayload }>( 'addPostToSeries', ADD_POST_TO_SERIES_MUTATION, { - input - } - ) - return res.series + input, + }, + ); + return res.series; } /** * Updates a post - * + * * @param {UpdatePostInput} input - The input of the post to be updated - * + * * @return The updated post - */ + */ async updatePost(input: UpdatePostInput) { const res = await this.makeRequest<{ updatedPost: UpdatePostPayload }>( 'updatePost', UPDATE_POST_MUTATION, { - input - } - ) - return res.updatedPost + input, + }, + ); + return res.updatedPost; } /** * Remove a post - * + * * @param {RemovePostInput} input - The input of the post to be removed - * + * * @return The removed post - */ + */ async removePost(input: RemovePostInput) { const res = await this.makeRequest<{ removedPost: RemovePostPayload }>( 'removePost', REMOVE_POST_MUTATION, { - input - } - ) - return res.removedPost + input, + }, + ); + return res.removedPost; } /** * Like a post - * + * * @param {LikePostInput} input - The input of the post to be liked - * + * * @return The liked post - */ + */ async likePost(input: LikePostInput) { const res = await this.makeRequest<{ likedPost: LikePostPayload }>( 'likePost', LIKE_POST_MUTATION, { - input - } - ) - return res.likedPost + input, + }, + ); + return res.likedPost; } - - } diff --git a/src/managers/posts/post.queries.ts b/src/managers/posts/post.queries.ts index cc8283f..aa75c27 100644 --- a/src/managers/posts/post.queries.ts +++ b/src/managers/posts/post.queries.ts @@ -863,769 +863,768 @@ export const GET_FEED_POST = gql` `; export const PUBLISH_POST_MUTATION = gql` -mutation publishPostMutation($input: PublishPostInput!) { - publishPost(input: $input) { - post { - id - slug - content { - markdown - } - previousSlugs - title - subtitle - author { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - coAuthors { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - tags { + mutation publishPostMutation($input: PublishPostInput!) { + publishPost(input: $input) { + post { id - name slug - logo - tagline - } - url - canonicalUrl - publication { - id - title - displayTitle - descriptionSEO - about { + content { markdown } - url - canonicalURL + previousSlugs + title + subtitle author { id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + coAuthors { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + tags { + id + name + slug + logo + tagline } - favicon - headerColor - metaTags - } - coverImage { url - isPortrait - attribution - photographer - isAttributionHidden - } - brief - readTimeInMinutes - views - series { - id - name - } - reactionCount - responseCount - replyCount - featured - bookmarked - featuredAt - preferences { - pinnedToBlog - disableComments - stickCoverToBottom - isDelisted - } - seo { - title - description - } - ogMetaData { - image - } - hasLatexInPost - isFollowed - isAutoPublishedFromRSS - features { - tableOfContents { - isEnabled - items { + canonicalUrl + publication { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { id - level - slug - title - parentId } + favicon + headerColor + metaTags } - badges { - isEnabled - items { - id - type + coverImage { + url + isPortrait + attribution + photographer + isAttributionHidden + } + brief + readTimeInMinutes + views + series { + id + name + } + reactionCount + responseCount + replyCount + featured + bookmarked + featuredAt + preferences { + pinnedToBlog + disableComments + stickCoverToBottom + isDelisted + } + seo { + title + description + } + ogMetaData { + image + } + hasLatexInPost + isFollowed + isAutoPublishedFromRSS + features { + tableOfContents { + isEnabled + items { + id + level + slug + title + parentId + } + } + badges { + isEnabled + items { + id + type + } } } + sourcedFromGithub } - sourcedFromGithub } } -} -` +`; export const ADD_POST_TO_SERIES_MUTATION = gql` -mutation AddPostToSeriesMutation($input: AddPostToSeriesInput!) { - addPostToSeries(input: $input) { - series { - id - name - createdAt - description { - markdown - } - coverImage - author { + mutation AddPostToSeriesMutation($input: AddPostToSeriesInput!) { + addPostToSeries(input: $input) { + series { id - username name - bio { + createdAt + description { markdown } - profilePicture - followersCount - followingsCount - location - following - followsBack - isPro - } - slug - } - } -} -` - -export const UPDATE_POST_MUTATION = gql` -mutation updatePostMutation($input: UpdatePostInput!) { - updatePost(input: $input) { - post { - id - slug - content { - markdown - } - previousSlugs - title - subtitle - author { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - coAuthors { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube + coverImage + author { + id + username + name + bio { + markdown + } + profilePicture + followersCount + followingsCount + location + following + followsBack + isPro } - followersCount - followingsCount - tagline - following - followsBack - } - tags { - id - name slug - logo - tagline } - url - canonicalUrl - publication { + } + } +`; + +export const UPDATE_POST_MUTATION = gql` + mutation updatePostMutation($input: UpdatePostInput!) { + updatePost(input: $input) { + post { id - title - displayTitle - descriptionSEO - about { + slug + content { markdown } - url - canonicalURL + previousSlugs + title + subtitle author { id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + coAuthors { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + tags { + id + name + slug + logo + tagline } - favicon - headerColor - metaTags - } - coverImage { url - isPortrait - attribution - photographer - isAttributionHidden - } - brief - readTimeInMinutes - views - series { - id - name - } - reactionCount - responseCount - replyCount - featured - bookmarked - featuredAt - preferences { - pinnedToBlog - disableComments - stickCoverToBottom - isDelisted - } - seo { - title - description - } - ogMetaData { - image - } - hasLatexInPost - isFollowed - isAutoPublishedFromRSS - features { - tableOfContents { - isEnabled - items { + canonicalUrl + publication { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { id - level - slug - title - parentId } + favicon + headerColor + metaTags } - badges { - isEnabled - items { - id - type + coverImage { + url + isPortrait + attribution + photographer + isAttributionHidden + } + brief + readTimeInMinutes + views + series { + id + name + } + reactionCount + responseCount + replyCount + featured + bookmarked + featuredAt + preferences { + pinnedToBlog + disableComments + stickCoverToBottom + isDelisted + } + seo { + title + description + } + ogMetaData { + image + } + hasLatexInPost + isFollowed + isAutoPublishedFromRSS + features { + tableOfContents { + isEnabled + items { + id + level + slug + title + parentId + } + } + badges { + isEnabled + items { + id + type + } } } + sourcedFromGithub } - sourcedFromGithub } } -} -` +`; export const REMOVE_POST_MUTATION = gql` -mutation removePostMutation($input: RemovePostInput!) { - removePost(input: $input) { - post { - id - slug - content { - markdown - } - previousSlugs - title - subtitle - author { + mutation removePostMutation($input: RemovePostInput!) { + removePost(input: $input) { + post { id - username - name - bio { + slug + content { markdown } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - coAuthors { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - tags { - id - name - slug - logo - tagline - } - url - canonicalUrl - publication { - id + previousSlugs title - displayTitle - descriptionSEO - about { - markdown - } - url - canonicalURL + subtitle author { id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + coAuthors { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + tags { + id + name + slug + logo + tagline } - favicon - headerColor - metaTags - } - coverImage { url - isPortrait - attribution - photographer - isAttributionHidden - } - brief - readTimeInMinutes - views - series { - id - name - } - reactionCount - responseCount - replyCount - featured - bookmarked - featuredAt - preferences { - pinnedToBlog - disableComments - stickCoverToBottom - isDelisted - } - seo { - title - description - } - ogMetaData { - image - } - hasLatexInPost - isFollowed - isAutoPublishedFromRSS - features { - tableOfContents { - isEnabled - items { + canonicalUrl + publication { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { id - level - slug - title - parentId } + favicon + headerColor + metaTags } - badges { - isEnabled - items { - id - type + coverImage { + url + isPortrait + attribution + photographer + isAttributionHidden + } + brief + readTimeInMinutes + views + series { + id + name + } + reactionCount + responseCount + replyCount + featured + bookmarked + featuredAt + preferences { + pinnedToBlog + disableComments + stickCoverToBottom + isDelisted + } + seo { + title + description + } + ogMetaData { + image + } + hasLatexInPost + isFollowed + isAutoPublishedFromRSS + features { + tableOfContents { + isEnabled + items { + id + level + slug + title + parentId + } + } + badges { + isEnabled + items { + id + type + } } } + sourcedFromGithub } - sourcedFromGithub } } -} -` +`; export const LIKE_POST_MUTATION = gql` -mutation likePostMutation($input: LikePostInput!) { - likePost(input: $input) { - post { - id - slug - content { - markdown - } - previousSlugs - title - subtitle - author { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - coAuthors { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - tags { + mutation likePostMutation($input: LikePostInput!) { + likePost(input: $input) { + post { id - name slug - logo - tagline - } - url - canonicalUrl - publication { - id - title - displayTitle - descriptionSEO - about { + content { markdown } - url - canonicalURL + previousSlugs + title + subtitle author { id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + coAuthors { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + tags { + id + name + slug + logo + tagline } - favicon - headerColor - metaTags - } - coverImage { url - isPortrait - attribution - photographer - isAttributionHidden - } - brief - readTimeInMinutes - views - series { - id - name - } - reactionCount - responseCount - replyCount - featured - bookmarked - featuredAt - preferences { - pinnedToBlog - disableComments - stickCoverToBottom - isDelisted - } - seo { - title - description - } - ogMetaData { - image - } - hasLatexInPost - isFollowed - isAutoPublishedFromRSS - features { - tableOfContents { - isEnabled - items { + canonicalUrl + publication { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { id - level - slug - title - parentId } + favicon + headerColor + metaTags + } + coverImage { + url + isPortrait + attribution + photographer + isAttributionHidden + } + brief + readTimeInMinutes + views + series { + id + name + } + reactionCount + responseCount + replyCount + featured + bookmarked + featuredAt + preferences { + pinnedToBlog + disableComments + stickCoverToBottom + isDelisted + } + seo { + title + description } - badges { - isEnabled - items { - id - type + ogMetaData { + image + } + hasLatexInPost + isFollowed + isAutoPublishedFromRSS + features { + tableOfContents { + isEnabled + items { + id + level + slug + title + parentId + } + } + badges { + isEnabled + items { + id + type + } } } + sourcedFromGithub } - sourcedFromGithub } } -} -` +`; export const RESTORE_POST_MUTATION = gql` -mutation restorePostMutation($input: RestorePostInput!) { - restorePost(input: $input) { - post { - id - slug - content { - markdown - } - previousSlugs - title - subtitle - author { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - coAuthors { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - tags { + mutation restorePostMutation($input: RestorePostInput!) { + restorePost(input: $input) { + post { id - name slug - logo - tagline - } - url - canonicalUrl - publication { - id - title - displayTitle - descriptionSEO - about { + content { markdown } - url - canonicalURL + previousSlugs + title + subtitle author { id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + coAuthors { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + tags { + id + name + slug + logo + tagline } - favicon - headerColor - metaTags - } - coverImage { url - isPortrait - attribution - photographer - isAttributionHidden - } - brief - readTimeInMinutes - views - series { - id - name - } - reactionCount - responseCount - replyCount - featured - bookmarked - featuredAt - preferences { - pinnedToBlog - disableComments - stickCoverToBottom - isDelisted - } - seo { - title - description - } - ogMetaData { - image - } - hasLatexInPost - isFollowed - isAutoPublishedFromRSS - features { - tableOfContents { - isEnabled - items { + canonicalUrl + publication { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { id - level - slug - title - parentId } + favicon + headerColor + metaTags } - badges { - isEnabled - items { - id - type + coverImage { + url + isPortrait + attribution + photographer + isAttributionHidden + } + brief + readTimeInMinutes + views + series { + id + name + } + reactionCount + responseCount + replyCount + featured + bookmarked + featuredAt + preferences { + pinnedToBlog + disableComments + stickCoverToBottom + isDelisted + } + seo { + title + description + } + ogMetaData { + image + } + hasLatexInPost + isFollowed + isAutoPublishedFromRSS + features { + tableOfContents { + isEnabled + items { + id + level + slug + title + parentId + } + } + badges { + isEnabled + items { + id + type + } } } + sourcedFromGithub } - sourcedFromGithub } } -} -` - +`; diff --git a/src/managers/publication/publication.manager.ts b/src/managers/publication/publication.manager.ts index 5f9dcc9..408b2e2 100644 --- a/src/managers/publication/publication.manager.ts +++ b/src/managers/publication/publication.manager.ts @@ -38,7 +38,12 @@ import { GET_PUBLICATION_STATIC_PAGES_QUERY, SEARCH_POSTS_OF_PUBLICATION, } from './publication.queries'; -import { RECOMMEND_PUBLICATIONS_MUTATION, TOGGLE_ALLOW_CONTRIBUTOR_EDITS_MUTATION, TOGGLE_GPT_BOT_CRAWLING_MUTATION, TOGGLE_TEXT_SELECTION_SHARER_MUTATION } from './publication.mutations'; +import { + RECOMMEND_PUBLICATIONS_MUTATION, + TOGGLE_ALLOW_CONTRIBUTOR_EDITS_MUTATION, + TOGGLE_GPT_BOT_CRAWLING_MUTATION, + TOGGLE_TEXT_SELECTION_SHARER_MUTATION, +} from './publication.mutations'; export class PublicationManager extends BaseManager { /** @@ -525,89 +530,81 @@ export class PublicationManager extends BaseManager { return res.publication.pinnedPost; } - // =======================MUTATIONS======================= - /** - * Recommend publications - * - * @param input - The RecommendPublicationsInput. - * - * @returns The recommended publications. -*/ + * Recommend publications + * + * @param input - The RecommendPublicationsInput. + * + * @returns The recommended publications. + */ async recommendPublication(input: RecommendPublicationsInput) { - const res = await this.makeRequest<{ recommendPublications: RecommendPublicationsPayload }>( - 'recommendPublication', - RECOMMEND_PUBLICATIONS_MUTATION, - { input }, - ); + const res = await this.makeRequest<{ + recommendPublications: RecommendPublicationsPayload; + }>('recommendPublication', RECOMMEND_PUBLICATIONS_MUTATION, { input }); return res.recommendPublications.recommendedPublications; } /** * Remove recommendation - * + * * @param {RemoveRecommendationInput} input - The RemoveRecommendationInput. - * + * * @returns The recommended publications. - */ + */ async removeRecommendation(input: RemoveRecommendationInput) { - const res = await this.makeRequest<{ recommendPublications: RemoveRecommendationPayload }>( - 'removeRecommendation', - RECOMMEND_PUBLICATIONS_MUTATION, - { input }, - ); + const res = await this.makeRequest<{ + recommendPublications: RemoveRecommendationPayload; + }>('removeRecommendation', RECOMMEND_PUBLICATIONS_MUTATION, { input }); return res.recommendPublications.recommendedPublication; } /** * Toggle allowContributorEdits - * + * * @param {ToggleAlloqContrinutorEditsInput} input - The ToggleAlloqContrinutorEditsInput! - * + * * @returns The publication details. - */ + */ async toggleAllowContributorEdits(input: ToggleAllowContributorEditsInput) { - const res = await this.makeRequest<{ toggleAllowContributorEdits: ToggleAllowContributorEditsPayload }>( - 'toggleAllowContributorEdits', - TOGGLE_ALLOW_CONTRIBUTOR_EDITS_MUTATION, - { input }, - ); - return res.toggleAllowContributorEdits.publication + const res = await this.makeRequest<{ + toggleAllowContributorEdits: ToggleAllowContributorEditsPayload; + }>('toggleAllowContributorEdits', TOGGLE_ALLOW_CONTRIBUTOR_EDITS_MUTATION, { + input, + }); + return res.toggleAllowContributorEdits.publication; } /** * Toggle textSelectionSharerMutation - * + * * @param { ToggleTextSelectionSharerInput } input - The ToggleTextSelectionSharerInput - * + * * @returns - The publication details - */ + */ async toggleTextSelectionSharer(input: ToggleTextSelectionSharerInput) { - const res = await this.makeRequest<{ toggleTextSelectionSharer: ToggleTextSelectionSharerPayload }>( - 'toggleTextSelectionSharer', - TOGGLE_TEXT_SELECTION_SHARER_MUTATION, - { input }, - ); + const res = await this.makeRequest<{ + toggleTextSelectionSharer: ToggleTextSelectionSharerPayload; + }>('toggleTextSelectionSharer', TOGGLE_TEXT_SELECTION_SHARER_MUTATION, { + input, + }); return res.toggleTextSelectionSharer.publication; } /** * Toggle GPTBotCrawlingMutation - * + * * @param {ToggleGPTBotCrawlingInput} input - The toggleGPTBotCrawlingInput - * + * * @returns - The publication details - */ + */ async toggleGPTBotCrawling(input: ToggleGptBotCrawlingInput) { - const res = await this.makeRequest<{ toggleGPTBotCrawlingInput: ToggleGptBotCrawlingPayload }>( - 'toggleGPTBotCrawlingInput', - TOGGLE_GPT_BOT_CRAWLING_MUTATION, - { input } - ) - return res.toggleGPTBotCrawlingInput.publication + const res = await this.makeRequest<{ + toggleGPTBotCrawlingInput: ToggleGptBotCrawlingPayload; + }>('toggleGPTBotCrawlingInput', TOGGLE_GPT_BOT_CRAWLING_MUTATION, { + input, + }); + return res.toggleGPTBotCrawlingInput.publication; } - - } diff --git a/src/managers/publication/publication.mutations.ts b/src/managers/publication/publication.mutations.ts index ca6c2b5..22fde6a 100644 --- a/src/managers/publication/publication.mutations.ts +++ b/src/managers/publication/publication.mutations.ts @@ -1,11 +1,134 @@ import { gql } from 'graphql-request'; export const RECOMMEND_PUBLICATIONS_MUTATION = gql` -mutation recommendPublication($input: RecommendPublicationsInput!) { - recommendPublications(input: $input) { - recommendedPublications { - totalFollowersGained - node { + mutation recommendPublication($input: RecommendPublicationsInput!) { + recommendPublications(input: $input) { + recommendedPublications { + totalFollowersGained + node { + id + title + displayTitle + descriptionSEO + about { + markdown + } + url + canonicalURL + author { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack + } + favicon + headerColor + metaTags + integrations { + fbPixelID + fathomSiteID + fathomCustomDomainEnabled + fathomCustomDomain + hotjarSiteID + matomoSiteID + matomoURL + gaTrackingID + plausibleAnalyticsEnabled + wmPaymentPointer + umamiWebsiteUUID + umamiShareId + gTagManagerID + } + followersCount + imprintV2 { + markdown + } + isTeam + links { + website + github + twitter + instagram + facebook + linkedin + youtube + } + domainInfo { + hashnodeSubdomain + domain { + host + ready + status + verifiedAt + } + wwwPrefixedDomain { + host + ready + status + verifiedAt + } + } + isHeadless + ogMetaData { + image + } + isGitHubBackupEnabled + isGithubAsSourceConnected + urlPattern + emailImport { + currentImport { + status + importStartedAt + successfullyImported + attemptedToImport + filename + } + } + redirectionRules { + id + type + source + destination + } + hasBadges + sponsorship { + content { + markdown + } + stripe { + connected + accountId + country + } + } + } + } + } + } +`; + +export const REMOVE_PUBLICATION_RECOMMENDATION_MUTATION = gql` + mutation removeRecommendations($input: RemoveRecommendationInput!) { + removeRecommendation(input: $input) { + recommendedPublication { id title displayTitle @@ -122,263 +245,143 @@ mutation recommendPublication($input: RecommendPublicationsInput!) { } } } -} -` - -export const REMOVE_PUBLICATION_RECOMMENDATION_MUTATION = gql` -mutation removeRecommendations($input: RemoveRecommendationInput!) { - removeRecommendation(input: $input) { - recommendedPublication { - id - title - displayTitle - descriptionSEO - about { - markdown - } - url - canonicalURL - author { - id - username - name - bio { - markdown - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube - } - followersCount - followingsCount - tagline - following - followsBack - } - favicon - headerColor - metaTags - integrations { - fbPixelID - fathomSiteID - fathomCustomDomainEnabled - fathomCustomDomain - hotjarSiteID - matomoSiteID - matomoURL - gaTrackingID - plausibleAnalyticsEnabled - wmPaymentPointer - umamiWebsiteUUID - umamiShareId - gTagManagerID - } - followersCount - imprintV2 { - markdown - } - isTeam - links { - website - github - twitter - instagram - facebook - linkedin - youtube - } - domainInfo { - hashnodeSubdomain - domain { - host - ready - status - verifiedAt - } - wwwPrefixedDomain { - host - ready - status - verifiedAt - } - } - isHeadless - ogMetaData { - image - } - isGitHubBackupEnabled - isGithubAsSourceConnected - urlPattern - emailImport { - currentImport { - status - importStartedAt - successfullyImported - attemptedToImport - filename - } - } - redirectionRules { - id - type - source - destination - } - hasBadges - sponsorship { - content { - markdown - } - stripe { - connected - accountId - country - } - } - } - } -} -` +`; export const TOGGLE_ALLOW_CONTRIBUTOR_EDITS_MUTATION = gql` -mutation toggleAllowContributorEditsMutation($input: ToggleAllowContributorEditsInput!) { - toggleAllowContributorEdits(input: $input) { - publication { - id - title - displayTitle - descriptionSEO - about { - markdown - } - url - canonicalURL - author { + mutation toggleAllowContributorEditsMutation( + $input: ToggleAllowContributorEditsInput! + ) { + toggleAllowContributorEdits(input: $input) { + publication { id - username - name - bio { + title + displayTitle + descriptionSEO + about { markdown } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube + url + canonicalURL + author { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack } - followersCount - followingsCount - tagline - following - followsBack + favicon + headerColor + metaTags } - favicon - headerColor - metaTags } } -} -` +`; export const TOGGLE_TEXT_SELECTION_SHARER_MUTATION = gql` -mutation toggleTextSelectionSharerMutation($input: ToggleTextSelectionSharerInput!) { - toggleTextSelectionSharer(input: $input) { - publication { - id - title - displayTitle - descriptionSEO - about { - markdown - } - url - canonicalURL - author { + mutation toggleTextSelectionSharerMutation( + $input: ToggleTextSelectionSharerInput! + ) { + toggleTextSelectionSharer(input: $input) { + publication { id - username - name - bio { + title + displayTitle + descriptionSEO + about { markdown } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube + url + canonicalURL + author { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack } - followersCount - followingsCount - tagline - following - followsBack + favicon + headerColor + metaTags } - favicon - headerColor - metaTags } } -} -` +`; export const TOGGLE_GPT_BOT_CRAWLING_MUTATION = gql` -mutation toggleGPTBotCrawlingMutation($input: ToggleGPTBotCrawlingInput!) { - toggleGPTBotCrawling(input: $input) { - publication { - id - title - displayTitle - descriptionSEO - about { - markdown - } - url - canonicalURL - author { + mutation toggleGPTBotCrawlingMutation($input: ToggleGPTBotCrawlingInput!) { + toggleGPTBotCrawling(input: $input) { + publication { id - username - name - bio { + title + displayTitle + descriptionSEO + about { markdown } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube + url + canonicalURL + author { + id + username + name + bio { + markdown + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } + followersCount + followingsCount + tagline + following + followsBack } - followersCount - followingsCount - tagline - following - followsBack + favicon + headerColor + metaTags } - favicon - headerColor - metaTags } } -} -` - +`; diff --git a/src/managers/user/user.manager.ts b/src/managers/user/user.manager.ts index 490b1aa..72dcf71 100644 --- a/src/managers/user/user.manager.ts +++ b/src/managers/user/user.manager.ts @@ -198,10 +198,10 @@ export class UserManager extends BaseManager { } /** - * + * * ===================MUTATIONS=================== - * - */ + * + */ /** * Toggles the follow status of a user. diff --git a/src/managers/user/user.mutations.ts b/src/managers/user/user.mutations.ts index 8954bf4..50e8335 100644 --- a/src/managers/user/user.mutations.ts +++ b/src/managers/user/user.mutations.ts @@ -1,28 +1,28 @@ import { gql } from 'graphql-request'; export const TOGGLE_FOLLOW_USER_MUTATION = gql` -mutation toggleFollowUser($id: ID, $username: String) { - toggleFollowUser(id: $id, username: $username) { - user { - id - name - username - bio { - markdown - text - } - profilePicture - socialMediaLinks { - website - github - twitter - instagram - facebook - stackoverflow - linkedin - youtube + mutation toggleFollowUser($id: ID, $username: String) { + toggleFollowUser(id: $id, username: $username) { + user { + id + name + username + bio { + markdown + text + } + profilePicture + socialMediaLinks { + website + github + twitter + instagram + facebook + stackoverflow + linkedin + youtube + } } } } -} -` +`;