Skip to content

Commit

Permalink
feat: supports Post.feed: PostFeedInfo fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarenaldi committed Feb 24, 2025
1 parent 1287367 commit f1a391e
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 66 deletions.
104 changes: 65 additions & 39 deletions packages/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ input AccountBlockedNotificationAttributes {
app: EvmAddress
}

type AccountBlockedResponse {
hash: TxHash!
}

input AccountCreatedNotificationAttributes {
graph: EvmAddress
app: EvmAddress
Expand Down Expand Up @@ -435,6 +439,10 @@ input AccountUnblockedNotificationAttributes {
app: EvmAddress
}

type AccountUnblockedResponse {
hash: TxHash!
}

input AccountUnfollowedNotificationAttributes {
unfollower: EvmAddress
unfollowedAccount: EvmAddress
Expand Down Expand Up @@ -1088,26 +1096,12 @@ type BigDecimalKeyValue {

scalar BigInt

type BlockError {
error: BlockErrorType!
}

enum BlockErrorType {
UNKNOWN
ALREADY_BLOCKED
UNAUTHORIZED
}

input BlockRequest {
"""The account to block."""
account: EvmAddress!
}

type BlockResponse {
hash: TxHash!
}

union BlockResult = BlockResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | BlockError
union BlockResult = AccountBlockedResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

scalar BlockchainData

Expand Down Expand Up @@ -4472,6 +4466,9 @@ type Mutation {
"""
legacyRolloverRefresh(request: RolloverRefreshRequest!): RefreshResult!

"""Refreshes the metadata for the provided entity."""
refreshMetadata(request: EntityId!): RefreshMetadataResult!

"""
Create a new post.
Expand Down Expand Up @@ -4613,7 +4610,7 @@ type Mutation {
"""
Update graph rules
You MUST be authenticated as Account Owner or Account Manager to use this mutation.
You MUST be authenticated as a builder to use this mutation.
"""
updateGraphRules(request: UpdateGraphRulesRequest!): UpdateGraphRulesResult!

Expand All @@ -4627,7 +4624,7 @@ type Mutation {
"""
Create a new username namespace aka deploying a new username contract
You MUST be authenticated as a builder to use this mutation.
You MUST be authenticated to use this mutation.
"""
createUsernameNamespace(request: CreateUsernameNamespaceRequest!): CreateUsernameNamespaceResult!

Expand Down Expand Up @@ -4664,14 +4661,14 @@ type Mutation {
"""
Update namespace rules
You MUST be a namespace owner or admin to use this mutation
You MUST be authenticated to use this mutation.
"""
updateNamespaceRules(request: UpdateNamespaceRulesRequest!): UpdateNamespaceRulesResult!

"""
Update reserved usernames
You MUST be a namespace owner or admin to use this mutation
You MUST be authenticated to use this mutation.
"""
updateReservedUsernames(request: UpdateReservedUsernamesRequest!): UpdateReservedUsernamesResult!

Expand Down Expand Up @@ -4721,7 +4718,7 @@ type Mutation {
"""
Update feed rules
You MUST be authenticated as Account Owner or Account Manager to use this mutation.
You MUST be authenticated as a builder to use this mutation.
"""
updateFeedRules(request: UpdateFeedRulesRequest!): UpdateFeedRulesResult!

Expand All @@ -4735,7 +4732,8 @@ type Mutation {
"""
Update group rules
You MUST be authenticated as Account Owner or Account Manager to use this mutation.
You MUST be authenticated as Account Owner or Account Manager or Builder to use this
mutation.
"""
updateGroupRules(request: UpdateGroupRulesRequest!): UpdateGroupRulesResult!

Expand Down Expand Up @@ -5363,9 +5361,6 @@ type Post {
id: PostId!
slug: PostId!
author: Account!

"""The feed address that the post belongs to."""
feed: EvmAddress!
isEdited: Boolean!
isDeleted: Boolean!
timestamp: DateTime!
Expand All @@ -5381,6 +5376,7 @@ type Post {
rules: PostRules!
collectibleMetadata: NftMetadata!
contentUri(request: PostContentUriRequest! = {useSnapshot: false}): URI!
feed: PostFeedInfo!
}

input PostAccountPair {
Expand Down Expand Up @@ -5479,11 +5475,22 @@ type PostExecutedActions {
firstAt: DateTime!
}

type PostFeedInfo {
address: EvmAddress!
metadata: FeedMetadata
group: PostGroupInfo
}

type PostForYou {
post: Post!
source: ForYouSource!
}

type PostGroupInfo {
address: EvmAddress!
metadata: GroupMetadata
}

scalar PostId

union PostMention = AccountMention | GroupMention
Expand Down Expand Up @@ -5975,6 +5982,9 @@ type Query {
transactionStatus(request: TransactionStatusRequest!): TransactionStatusResult!
debugMetadata(debugMetadataRequest: DebugPostMetadataRequest!): DebugPostMetadataResult!

"""Get the status of a refresh metadata job."""
refreshMetadataStatus(id: UUID!): RefreshMetadataStatusResult!

"""Create a frame typed data"""
createFrameTypedData(request: FrameEIP712Request!): CreateFrameEIP712TypedData!
verifyFrameSignature(request: FrameVerifySignature!): FrameVerifySignatureResult!
Expand Down Expand Up @@ -6070,6 +6080,29 @@ input ReferralCut {
percent: Int!
}

type RefreshMetadataResult {
"""
The id of the refresh metadata job. You can use this id to check the status of the job.
"""
id: UUID!
}

type RefreshMetadataStatusResult {
"""
The id of the refresh metadata job. You can use this id to check the status of the job.
"""
id: UUID!

"""The status of the refresh metadata job."""
status: IndexingStatus!

"""An optional reason in case the status is failed."""
reason: String

"""The timestamp when the refresh metadata job was updated."""
updatedAt: DateTime!
}

input RefreshRequest {
refreshToken: RefreshToken!
}
Expand Down Expand Up @@ -6456,6 +6489,8 @@ enum SnsNotificationType {
MEDIA_SNAPSHOT_ERROR
METADATA_SNAPSHOT_SUCCESS
METADATA_SNAPSHOT_ERROR
REFRESH_METADATA_SUCCESS
REFRESH_METADATA_ERROR
POST_CREATED
QUOTE_CREATED
COMMENT_CREATED
Expand Down Expand Up @@ -6502,6 +6537,8 @@ input SnsTopicInput @oneOf {
mediaSnapshotError: MediaSnapshotNotificationAttributes
metadataSnapshotSuccess: MetadataSnapshotNotificationAttributes
metadataSnapshotError: MetadataSnapshotNotificationAttributes
refreshMetadataSuccess: MetadataSnapshotNotificationAttributes
refreshMetadataError: MetadataSnapshotNotificationAttributes
postCreated: PostCreatedNotificationAttributes
quoteCreated: PostCreatedNotificationAttributes
commentCreated: PostCreatedNotificationAttributes
Expand Down Expand Up @@ -7197,6 +7234,9 @@ enum TransactionOperation {
FEED_FACTORY_DEPLOYMENT
ACCOUNT_BLOCKED
ACCOUNT_UNBLOCKED
ACCOUNT_EXTRA_DATA_ADDED
ACCOUNT_EXTRA_DATA_REMOVED
ACCOUNT_EXTRA_DATA_UPDATED
}

input TransactionStatusRequest {
Expand Down Expand Up @@ -7272,26 +7312,12 @@ type UnbanGroupAccountsResponse {

union UnbanGroupAccountsResult = UnbanGroupAccountsResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

type UnblockError {
error: UnblockErrorType!
}

enum UnblockErrorType {
UNKNOWN
NOT_BLOCKED
UNAUTHORIZED
}

input UnblockRequest {
"""The account to unblock."""
account: EvmAddress!
}

type UnblockResponse {
hash: TxHash!
}

union UnblockResult = UnblockResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | UnblockError
union UnblockResult = AccountUnblockedResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

type UndoReactionFailure {
reason: String!
Expand Down
9 changes: 0 additions & 9 deletions packages/graphql/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,15 +934,6 @@ export enum TransactionType {
Other = 'OTHER',
}

/**
* Enum for UnblockErrorType.
*/
export enum UnblockErrorType {
Unknown = 'UNKNOWN',
NotBlocked = 'NOT_BLOCKED',
Unauthorized = 'UNAUTHORIZED',
}

/**
* Enum for WhoExecutedActionOnAccountOrderBy.
*/
Expand Down
40 changes: 38 additions & 2 deletions packages/graphql/src/fragments/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ import {
TransactionMetadataFragment,
VideoMetadataFragment,
} from './metadata';
import { AppFragment, type FeedRule, FeedRuleFragment } from './primitives';
import {
AppFragment,
FeedMetadataFragment,
type FeedRule,
FeedRuleFragment,
GroupMetadataFragment,
} from './primitives';

export const RecipientPercentFragment = graphql(
`fragment RecipientPercent on RecipientPercent {
Expand Down Expand Up @@ -467,16 +473,45 @@ export const NftMetadataFragment = graphql(
);
export type NftMetadata = FragmentOf<typeof NftMetadataFragment>;

export const PostGroupInfoFragment = graphql(
`fragment PostGroupInfo on PostGroupInfo {
__typename
address
metadata {
...GroupMetadata
}
}`,
[GroupMetadataFragment],
);
export type PostGroupInfo = FragmentOf<typeof PostGroupInfoFragment>;

export const PostFeedInfoFragment = graphql(
`fragment PostFeedInfo on PostFeedInfo {
__typename
address
metadata {
...FeedMetadata
}
group {
...PostGroupInfo
}
}`,
[FeedMetadataFragment, PostGroupInfoFragment],
);
export type PostFeedInfo = FragmentOf<typeof PostFeedInfoFragment>;

const PostFieldsFragment = graphql(
`fragment PostFields on Post {
__typename
slug
feed
isDeleted
isEdited
timestamp
contentUri
snapshotUrl: contentUri(request: { useSnapshot: true })
feed {
...PostFeedInfo
}
app {
...App
}
Expand All @@ -503,6 +538,7 @@ const PostFieldsFragment = graphql(
}
}`,
[
PostFeedInfoFragment,
AppFragment,
PostMetadataFragment,
PostMentionFragment,
Expand Down
28 changes: 14 additions & 14 deletions packages/graphql/src/graphql-env.d.ts

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions packages/graphql/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ import type {
TimelineEventItemType,
TokenStandard,
TransactionType,
UnblockErrorType,
WhoExecutedActionOnAccountOrderBy,
WhoExecutedActionOnPostOrderBy,
WhoReferencedPostOrderBy,
Expand Down Expand Up @@ -207,7 +206,6 @@ export const graphql = initGraphQLTada<{
// TransactionOperation: TransactionOperation; intentionally not mapped since it grows often and it's a debug information
TransactionType: TransactionType;
TxHash: TxHash;
UnblockErrorType: UnblockErrorType;
URI: URI;
URL: URL;
UsernameValue: UsernameValue;
Expand Down

0 comments on commit f1a391e

Please sign in to comment.