From a7172a206f5849b3d742d753c0a54cfe7841907c Mon Sep 17 00:00:00 2001 From: jarrel Date: Tue, 19 Sep 2023 11:47:55 -0700 Subject: [PATCH] Add mutation for syncing existing creator contracts (#1188) * Add admin query * Graphql lint * Use chainAddress instead --- graphql/generated/generated.go | 444 ++++++++++++++++++++++----- graphql/model/models_gen.go | 283 +++++++++-------- graphql/model/remapgen_gen.go | 5 + graphql/resolver/schema.resolvers.go | 22 ++ graphql/schema/schema.graphql | 15 + publicapi/token.go | 25 ++ 6 files changed, 575 insertions(+), 219 deletions(-) diff --git a/graphql/generated/generated.go b/graphql/generated/generated.go index a5161dbca..7788206bc 100644 --- a/graphql/generated/generated.go +++ b/graphql/generated/generated.go @@ -784,84 +784,85 @@ type ComplexityRoot struct { } Mutation struct { - AddRolesToUser func(childComplexity int, username string, roles []*persist.Role) int - AddUserWallet func(childComplexity int, chainAddress persist.ChainAddress, authMechanism model.AuthMechanism) int - AddWalletToUserUnchecked func(childComplexity int, input model.AdminAddWalletInput) int - AdmireFeedEvent func(childComplexity int, feedEventID persist.DBID) int - AdmirePost func(childComplexity int, postID persist.DBID) int - AdmireToken func(childComplexity int, tokenID persist.DBID) int - BanUserFromFeed func(childComplexity int, username string, action string) int - ClearAllNotifications func(childComplexity int) int - CommentOnFeedEvent func(childComplexity int, feedEventID persist.DBID, replyToID *persist.DBID, comment string) int - CommentOnPost func(childComplexity int, postID persist.DBID, replyToID *persist.DBID, comment string) int - ConnectSocialAccount func(childComplexity int, input model.SocialAuthMechanism, display bool) int - CreateCollection func(childComplexity int, input model.CreateCollectionInput) int - CreateGallery func(childComplexity int, input model.CreateGalleryInput) int - CreateUser func(childComplexity int, authMechanism model.AuthMechanism, input model.CreateUserInput) int - DeleteCollection func(childComplexity int, collectionID persist.DBID) int - DeleteGallery func(childComplexity int, galleryID persist.DBID) int - DeletePost func(childComplexity int, postID persist.DBID) int - DisconnectSocialAccount func(childComplexity int, accountType persist.SocialProvider) int - FollowAllSocialConnections func(childComplexity int, accountType persist.SocialProvider) int - FollowUser func(childComplexity int, userID persist.DBID) int - GenerateQRCodeLoginToken func(childComplexity int) int - GetAuthNonce func(childComplexity int, chainAddress persist.ChainAddress) int - Login func(childComplexity int, authMechanism model.AuthMechanism) int - Logout func(childComplexity int, pushTokenToUnregister *string) int - MintPremiumCardToWallet func(childComplexity int, input model.MintPremiumCardToWalletInput) int - MoveCollectionToGallery func(childComplexity int, input *model.MoveCollectionToGalleryInput) int - OptInForRoles func(childComplexity int, roles []persist.Role) int - OptOutForRoles func(childComplexity int, roles []persist.Role) int - PostTokens func(childComplexity int, input model.PostTokensInput) int - PreverifyEmail func(childComplexity int, input model.PreverifyEmailInput) int - PublishGallery func(childComplexity int, input model.PublishGalleryInput) int - RedeemMerch func(childComplexity int, input model.RedeemMerchInput) int - ReferralPostPreflight func(childComplexity int, input model.ReferralPostPreflightInput) int - ReferralPostToken func(childComplexity int, input model.ReferralPostTokenInput) int - RefreshCollection func(childComplexity int, collectionID persist.DBID) int - RefreshContract func(childComplexity int, contractID persist.DBID) int - RefreshToken func(childComplexity int, tokenID persist.DBID) int - RegisterUserPushToken func(childComplexity int, pushToken string) int - RemoveAdmire func(childComplexity int, admireID persist.DBID) int - RemoveComment func(childComplexity int, commentID persist.DBID) int - RemoveProfileImage func(childComplexity int) int - RemoveUserWallets func(childComplexity int, walletIds []persist.DBID) int - ResendVerificationEmail func(childComplexity int) int - RevokeRolesFromUser func(childComplexity int, username string, roles []*persist.Role) int - SetCommunityOverrideCreator func(childComplexity int, communityID persist.DBID, creatorUserID *persist.DBID) int - SetProfileImage func(childComplexity int, input model.SetProfileImageInput) int - SetSpamPreference func(childComplexity int, input model.SetSpamPreferenceInput) int - SyncCreatedTokensForExistingContract func(childComplexity int, input model.SyncCreatedTokensForExistingContractInput) int - SyncCreatedTokensForNewContracts func(childComplexity int, input model.SyncCreatedTokensForNewContractsInput) int - SyncCreatedTokensForUsername func(childComplexity int, username string, chains []persist.Chain) int - SyncTokens func(childComplexity int, chains []persist.Chain) int - SyncTokensForUsername func(childComplexity int, username string, chains []persist.Chain) int - UnbanUserFromFeed func(childComplexity int, username string) int - UnfollowUser func(childComplexity int, userID persist.DBID) int - UnregisterUserPushToken func(childComplexity int, pushToken string) int - UnsubscribeFromEmailType func(childComplexity int, input model.UnsubscribeFromEmailTypeInput) int - UpdateCollectionHidden func(childComplexity int, input model.UpdateCollectionHiddenInput) int - UpdateCollectionInfo func(childComplexity int, input model.UpdateCollectionInfoInput) int - UpdateCollectionTokens func(childComplexity int, input model.UpdateCollectionTokensInput) int - UpdateEmail func(childComplexity int, input model.UpdateEmailInput) int - UpdateEmailNotificationSettings func(childComplexity int, input model.UpdateEmailNotificationSettingsInput) int - UpdateFeaturedGallery func(childComplexity int, galleryID persist.DBID) int - UpdateGallery func(childComplexity int, input model.UpdateGalleryInput) int - UpdateGalleryCollections func(childComplexity int, input model.UpdateGalleryCollectionsInput) int - UpdateGalleryHidden func(childComplexity int, input model.UpdateGalleryHiddenInput) int - UpdateGalleryInfo func(childComplexity int, input model.UpdateGalleryInfoInput) int - UpdateGalleryOrder func(childComplexity int, input model.UpdateGalleryOrderInput) int - UpdateNotificationSettings func(childComplexity int, settings *model.NotificationSettingsInput) int - UpdatePrimaryWallet func(childComplexity int, walletID persist.DBID) int - UpdateSocialAccountDisplayed func(childComplexity int, input model.UpdateSocialAccountDisplayedInput) int - UpdateTokenInfo func(childComplexity int, input model.UpdateTokenInfoInput) int - UpdateUserExperience func(childComplexity int, input model.UpdateUserExperienceInput) int - UpdateUserInfo func(childComplexity int, input model.UpdateUserInfoInput) int - UploadPersistedQueries func(childComplexity int, input *model.UploadPersistedQueriesInput) int - VerifyEmail func(childComplexity int, input model.VerifyEmailInput) int - VerifyEmailMagicLink func(childComplexity int, input model.VerifyEmailMagicLinkInput) int - ViewGallery func(childComplexity int, galleryID persist.DBID) int - ViewToken func(childComplexity int, tokenID persist.DBID, collectionID persist.DBID) int + AddRolesToUser func(childComplexity int, username string, roles []*persist.Role) int + AddUserWallet func(childComplexity int, chainAddress persist.ChainAddress, authMechanism model.AuthMechanism) int + AddWalletToUserUnchecked func(childComplexity int, input model.AdminAddWalletInput) int + AdmireFeedEvent func(childComplexity int, feedEventID persist.DBID) int + AdmirePost func(childComplexity int, postID persist.DBID) int + AdmireToken func(childComplexity int, tokenID persist.DBID) int + BanUserFromFeed func(childComplexity int, username string, action string) int + ClearAllNotifications func(childComplexity int) int + CommentOnFeedEvent func(childComplexity int, feedEventID persist.DBID, replyToID *persist.DBID, comment string) int + CommentOnPost func(childComplexity int, postID persist.DBID, replyToID *persist.DBID, comment string) int + ConnectSocialAccount func(childComplexity int, input model.SocialAuthMechanism, display bool) int + CreateCollection func(childComplexity int, input model.CreateCollectionInput) int + CreateGallery func(childComplexity int, input model.CreateGalleryInput) int + CreateUser func(childComplexity int, authMechanism model.AuthMechanism, input model.CreateUserInput) int + DeleteCollection func(childComplexity int, collectionID persist.DBID) int + DeleteGallery func(childComplexity int, galleryID persist.DBID) int + DeletePost func(childComplexity int, postID persist.DBID) int + DisconnectSocialAccount func(childComplexity int, accountType persist.SocialProvider) int + FollowAllSocialConnections func(childComplexity int, accountType persist.SocialProvider) int + FollowUser func(childComplexity int, userID persist.DBID) int + GenerateQRCodeLoginToken func(childComplexity int) int + GetAuthNonce func(childComplexity int, chainAddress persist.ChainAddress) int + Login func(childComplexity int, authMechanism model.AuthMechanism) int + Logout func(childComplexity int, pushTokenToUnregister *string) int + MintPremiumCardToWallet func(childComplexity int, input model.MintPremiumCardToWalletInput) int + MoveCollectionToGallery func(childComplexity int, input *model.MoveCollectionToGalleryInput) int + OptInForRoles func(childComplexity int, roles []persist.Role) int + OptOutForRoles func(childComplexity int, roles []persist.Role) int + PostTokens func(childComplexity int, input model.PostTokensInput) int + PreverifyEmail func(childComplexity int, input model.PreverifyEmailInput) int + PublishGallery func(childComplexity int, input model.PublishGalleryInput) int + RedeemMerch func(childComplexity int, input model.RedeemMerchInput) int + ReferralPostPreflight func(childComplexity int, input model.ReferralPostPreflightInput) int + ReferralPostToken func(childComplexity int, input model.ReferralPostTokenInput) int + RefreshCollection func(childComplexity int, collectionID persist.DBID) int + RefreshContract func(childComplexity int, contractID persist.DBID) int + RefreshToken func(childComplexity int, tokenID persist.DBID) int + RegisterUserPushToken func(childComplexity int, pushToken string) int + RemoveAdmire func(childComplexity int, admireID persist.DBID) int + RemoveComment func(childComplexity int, commentID persist.DBID) int + RemoveProfileImage func(childComplexity int) int + RemoveUserWallets func(childComplexity int, walletIds []persist.DBID) int + ResendVerificationEmail func(childComplexity int) int + RevokeRolesFromUser func(childComplexity int, username string, roles []*persist.Role) int + SetCommunityOverrideCreator func(childComplexity int, communityID persist.DBID, creatorUserID *persist.DBID) int + SetProfileImage func(childComplexity int, input model.SetProfileImageInput) int + SetSpamPreference func(childComplexity int, input model.SetSpamPreferenceInput) int + SyncCreatedTokensForExistingContract func(childComplexity int, input model.SyncCreatedTokensForExistingContractInput) int + SyncCreatedTokensForNewContracts func(childComplexity int, input model.SyncCreatedTokensForNewContractsInput) int + SyncCreatedTokensForUsername func(childComplexity int, username string, chains []persist.Chain) int + SyncCreatedTokensForUsernameAndExistingContract func(childComplexity int, username string, chainAddress persist.ChainAddress) int + SyncTokens func(childComplexity int, chains []persist.Chain) int + SyncTokensForUsername func(childComplexity int, username string, chains []persist.Chain) int + UnbanUserFromFeed func(childComplexity int, username string) int + UnfollowUser func(childComplexity int, userID persist.DBID) int + UnregisterUserPushToken func(childComplexity int, pushToken string) int + UnsubscribeFromEmailType func(childComplexity int, input model.UnsubscribeFromEmailTypeInput) int + UpdateCollectionHidden func(childComplexity int, input model.UpdateCollectionHiddenInput) int + UpdateCollectionInfo func(childComplexity int, input model.UpdateCollectionInfoInput) int + UpdateCollectionTokens func(childComplexity int, input model.UpdateCollectionTokensInput) int + UpdateEmail func(childComplexity int, input model.UpdateEmailInput) int + UpdateEmailNotificationSettings func(childComplexity int, input model.UpdateEmailNotificationSettingsInput) int + UpdateFeaturedGallery func(childComplexity int, galleryID persist.DBID) int + UpdateGallery func(childComplexity int, input model.UpdateGalleryInput) int + UpdateGalleryCollections func(childComplexity int, input model.UpdateGalleryCollectionsInput) int + UpdateGalleryHidden func(childComplexity int, input model.UpdateGalleryHiddenInput) int + UpdateGalleryInfo func(childComplexity int, input model.UpdateGalleryInfoInput) int + UpdateGalleryOrder func(childComplexity int, input model.UpdateGalleryOrderInput) int + UpdateNotificationSettings func(childComplexity int, settings *model.NotificationSettingsInput) int + UpdatePrimaryWallet func(childComplexity int, walletID persist.DBID) int + UpdateSocialAccountDisplayed func(childComplexity int, input model.UpdateSocialAccountDisplayedInput) int + UpdateTokenInfo func(childComplexity int, input model.UpdateTokenInfoInput) int + UpdateUserExperience func(childComplexity int, input model.UpdateUserExperienceInput) int + UpdateUserInfo func(childComplexity int, input model.UpdateUserInfoInput) int + UploadPersistedQueries func(childComplexity int, input *model.UploadPersistedQueriesInput) int + VerifyEmail func(childComplexity int, input model.VerifyEmailInput) int + VerifyEmailMagicLink func(childComplexity int, input model.VerifyEmailMagicLinkInput) int + ViewGallery func(childComplexity int, galleryID persist.DBID) int + ViewToken func(childComplexity int, tokenID persist.DBID, collectionID persist.DBID) int } NewTokensNotification struct { @@ -1241,6 +1242,10 @@ type ComplexityRoot struct { Viewer func(childComplexity int) int } + SyncCreatedTokensForUsernameAndExistingContractPayload struct { + Message func(childComplexity int) int + } + SyncCreatedTokensForUsernamePayload struct { Message func(childComplexity int) int } @@ -1767,6 +1772,7 @@ type MutationResolver interface { RevokeRolesFromUser(ctx context.Context, username string, roles []*persist.Role) (model.RevokeRolesFromUserPayloadOrError, error) SyncTokensForUsername(ctx context.Context, username string, chains []persist.Chain) (model.SyncTokensForUsernamePayloadOrError, error) SyncCreatedTokensForUsername(ctx context.Context, username string, chains []persist.Chain) (model.SyncCreatedTokensForUsernamePayloadOrError, error) + SyncCreatedTokensForUsernameAndExistingContract(ctx context.Context, username string, chainAddress persist.ChainAddress) (model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError, error) BanUserFromFeed(ctx context.Context, username string, action string) (model.BanUserFromFeedPayloadOrError, error) UnbanUserFromFeed(ctx context.Context, username string) (model.UnbanUserFromFeedPayloadOrError, error) MintPremiumCardToWallet(ctx context.Context, input model.MintPremiumCardToWalletInput) (model.MintPremiumCardToWalletPayloadOrError, error) @@ -5033,6 +5039,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.SyncCreatedTokensForUsername(childComplexity, args["username"].(string), args["chains"].([]persist.Chain)), true + case "Mutation.syncCreatedTokensForUsernameAndExistingContract": + if e.complexity.Mutation.SyncCreatedTokensForUsernameAndExistingContract == nil { + break + } + + args, err := ec.field_Mutation_syncCreatedTokensForUsernameAndExistingContract_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.SyncCreatedTokensForUsernameAndExistingContract(childComplexity, args["username"].(string), args["chainAddress"].(persist.ChainAddress)), true + case "Mutation.syncTokens": if e.complexity.Mutation.SyncTokens == nil { break @@ -6996,6 +7014,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SyncCreatedTokensForNewContractsPayload.Viewer(childComplexity), true + case "SyncCreatedTokensForUsernameAndExistingContractPayload.message": + if e.complexity.SyncCreatedTokensForUsernameAndExistingContractPayload.Message == nil { + break + } + + return e.complexity.SyncCreatedTokensForUsernameAndExistingContractPayload.Message(childComplexity), true + case "SyncCreatedTokensForUsernamePayload.message": if e.complexity.SyncCreatedTokensForUsernamePayload.Message == nil { break @@ -8828,8 +8853,13 @@ type Community implements Node @goEmbedHelper { posts(before: String, after: String, first: Int, last: Int): PostsConnection @goField(forceResolver: true) - tmpPostsWithProjectID(projectID: Int!, before: String, after: String, first: Int, last: Int): PostsConnection - @goField(forceResolver: true) + tmpPostsWithProjectID( + projectID: Int! + before: String + after: String + first: Int + last: Int + ): PostsConnection @goField(forceResolver: true) } type Contract implements Node { @@ -9578,7 +9608,9 @@ type Query { first: Int last: Int ): CollectionsConnection - postComposerDraftDetails(input: PostComposerDraftDetailsInput!): PostComposerDraftDetailsPayloadOrError + postComposerDraftDetails( + input: PostComposerDraftDetailsInput! + ): PostComposerDraftDetailsPayloadOrError } type SocialQueries { @@ -10390,6 +10422,17 @@ union SyncCreatedTokensForUsernamePayloadOrError = | ErrNotAuthorized | ErrSyncFailed +type SyncCreatedTokensForUsernameAndExistingContractPayload { + message: String! +} + +union SyncCreatedTokensForUsernameAndExistingContractPayloadOrError = + SyncCreatedTokensForUsernameAndExistingContractPayload + | ErrInvalidInput + | ErrNotAuthorized + | ErrSyncFailed + | ErrCommunityNotFound + type BanUserFromFeedPayload { user: GalleryUser } @@ -10891,6 +10934,10 @@ type Mutation { username: String! chains: [Chain!]! ): SyncCreatedTokensForUsernamePayloadOrError @retoolAuth + syncCreatedTokensForUsernameAndExistingContract( + username: String! + chainAddress: ChainAddressInput! + ): SyncCreatedTokensForUsernameAndExistingContractPayloadOrError @retoolAuth banUserFromFeed(username: String!, action: String!): BanUserFromFeedPayloadOrError @retoolAuth unbanUserFromFeed(username: String!): UnbanUserFromFeedPayloadOrError @retoolAuth mintPremiumCardToWallet( @@ -12392,6 +12439,30 @@ func (ec *executionContext) field_Mutation_syncCreatedTokensForNewContracts_args return args, nil } +func (ec *executionContext) field_Mutation_syncCreatedTokensForUsernameAndExistingContract_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["username"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["username"] = arg0 + var arg1 persist.ChainAddress + if tmp, ok := rawArgs["chainAddress"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chainAddress")) + arg1, err = ec.unmarshalNChainAddressInput2githubᚗcomᚋmikeydubᚋgoᚑgalleryᚋserviceᚋpersistᚐChainAddress(ctx, tmp) + if err != nil { + return nil, err + } + } + args["chainAddress"] = arg1 + return args, nil +} + func (ec *executionContext) field_Mutation_syncCreatedTokensForUsername_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -36445,6 +36516,78 @@ func (ec *executionContext) fieldContext_Mutation_syncCreatedTokensForUsername(c return fc, nil } +func (ec *executionContext) _Mutation_syncCreatedTokensForUsernameAndExistingContract(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_syncCreatedTokensForUsernameAndExistingContract(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().SyncCreatedTokensForUsernameAndExistingContract(rctx, fc.Args["username"].(string), fc.Args["chainAddress"].(persist.ChainAddress)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.RetoolAuth == nil { + return nil, errors.New("directive retoolAuth is not implemented") + } + return ec.directives.RetoolAuth(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be github.com/mikeydub/go-gallery/graphql/model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError) + fc.Result = res + return ec.marshalOSyncCreatedTokensForUsernameAndExistingContractPayloadOrError2githubᚗcomᚋmikeydubᚋgoᚑgalleryᚋgraphqlᚋmodelᚐSyncCreatedTokensForUsernameAndExistingContractPayloadOrError(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_syncCreatedTokensForUsernameAndExistingContract(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SyncCreatedTokensForUsernameAndExistingContractPayloadOrError does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_syncCreatedTokensForUsernameAndExistingContract_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return + } + return fc, nil +} + func (ec *executionContext) _Mutation_banUserFromFeed(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_banUserFromFeed(ctx, field) if err != nil { @@ -39865,6 +40008,8 @@ func (ec *executionContext) fieldContext_PostComposerDraftDetailsPayload_communi return ec.fieldContext_Community_owners(ctx, field) case "posts": return ec.fieldContext_Community_posts(ctx, field) + case "tmpPostsWithProjectID": + return ec.fieldContext_Community_tmpPostsWithProjectID(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Community", field.Name) }, @@ -47948,6 +48093,50 @@ func (ec *executionContext) fieldContext_SyncCreatedTokensForNewContractsPayload return fc, nil } +func (ec *executionContext) _SyncCreatedTokensForUsernameAndExistingContractPayload_message(ctx context.Context, field graphql.CollectedField, obj *model.SyncCreatedTokensForUsernameAndExistingContractPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SyncCreatedTokensForUsernameAndExistingContractPayload_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SyncCreatedTokensForUsernameAndExistingContractPayload_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SyncCreatedTokensForUsernameAndExistingContractPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _SyncCreatedTokensForUsernamePayload_message(ctx context.Context, field graphql.CollectedField, obj *model.SyncCreatedTokensForUsernamePayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SyncCreatedTokensForUsernamePayload_message(ctx, field) if err != nil { @@ -63390,6 +63579,50 @@ func (ec *executionContext) _SyncCreatedTokensForNewContractsPayloadOrError(ctx } } +func (ec *executionContext) _SyncCreatedTokensForUsernameAndExistingContractPayloadOrError(ctx context.Context, sel ast.SelectionSet, obj model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case model.SyncCreatedTokensForUsernameAndExistingContractPayload: + return ec._SyncCreatedTokensForUsernameAndExistingContractPayload(ctx, sel, &obj) + case *model.SyncCreatedTokensForUsernameAndExistingContractPayload: + if obj == nil { + return graphql.Null + } + return ec._SyncCreatedTokensForUsernameAndExistingContractPayload(ctx, sel, obj) + case model.ErrInvalidInput: + return ec._ErrInvalidInput(ctx, sel, &obj) + case *model.ErrInvalidInput: + if obj == nil { + return graphql.Null + } + return ec._ErrInvalidInput(ctx, sel, obj) + case model.ErrNotAuthorized: + return ec._ErrNotAuthorized(ctx, sel, &obj) + case *model.ErrNotAuthorized: + if obj == nil { + return graphql.Null + } + return ec._ErrNotAuthorized(ctx, sel, obj) + case model.ErrSyncFailed: + return ec._ErrSyncFailed(ctx, sel, &obj) + case *model.ErrSyncFailed: + if obj == nil { + return graphql.Null + } + return ec._ErrSyncFailed(ctx, sel, obj) + case model.ErrCommunityNotFound: + return ec._ErrCommunityNotFound(ctx, sel, &obj) + case *model.ErrCommunityNotFound: + if obj == nil { + return graphql.Null + } + return ec._ErrCommunityNotFound(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + func (ec *executionContext) _SyncCreatedTokensForUsernamePayloadOrError(ctx context.Context, sel ast.SelectionSet, obj model.SyncCreatedTokensForUsernamePayloadOrError) graphql.Marshaler { switch obj := (obj).(type) { case nil: @@ -66774,7 +67007,7 @@ func (ec *executionContext) _ErrCommentNotFound(ctx context.Context, sel ast.Sel return out } -var errCommunityNotFoundImplementors = []string{"ErrCommunityNotFound", "CommunityByAddressOrError", "Error"} +var errCommunityNotFoundImplementors = []string{"ErrCommunityNotFound", "CommunityByAddressOrError", "Error", "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError"} func (ec *executionContext) _ErrCommunityNotFound(ctx context.Context, sel ast.SelectionSet, obj *model.ErrCommunityNotFound) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, errCommunityNotFoundImplementors) @@ -66942,7 +67175,7 @@ func (ec *executionContext) _ErrGalleryNotFound(ctx context.Context, sel ast.Sel return out } -var errInvalidInputImplementors = []string{"ErrInvalidInput", "UserByUsernameOrError", "UserByIdOrError", "UserByAddressOrError", "CollectionByIdOrError", "CommunityByAddressOrError", "PostOrError", "SocialConnectionsOrError", "MerchTokensPayloadOrError", "SearchUsersPayloadOrError", "SearchGalleriesPayloadOrError", "SearchCommunitiesPayloadOrError", "PostComposerDraftDetailsPayloadOrError", "CreateCollectionPayloadOrError", "DeleteCollectionPayloadOrError", "UpdateCollectionInfoPayloadOrError", "UpdateCollectionTokensPayloadOrError", "UpdateCollectionHiddenPayloadOrError", "UpdateGalleryCollectionsPayloadOrError", "UpdateTokenInfoPayloadOrError", "AddUserWalletPayloadOrError", "RemoveUserWalletsPayloadOrError", "UpdateUserInfoPayloadOrError", "RegisterUserPushTokenPayloadOrError", "UnregisterUserPushTokenPayloadOrError", "RefreshTokenPayloadOrError", "RefreshCollectionPayloadOrError", "RefreshContractPayloadOrError", "Error", "CreateUserPayloadOrError", "FollowUserPayloadOrError", "UnfollowUserPayloadOrError", "AdmireFeedEventPayloadOrError", "RemoveAdmirePayloadOrError", "CommentOnFeedEventPayloadOrError", "RemoveCommentPayloadOrError", "VerifyEmailPayloadOrError", "PreverifyEmailPayloadOrError", "VerifyEmailMagicLinkPayloadOrError", "UpdateEmailPayloadOrError", "ResendVerificationEmailPayloadOrError", "UpdateEmailNotificationSettingsPayloadOrError", "UnsubscribeFromEmailTypePayloadOrError", "OptInForRolesPayloadOrError", "OptOutForRolesPayloadOrError", "RedeemMerchPayloadOrError", "CreateGalleryPayloadOrError", "UpdateGalleryInfoPayloadOrError", "UpdateGalleryHiddenPayloadOrError", "DeleteGalleryPayloadOrError", "UpdateGalleryOrderPayloadOrError", "UpdateFeaturedGalleryPayloadOrError", "UpdateGalleryPayloadOrError", "PublishGalleryPayloadOrError", "UpdatePrimaryWalletPayloadOrError", "UpdateUserExperiencePayloadOrError", "MoveCollectionToGalleryPayloadOrError", "ConnectSocialAccountPayloadOrError", "UpdateSocialAccountDisplayedPayloadOrError", "MintPremiumCardToWalletPayloadOrError", "DisconnectSocialAccountPayloadOrError", "FollowAllSocialConnectionsPayloadOrError", "SetProfileImagePayloadOrError", "PostTokensPayloadOrError", "ReferralPostTokenPayloadOrError", "AdmirePostPayloadOrError", "AdmireTokenPayloadOrError", "CommentOnPostPayloadOrError", "DeletePostPayloadOrError", "ReferralPostPreflightPayloadOrError"} +var errInvalidInputImplementors = []string{"ErrInvalidInput", "UserByUsernameOrError", "UserByIdOrError", "UserByAddressOrError", "CollectionByIdOrError", "CommunityByAddressOrError", "PostOrError", "SocialConnectionsOrError", "MerchTokensPayloadOrError", "SearchUsersPayloadOrError", "SearchGalleriesPayloadOrError", "SearchCommunitiesPayloadOrError", "PostComposerDraftDetailsPayloadOrError", "CreateCollectionPayloadOrError", "DeleteCollectionPayloadOrError", "UpdateCollectionInfoPayloadOrError", "UpdateCollectionTokensPayloadOrError", "UpdateCollectionHiddenPayloadOrError", "UpdateGalleryCollectionsPayloadOrError", "UpdateTokenInfoPayloadOrError", "AddUserWalletPayloadOrError", "RemoveUserWalletsPayloadOrError", "UpdateUserInfoPayloadOrError", "RegisterUserPushTokenPayloadOrError", "UnregisterUserPushTokenPayloadOrError", "RefreshTokenPayloadOrError", "RefreshCollectionPayloadOrError", "RefreshContractPayloadOrError", "Error", "CreateUserPayloadOrError", "FollowUserPayloadOrError", "UnfollowUserPayloadOrError", "AdmireFeedEventPayloadOrError", "RemoveAdmirePayloadOrError", "CommentOnFeedEventPayloadOrError", "RemoveCommentPayloadOrError", "VerifyEmailPayloadOrError", "PreverifyEmailPayloadOrError", "VerifyEmailMagicLinkPayloadOrError", "UpdateEmailPayloadOrError", "ResendVerificationEmailPayloadOrError", "UpdateEmailNotificationSettingsPayloadOrError", "UnsubscribeFromEmailTypePayloadOrError", "OptInForRolesPayloadOrError", "OptOutForRolesPayloadOrError", "RedeemMerchPayloadOrError", "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError", "CreateGalleryPayloadOrError", "UpdateGalleryInfoPayloadOrError", "UpdateGalleryHiddenPayloadOrError", "DeleteGalleryPayloadOrError", "UpdateGalleryOrderPayloadOrError", "UpdateFeaturedGalleryPayloadOrError", "UpdateGalleryPayloadOrError", "PublishGalleryPayloadOrError", "UpdatePrimaryWalletPayloadOrError", "UpdateUserExperiencePayloadOrError", "MoveCollectionToGalleryPayloadOrError", "ConnectSocialAccountPayloadOrError", "UpdateSocialAccountDisplayedPayloadOrError", "MintPremiumCardToWalletPayloadOrError", "DisconnectSocialAccountPayloadOrError", "FollowAllSocialConnectionsPayloadOrError", "SetProfileImagePayloadOrError", "PostTokensPayloadOrError", "ReferralPostTokenPayloadOrError", "AdmirePostPayloadOrError", "AdmireTokenPayloadOrError", "CommentOnPostPayloadOrError", "DeletePostPayloadOrError", "ReferralPostPreflightPayloadOrError"} func (ec *executionContext) _ErrInvalidInput(ctx context.Context, sel ast.SelectionSet, obj *model.ErrInvalidInput) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, errInvalidInputImplementors) @@ -67075,7 +67308,7 @@ func (ec *executionContext) _ErrNoCookie(ctx context.Context, sel ast.SelectionS return out } -var errNotAuthorizedImplementors = []string{"ErrNotAuthorized", "ViewerOrError", "SocialQueriesOrError", "CreateCollectionPayloadOrError", "DeleteCollectionPayloadOrError", "UpdateCollectionInfoPayloadOrError", "UpdateCollectionTokensPayloadOrError", "UpdateCollectionHiddenPayloadOrError", "UpdateGalleryCollectionsPayloadOrError", "UpdateTokenInfoPayloadOrError", "SetSpamPreferencePayloadOrError", "AddUserWalletPayloadOrError", "RemoveUserWalletsPayloadOrError", "UpdateUserInfoPayloadOrError", "RegisterUserPushTokenPayloadOrError", "UnregisterUserPushTokenPayloadOrError", "SyncTokensPayloadOrError", "SyncCreatedTokensForNewContractsPayloadOrError", "SyncCreatedTokensForExistingContractPayloadOrError", "Error", "AddRolesToUserPayloadOrError", "RevokeRolesFromUserPayloadOrError", "OptInForRolesPayloadOrError", "OptOutForRolesPayloadOrError", "UploadPersistedQueriesPayloadOrError", "SyncTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernamePayloadOrError", "BanUserFromFeedPayloadOrError", "UnbanUserFromFeedPayloadOrError", "SetCommunityOverrideCreatorPayloadOrError", "CreateGalleryPayloadOrError", "UpdateGalleryInfoPayloadOrError", "UpdateGalleryHiddenPayloadOrError", "DeleteGalleryPayloadOrError", "UpdateGalleryOrderPayloadOrError", "UpdateFeaturedGalleryPayloadOrError", "UpdateGalleryPayloadOrError", "PublishGalleryPayloadOrError", "UpdatePrimaryWalletPayloadOrError", "AdminAddWalletPayloadOrError", "UpdateUserExperiencePayloadOrError", "MoveCollectionToGalleryPayloadOrError", "ConnectSocialAccountPayloadOrError", "UpdateSocialAccountDisplayedPayloadOrError", "MintPremiumCardToWalletPayloadOrError", "DisconnectSocialAccountPayloadOrError", "FollowAllSocialConnectionsPayloadOrError", "GenerateQRCodeLoginTokenPayloadOrError", "SetProfileImagePayloadOrError", "PostTokensPayloadOrError", "ReferralPostTokenPayloadOrError", "AdmirePostPayloadOrError", "AdmireTokenPayloadOrError", "CommentOnPostPayloadOrError", "DeletePostPayloadOrError"} +var errNotAuthorizedImplementors = []string{"ErrNotAuthorized", "ViewerOrError", "SocialQueriesOrError", "CreateCollectionPayloadOrError", "DeleteCollectionPayloadOrError", "UpdateCollectionInfoPayloadOrError", "UpdateCollectionTokensPayloadOrError", "UpdateCollectionHiddenPayloadOrError", "UpdateGalleryCollectionsPayloadOrError", "UpdateTokenInfoPayloadOrError", "SetSpamPreferencePayloadOrError", "AddUserWalletPayloadOrError", "RemoveUserWalletsPayloadOrError", "UpdateUserInfoPayloadOrError", "RegisterUserPushTokenPayloadOrError", "UnregisterUserPushTokenPayloadOrError", "SyncTokensPayloadOrError", "SyncCreatedTokensForNewContractsPayloadOrError", "SyncCreatedTokensForExistingContractPayloadOrError", "Error", "AddRolesToUserPayloadOrError", "RevokeRolesFromUserPayloadOrError", "OptInForRolesPayloadOrError", "OptOutForRolesPayloadOrError", "UploadPersistedQueriesPayloadOrError", "SyncTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError", "BanUserFromFeedPayloadOrError", "UnbanUserFromFeedPayloadOrError", "SetCommunityOverrideCreatorPayloadOrError", "CreateGalleryPayloadOrError", "UpdateGalleryInfoPayloadOrError", "UpdateGalleryHiddenPayloadOrError", "DeleteGalleryPayloadOrError", "UpdateGalleryOrderPayloadOrError", "UpdateFeaturedGalleryPayloadOrError", "UpdateGalleryPayloadOrError", "PublishGalleryPayloadOrError", "UpdatePrimaryWalletPayloadOrError", "AdminAddWalletPayloadOrError", "UpdateUserExperiencePayloadOrError", "MoveCollectionToGalleryPayloadOrError", "ConnectSocialAccountPayloadOrError", "UpdateSocialAccountDisplayedPayloadOrError", "MintPremiumCardToWalletPayloadOrError", "DisconnectSocialAccountPayloadOrError", "FollowAllSocialConnectionsPayloadOrError", "GenerateQRCodeLoginTokenPayloadOrError", "SetProfileImagePayloadOrError", "PostTokensPayloadOrError", "ReferralPostTokenPayloadOrError", "AdmirePostPayloadOrError", "AdmireTokenPayloadOrError", "CommentOnPostPayloadOrError", "DeletePostPayloadOrError"} func (ec *executionContext) _ErrNotAuthorized(ctx context.Context, sel ast.SelectionSet, obj *model.ErrNotAuthorized) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, errNotAuthorizedImplementors) @@ -67194,7 +67427,7 @@ func (ec *executionContext) _ErrSessionInvalidated(ctx context.Context, sel ast. return out } -var errSyncFailedImplementors = []string{"ErrSyncFailed", "SyncTokensPayloadOrError", "SyncCreatedTokensForNewContractsPayloadOrError", "SyncCreatedTokensForExistingContractPayloadOrError", "RefreshTokenPayloadOrError", "RefreshCollectionPayloadOrError", "RefreshContractPayloadOrError", "Error", "SyncTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernamePayloadOrError"} +var errSyncFailedImplementors = []string{"ErrSyncFailed", "SyncTokensPayloadOrError", "SyncCreatedTokensForNewContractsPayloadOrError", "SyncCreatedTokensForExistingContractPayloadOrError", "RefreshTokenPayloadOrError", "RefreshCollectionPayloadOrError", "RefreshContractPayloadOrError", "Error", "SyncTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernamePayloadOrError", "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError"} func (ec *executionContext) _ErrSyncFailed(ctx context.Context, sel ast.SelectionSet, obj *model.ErrSyncFailed) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, errSyncFailedImplementors) @@ -69793,6 +70026,12 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_syncCreatedTokensForUsername(ctx, field) }) + case "syncCreatedTokensForUsernameAndExistingContract": + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_syncCreatedTokensForUsernameAndExistingContract(ctx, field) + }) + case "banUserFromFeed": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -72924,6 +73163,34 @@ func (ec *executionContext) _SyncCreatedTokensForNewContractsPayload(ctx context return out } +var syncCreatedTokensForUsernameAndExistingContractPayloadImplementors = []string{"SyncCreatedTokensForUsernameAndExistingContractPayload", "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError"} + +func (ec *executionContext) _SyncCreatedTokensForUsernameAndExistingContractPayload(ctx context.Context, sel ast.SelectionSet, obj *model.SyncCreatedTokensForUsernameAndExistingContractPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, syncCreatedTokensForUsernameAndExistingContractPayloadImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SyncCreatedTokensForUsernameAndExistingContractPayload") + case "message": + + out.Values[i] = ec._SyncCreatedTokensForUsernameAndExistingContractPayload_message(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var syncCreatedTokensForUsernamePayloadImplementors = []string{"SyncCreatedTokensForUsernamePayload", "SyncCreatedTokensForUsernamePayloadOrError"} func (ec *executionContext) _SyncCreatedTokensForUsernamePayload(ctx context.Context, sel ast.SelectionSet, obj *model.SyncCreatedTokensForUsernamePayload) graphql.Marshaler { @@ -79586,6 +79853,13 @@ func (ec *executionContext) marshalOSyncCreatedTokensForNewContractsPayloadOrErr return ec._SyncCreatedTokensForNewContractsPayloadOrError(ctx, sel, v) } +func (ec *executionContext) marshalOSyncCreatedTokensForUsernameAndExistingContractPayloadOrError2githubᚗcomᚋmikeydubᚋgoᚑgalleryᚋgraphqlᚋmodelᚐSyncCreatedTokensForUsernameAndExistingContractPayloadOrError(ctx context.Context, sel ast.SelectionSet, v model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._SyncCreatedTokensForUsernameAndExistingContractPayloadOrError(ctx, sel, v) +} + func (ec *executionContext) marshalOSyncCreatedTokensForUsernamePayloadOrError2githubᚗcomᚋmikeydubᚋgoᚑgalleryᚋgraphqlᚋmodelᚐSyncCreatedTokensForUsernamePayloadOrError(ctx context.Context, sel ast.SelectionSet, v model.SyncCreatedTokensForUsernamePayloadOrError) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/graphql/model/models_gen.go b/graphql/model/models_gen.go index 89722535c..ef0fdb9e8 100644 --- a/graphql/model/models_gen.go +++ b/graphql/model/models_gen.go @@ -311,6 +311,10 @@ type SyncCreatedTokensForNewContractsPayloadOrError interface { IsSyncCreatedTokensForNewContractsPayloadOrError() } +type SyncCreatedTokensForUsernameAndExistingContractPayloadOrError interface { + IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() +} + type SyncCreatedTokensForUsernamePayloadOrError interface { IsSyncCreatedTokensForUsernamePayloadOrError() } @@ -947,8 +951,9 @@ type ErrCommunityNotFound struct { Message string `json:"message"` } -func (ErrCommunityNotFound) IsCommunityByAddressOrError() {} -func (ErrCommunityNotFound) IsError() {} +func (ErrCommunityNotFound) IsCommunityByAddressOrError() {} +func (ErrCommunityNotFound) IsError() {} +func (ErrCommunityNotFound) IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() {} type ErrDoesNotOwnRequiredToken struct { Message string `json:"message"` @@ -1000,75 +1005,76 @@ type ErrInvalidInput struct { Reasons []string `json:"reasons"` } -func (ErrInvalidInput) IsUserByUsernameOrError() {} -func (ErrInvalidInput) IsUserByIDOrError() {} -func (ErrInvalidInput) IsUserByAddressOrError() {} -func (ErrInvalidInput) IsCollectionByIDOrError() {} -func (ErrInvalidInput) IsCommunityByAddressOrError() {} -func (ErrInvalidInput) IsPostOrError() {} -func (ErrInvalidInput) IsSocialConnectionsOrError() {} -func (ErrInvalidInput) IsMerchTokensPayloadOrError() {} -func (ErrInvalidInput) IsSearchUsersPayloadOrError() {} -func (ErrInvalidInput) IsSearchGalleriesPayloadOrError() {} -func (ErrInvalidInput) IsSearchCommunitiesPayloadOrError() {} -func (ErrInvalidInput) IsPostComposerDraftDetailsPayloadOrError() {} -func (ErrInvalidInput) IsCreateCollectionPayloadOrError() {} -func (ErrInvalidInput) IsDeleteCollectionPayloadOrError() {} -func (ErrInvalidInput) IsUpdateCollectionInfoPayloadOrError() {} -func (ErrInvalidInput) IsUpdateCollectionTokensPayloadOrError() {} -func (ErrInvalidInput) IsUpdateCollectionHiddenPayloadOrError() {} -func (ErrInvalidInput) IsUpdateGalleryCollectionsPayloadOrError() {} -func (ErrInvalidInput) IsUpdateTokenInfoPayloadOrError() {} -func (ErrInvalidInput) IsAddUserWalletPayloadOrError() {} -func (ErrInvalidInput) IsRemoveUserWalletsPayloadOrError() {} -func (ErrInvalidInput) IsUpdateUserInfoPayloadOrError() {} -func (ErrInvalidInput) IsRegisterUserPushTokenPayloadOrError() {} -func (ErrInvalidInput) IsUnregisterUserPushTokenPayloadOrError() {} -func (ErrInvalidInput) IsRefreshTokenPayloadOrError() {} -func (ErrInvalidInput) IsRefreshCollectionPayloadOrError() {} -func (ErrInvalidInput) IsRefreshContractPayloadOrError() {} -func (ErrInvalidInput) IsError() {} -func (ErrInvalidInput) IsCreateUserPayloadOrError() {} -func (ErrInvalidInput) IsFollowUserPayloadOrError() {} -func (ErrInvalidInput) IsUnfollowUserPayloadOrError() {} -func (ErrInvalidInput) IsAdmireFeedEventPayloadOrError() {} -func (ErrInvalidInput) IsRemoveAdmirePayloadOrError() {} -func (ErrInvalidInput) IsCommentOnFeedEventPayloadOrError() {} -func (ErrInvalidInput) IsRemoveCommentPayloadOrError() {} -func (ErrInvalidInput) IsVerifyEmailPayloadOrError() {} -func (ErrInvalidInput) IsPreverifyEmailPayloadOrError() {} -func (ErrInvalidInput) IsVerifyEmailMagicLinkPayloadOrError() {} -func (ErrInvalidInput) IsUpdateEmailPayloadOrError() {} -func (ErrInvalidInput) IsResendVerificationEmailPayloadOrError() {} -func (ErrInvalidInput) IsUpdateEmailNotificationSettingsPayloadOrError() {} -func (ErrInvalidInput) IsUnsubscribeFromEmailTypePayloadOrError() {} -func (ErrInvalidInput) IsOptInForRolesPayloadOrError() {} -func (ErrInvalidInput) IsOptOutForRolesPayloadOrError() {} -func (ErrInvalidInput) IsRedeemMerchPayloadOrError() {} -func (ErrInvalidInput) IsCreateGalleryPayloadOrError() {} -func (ErrInvalidInput) IsUpdateGalleryInfoPayloadOrError() {} -func (ErrInvalidInput) IsUpdateGalleryHiddenPayloadOrError() {} -func (ErrInvalidInput) IsDeleteGalleryPayloadOrError() {} -func (ErrInvalidInput) IsUpdateGalleryOrderPayloadOrError() {} -func (ErrInvalidInput) IsUpdateFeaturedGalleryPayloadOrError() {} -func (ErrInvalidInput) IsUpdateGalleryPayloadOrError() {} -func (ErrInvalidInput) IsPublishGalleryPayloadOrError() {} -func (ErrInvalidInput) IsUpdatePrimaryWalletPayloadOrError() {} -func (ErrInvalidInput) IsUpdateUserExperiencePayloadOrError() {} -func (ErrInvalidInput) IsMoveCollectionToGalleryPayloadOrError() {} -func (ErrInvalidInput) IsConnectSocialAccountPayloadOrError() {} -func (ErrInvalidInput) IsUpdateSocialAccountDisplayedPayloadOrError() {} -func (ErrInvalidInput) IsMintPremiumCardToWalletPayloadOrError() {} -func (ErrInvalidInput) IsDisconnectSocialAccountPayloadOrError() {} -func (ErrInvalidInput) IsFollowAllSocialConnectionsPayloadOrError() {} -func (ErrInvalidInput) IsSetProfileImagePayloadOrError() {} -func (ErrInvalidInput) IsPostTokensPayloadOrError() {} -func (ErrInvalidInput) IsReferralPostTokenPayloadOrError() {} -func (ErrInvalidInput) IsAdmirePostPayloadOrError() {} -func (ErrInvalidInput) IsAdmireTokenPayloadOrError() {} -func (ErrInvalidInput) IsCommentOnPostPayloadOrError() {} -func (ErrInvalidInput) IsDeletePostPayloadOrError() {} -func (ErrInvalidInput) IsReferralPostPreflightPayloadOrError() {} +func (ErrInvalidInput) IsUserByUsernameOrError() {} +func (ErrInvalidInput) IsUserByIDOrError() {} +func (ErrInvalidInput) IsUserByAddressOrError() {} +func (ErrInvalidInput) IsCollectionByIDOrError() {} +func (ErrInvalidInput) IsCommunityByAddressOrError() {} +func (ErrInvalidInput) IsPostOrError() {} +func (ErrInvalidInput) IsSocialConnectionsOrError() {} +func (ErrInvalidInput) IsMerchTokensPayloadOrError() {} +func (ErrInvalidInput) IsSearchUsersPayloadOrError() {} +func (ErrInvalidInput) IsSearchGalleriesPayloadOrError() {} +func (ErrInvalidInput) IsSearchCommunitiesPayloadOrError() {} +func (ErrInvalidInput) IsPostComposerDraftDetailsPayloadOrError() {} +func (ErrInvalidInput) IsCreateCollectionPayloadOrError() {} +func (ErrInvalidInput) IsDeleteCollectionPayloadOrError() {} +func (ErrInvalidInput) IsUpdateCollectionInfoPayloadOrError() {} +func (ErrInvalidInput) IsUpdateCollectionTokensPayloadOrError() {} +func (ErrInvalidInput) IsUpdateCollectionHiddenPayloadOrError() {} +func (ErrInvalidInput) IsUpdateGalleryCollectionsPayloadOrError() {} +func (ErrInvalidInput) IsUpdateTokenInfoPayloadOrError() {} +func (ErrInvalidInput) IsAddUserWalletPayloadOrError() {} +func (ErrInvalidInput) IsRemoveUserWalletsPayloadOrError() {} +func (ErrInvalidInput) IsUpdateUserInfoPayloadOrError() {} +func (ErrInvalidInput) IsRegisterUserPushTokenPayloadOrError() {} +func (ErrInvalidInput) IsUnregisterUserPushTokenPayloadOrError() {} +func (ErrInvalidInput) IsRefreshTokenPayloadOrError() {} +func (ErrInvalidInput) IsRefreshCollectionPayloadOrError() {} +func (ErrInvalidInput) IsRefreshContractPayloadOrError() {} +func (ErrInvalidInput) IsError() {} +func (ErrInvalidInput) IsCreateUserPayloadOrError() {} +func (ErrInvalidInput) IsFollowUserPayloadOrError() {} +func (ErrInvalidInput) IsUnfollowUserPayloadOrError() {} +func (ErrInvalidInput) IsAdmireFeedEventPayloadOrError() {} +func (ErrInvalidInput) IsRemoveAdmirePayloadOrError() {} +func (ErrInvalidInput) IsCommentOnFeedEventPayloadOrError() {} +func (ErrInvalidInput) IsRemoveCommentPayloadOrError() {} +func (ErrInvalidInput) IsVerifyEmailPayloadOrError() {} +func (ErrInvalidInput) IsPreverifyEmailPayloadOrError() {} +func (ErrInvalidInput) IsVerifyEmailMagicLinkPayloadOrError() {} +func (ErrInvalidInput) IsUpdateEmailPayloadOrError() {} +func (ErrInvalidInput) IsResendVerificationEmailPayloadOrError() {} +func (ErrInvalidInput) IsUpdateEmailNotificationSettingsPayloadOrError() {} +func (ErrInvalidInput) IsUnsubscribeFromEmailTypePayloadOrError() {} +func (ErrInvalidInput) IsOptInForRolesPayloadOrError() {} +func (ErrInvalidInput) IsOptOutForRolesPayloadOrError() {} +func (ErrInvalidInput) IsRedeemMerchPayloadOrError() {} +func (ErrInvalidInput) IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() {} +func (ErrInvalidInput) IsCreateGalleryPayloadOrError() {} +func (ErrInvalidInput) IsUpdateGalleryInfoPayloadOrError() {} +func (ErrInvalidInput) IsUpdateGalleryHiddenPayloadOrError() {} +func (ErrInvalidInput) IsDeleteGalleryPayloadOrError() {} +func (ErrInvalidInput) IsUpdateGalleryOrderPayloadOrError() {} +func (ErrInvalidInput) IsUpdateFeaturedGalleryPayloadOrError() {} +func (ErrInvalidInput) IsUpdateGalleryPayloadOrError() {} +func (ErrInvalidInput) IsPublishGalleryPayloadOrError() {} +func (ErrInvalidInput) IsUpdatePrimaryWalletPayloadOrError() {} +func (ErrInvalidInput) IsUpdateUserExperiencePayloadOrError() {} +func (ErrInvalidInput) IsMoveCollectionToGalleryPayloadOrError() {} +func (ErrInvalidInput) IsConnectSocialAccountPayloadOrError() {} +func (ErrInvalidInput) IsUpdateSocialAccountDisplayedPayloadOrError() {} +func (ErrInvalidInput) IsMintPremiumCardToWalletPayloadOrError() {} +func (ErrInvalidInput) IsDisconnectSocialAccountPayloadOrError() {} +func (ErrInvalidInput) IsFollowAllSocialConnectionsPayloadOrError() {} +func (ErrInvalidInput) IsSetProfileImagePayloadOrError() {} +func (ErrInvalidInput) IsPostTokensPayloadOrError() {} +func (ErrInvalidInput) IsReferralPostTokenPayloadOrError() {} +func (ErrInvalidInput) IsAdmirePostPayloadOrError() {} +func (ErrInvalidInput) IsAdmireTokenPayloadOrError() {} +func (ErrInvalidInput) IsCommentOnPostPayloadOrError() {} +func (ErrInvalidInput) IsDeletePostPayloadOrError() {} +func (ErrInvalidInput) IsReferralPostPreflightPayloadOrError() {} type ErrInvalidToken struct { Message string `json:"message"` @@ -1101,60 +1107,61 @@ type ErrNotAuthorized struct { Cause AuthorizationError `json:"cause"` } -func (ErrNotAuthorized) IsViewerOrError() {} -func (ErrNotAuthorized) IsSocialQueriesOrError() {} -func (ErrNotAuthorized) IsCreateCollectionPayloadOrError() {} -func (ErrNotAuthorized) IsDeleteCollectionPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateCollectionInfoPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateCollectionTokensPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateCollectionHiddenPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateGalleryCollectionsPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateTokenInfoPayloadOrError() {} -func (ErrNotAuthorized) IsSetSpamPreferencePayloadOrError() {} -func (ErrNotAuthorized) IsAddUserWalletPayloadOrError() {} -func (ErrNotAuthorized) IsRemoveUserWalletsPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateUserInfoPayloadOrError() {} -func (ErrNotAuthorized) IsRegisterUserPushTokenPayloadOrError() {} -func (ErrNotAuthorized) IsUnregisterUserPushTokenPayloadOrError() {} -func (ErrNotAuthorized) IsSyncTokensPayloadOrError() {} -func (ErrNotAuthorized) IsSyncCreatedTokensForNewContractsPayloadOrError() {} -func (ErrNotAuthorized) IsSyncCreatedTokensForExistingContractPayloadOrError() {} -func (ErrNotAuthorized) IsError() {} -func (ErrNotAuthorized) IsAddRolesToUserPayloadOrError() {} -func (ErrNotAuthorized) IsRevokeRolesFromUserPayloadOrError() {} -func (ErrNotAuthorized) IsOptInForRolesPayloadOrError() {} -func (ErrNotAuthorized) IsOptOutForRolesPayloadOrError() {} -func (ErrNotAuthorized) IsUploadPersistedQueriesPayloadOrError() {} -func (ErrNotAuthorized) IsSyncTokensForUsernamePayloadOrError() {} -func (ErrNotAuthorized) IsSyncCreatedTokensForUsernamePayloadOrError() {} -func (ErrNotAuthorized) IsBanUserFromFeedPayloadOrError() {} -func (ErrNotAuthorized) IsUnbanUserFromFeedPayloadOrError() {} -func (ErrNotAuthorized) IsSetCommunityOverrideCreatorPayloadOrError() {} -func (ErrNotAuthorized) IsCreateGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateGalleryInfoPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateGalleryHiddenPayloadOrError() {} -func (ErrNotAuthorized) IsDeleteGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateGalleryOrderPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateFeaturedGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsPublishGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsUpdatePrimaryWalletPayloadOrError() {} -func (ErrNotAuthorized) IsAdminAddWalletPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateUserExperiencePayloadOrError() {} -func (ErrNotAuthorized) IsMoveCollectionToGalleryPayloadOrError() {} -func (ErrNotAuthorized) IsConnectSocialAccountPayloadOrError() {} -func (ErrNotAuthorized) IsUpdateSocialAccountDisplayedPayloadOrError() {} -func (ErrNotAuthorized) IsMintPremiumCardToWalletPayloadOrError() {} -func (ErrNotAuthorized) IsDisconnectSocialAccountPayloadOrError() {} -func (ErrNotAuthorized) IsFollowAllSocialConnectionsPayloadOrError() {} -func (ErrNotAuthorized) IsGenerateQRCodeLoginTokenPayloadOrError() {} -func (ErrNotAuthorized) IsSetProfileImagePayloadOrError() {} -func (ErrNotAuthorized) IsPostTokensPayloadOrError() {} -func (ErrNotAuthorized) IsReferralPostTokenPayloadOrError() {} -func (ErrNotAuthorized) IsAdmirePostPayloadOrError() {} -func (ErrNotAuthorized) IsAdmireTokenPayloadOrError() {} -func (ErrNotAuthorized) IsCommentOnPostPayloadOrError() {} -func (ErrNotAuthorized) IsDeletePostPayloadOrError() {} +func (ErrNotAuthorized) IsViewerOrError() {} +func (ErrNotAuthorized) IsSocialQueriesOrError() {} +func (ErrNotAuthorized) IsCreateCollectionPayloadOrError() {} +func (ErrNotAuthorized) IsDeleteCollectionPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateCollectionInfoPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateCollectionTokensPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateCollectionHiddenPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateGalleryCollectionsPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateTokenInfoPayloadOrError() {} +func (ErrNotAuthorized) IsSetSpamPreferencePayloadOrError() {} +func (ErrNotAuthorized) IsAddUserWalletPayloadOrError() {} +func (ErrNotAuthorized) IsRemoveUserWalletsPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateUserInfoPayloadOrError() {} +func (ErrNotAuthorized) IsRegisterUserPushTokenPayloadOrError() {} +func (ErrNotAuthorized) IsUnregisterUserPushTokenPayloadOrError() {} +func (ErrNotAuthorized) IsSyncTokensPayloadOrError() {} +func (ErrNotAuthorized) IsSyncCreatedTokensForNewContractsPayloadOrError() {} +func (ErrNotAuthorized) IsSyncCreatedTokensForExistingContractPayloadOrError() {} +func (ErrNotAuthorized) IsError() {} +func (ErrNotAuthorized) IsAddRolesToUserPayloadOrError() {} +func (ErrNotAuthorized) IsRevokeRolesFromUserPayloadOrError() {} +func (ErrNotAuthorized) IsOptInForRolesPayloadOrError() {} +func (ErrNotAuthorized) IsOptOutForRolesPayloadOrError() {} +func (ErrNotAuthorized) IsUploadPersistedQueriesPayloadOrError() {} +func (ErrNotAuthorized) IsSyncTokensForUsernamePayloadOrError() {} +func (ErrNotAuthorized) IsSyncCreatedTokensForUsernamePayloadOrError() {} +func (ErrNotAuthorized) IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() {} +func (ErrNotAuthorized) IsBanUserFromFeedPayloadOrError() {} +func (ErrNotAuthorized) IsUnbanUserFromFeedPayloadOrError() {} +func (ErrNotAuthorized) IsSetCommunityOverrideCreatorPayloadOrError() {} +func (ErrNotAuthorized) IsCreateGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateGalleryInfoPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateGalleryHiddenPayloadOrError() {} +func (ErrNotAuthorized) IsDeleteGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateGalleryOrderPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateFeaturedGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsPublishGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsUpdatePrimaryWalletPayloadOrError() {} +func (ErrNotAuthorized) IsAdminAddWalletPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateUserExperiencePayloadOrError() {} +func (ErrNotAuthorized) IsMoveCollectionToGalleryPayloadOrError() {} +func (ErrNotAuthorized) IsConnectSocialAccountPayloadOrError() {} +func (ErrNotAuthorized) IsUpdateSocialAccountDisplayedPayloadOrError() {} +func (ErrNotAuthorized) IsMintPremiumCardToWalletPayloadOrError() {} +func (ErrNotAuthorized) IsDisconnectSocialAccountPayloadOrError() {} +func (ErrNotAuthorized) IsFollowAllSocialConnectionsPayloadOrError() {} +func (ErrNotAuthorized) IsGenerateQRCodeLoginTokenPayloadOrError() {} +func (ErrNotAuthorized) IsSetProfileImagePayloadOrError() {} +func (ErrNotAuthorized) IsPostTokensPayloadOrError() {} +func (ErrNotAuthorized) IsReferralPostTokenPayloadOrError() {} +func (ErrNotAuthorized) IsAdmirePostPayloadOrError() {} +func (ErrNotAuthorized) IsAdmireTokenPayloadOrError() {} +func (ErrNotAuthorized) IsCommentOnPostPayloadOrError() {} +func (ErrNotAuthorized) IsDeletePostPayloadOrError() {} type ErrPostNotFound struct { Message string `json:"message"` @@ -1183,15 +1190,16 @@ type ErrSyncFailed struct { Message string `json:"message"` } -func (ErrSyncFailed) IsSyncTokensPayloadOrError() {} -func (ErrSyncFailed) IsSyncCreatedTokensForNewContractsPayloadOrError() {} -func (ErrSyncFailed) IsSyncCreatedTokensForExistingContractPayloadOrError() {} -func (ErrSyncFailed) IsRefreshTokenPayloadOrError() {} -func (ErrSyncFailed) IsRefreshCollectionPayloadOrError() {} -func (ErrSyncFailed) IsRefreshContractPayloadOrError() {} -func (ErrSyncFailed) IsError() {} -func (ErrSyncFailed) IsSyncTokensForUsernamePayloadOrError() {} -func (ErrSyncFailed) IsSyncCreatedTokensForUsernamePayloadOrError() {} +func (ErrSyncFailed) IsSyncTokensPayloadOrError() {} +func (ErrSyncFailed) IsSyncCreatedTokensForNewContractsPayloadOrError() {} +func (ErrSyncFailed) IsSyncCreatedTokensForExistingContractPayloadOrError() {} +func (ErrSyncFailed) IsRefreshTokenPayloadOrError() {} +func (ErrSyncFailed) IsRefreshCollectionPayloadOrError() {} +func (ErrSyncFailed) IsRefreshContractPayloadOrError() {} +func (ErrSyncFailed) IsError() {} +func (ErrSyncFailed) IsSyncTokensForUsernamePayloadOrError() {} +func (ErrSyncFailed) IsSyncCreatedTokensForUsernamePayloadOrError() {} +func (ErrSyncFailed) IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() {} type ErrTokenNotFound struct { Message string `json:"message"` @@ -2107,6 +2115,13 @@ type SyncCreatedTokensForNewContractsPayload struct { func (SyncCreatedTokensForNewContractsPayload) IsSyncCreatedTokensForNewContractsPayloadOrError() {} +type SyncCreatedTokensForUsernameAndExistingContractPayload struct { + Message string `json:"message"` +} + +func (SyncCreatedTokensForUsernameAndExistingContractPayload) IsSyncCreatedTokensForUsernameAndExistingContractPayloadOrError() { +} + type SyncCreatedTokensForUsernamePayload struct { Message string `json:"message"` } diff --git a/graphql/model/remapgen_gen.go b/graphql/model/remapgen_gen.go index 4b838841b..1160c89fc 100644 --- a/graphql/model/remapgen_gen.go +++ b/graphql/model/remapgen_gen.go @@ -373,6 +373,11 @@ var typeConversionMap = map[string]func(object interface{}) (objectAsType interf return obj, ok }, + "SyncCreatedTokensForUsernameAndExistingContractPayloadOrError": func(object interface{}) (interface{}, bool) { + obj, ok := object.(SyncCreatedTokensForUsernameAndExistingContractPayloadOrError) + return obj, ok + }, + "SyncCreatedTokensForUsernamePayloadOrError": func(object interface{}) (interface{}, bool) { obj, ok := object.(SyncCreatedTokensForUsernamePayloadOrError) return obj, ok diff --git a/graphql/resolver/schema.resolvers.go b/graphql/resolver/schema.resolvers.go index 5b508ccc1..0947fe123 100644 --- a/graphql/resolver/schema.resolvers.go +++ b/graphql/resolver/schema.resolvers.go @@ -1854,6 +1854,28 @@ func (r *mutationResolver) SyncCreatedTokensForUsername(ctx context.Context, use return output, nil } +// SyncCreatedTokensForUsernameAndExistingContract is the resolver for the syncCreatedTokensForUsernameAndExistingContract field. +func (r *mutationResolver) SyncCreatedTokensForUsernameAndExistingContract(ctx context.Context, username string, chainAddress persist.ChainAddress) (model.SyncCreatedTokensForUsernameAndExistingContractPayloadOrError, error) { + api := publicapi.For(ctx) + + user, err := api.User.GetUserByUsername(ctx, username) + + if err != nil { + return nil, err + } + + err = api.Token.SyncCreatedTokensForExistingContractAdmin(ctx, user.ID, chainAddress) + if err != nil { + return nil, err + } + + output := &model.SyncCreatedTokensForUsernameAndExistingContractPayload{ + Message: "Successfully synced tokens", + } + + return output, nil +} + // BanUserFromFeed is the resolver for the banUserFromFeed field. func (r *mutationResolver) BanUserFromFeed(ctx context.Context, username string, action string) (model.BanUserFromFeedPayloadOrError, error) { user, err := publicapi.For(ctx).User.GetUserByUsername(ctx, username) diff --git a/graphql/schema/schema.graphql b/graphql/schema/schema.graphql index a2094224a..772ccc3b7 100644 --- a/graphql/schema/schema.graphql +++ b/graphql/schema/schema.graphql @@ -2173,6 +2173,17 @@ union SyncCreatedTokensForUsernamePayloadOrError = | ErrNotAuthorized | ErrSyncFailed +type SyncCreatedTokensForUsernameAndExistingContractPayload { + message: String! +} + +union SyncCreatedTokensForUsernameAndExistingContractPayloadOrError = + SyncCreatedTokensForUsernameAndExistingContractPayload + | ErrInvalidInput + | ErrNotAuthorized + | ErrSyncFailed + | ErrCommunityNotFound + type BanUserFromFeedPayload { user: GalleryUser } @@ -2674,6 +2685,10 @@ type Mutation { username: String! chains: [Chain!]! ): SyncCreatedTokensForUsernamePayloadOrError @retoolAuth + syncCreatedTokensForUsernameAndExistingContract( + username: String! + chainAddress: ChainAddressInput! + ): SyncCreatedTokensForUsernameAndExistingContractPayloadOrError @retoolAuth banUserFromFeed(username: String!, action: String!): BanUserFromFeedPayloadOrError @retoolAuth unbanUserFromFeed(username: String!): UnbanUserFromFeedPayloadOrError @retoolAuth mintPremiumCardToWallet( diff --git a/publicapi/token.go b/publicapi/token.go index e37113703..80842df07 100644 --- a/publicapi/token.go +++ b/publicapi/token.go @@ -365,6 +365,31 @@ func (api TokenAPI) SyncCreatedTokensForExistingContract(ctx context.Context, co return api.multichainProvider.SyncCreatedTokensForExistingContract(ctx, userID, contractID) } +func (api TokenAPI) SyncCreatedTokensForExistingContractAdmin(ctx context.Context, userID persist.DBID, chainAddress persist.ChainAddress) error { + // Validate + if err := validate.ValidateFields(api.validator, validate.ValidationMap{ + "userID": validate.WithTag(userID, "required"), + "chain": validate.WithTag(chainAddress.Chain(), "chain"), + "address": validate.WithTag(chainAddress.Address(), "required"), + }); err != nil { + return err + } + + contract, err := api.repos.ContractRepository.GetByAddress(ctx, chainAddress.Address(), chainAddress.Chain()) + if err != nil { + return err + } + + key := fmt.Sprintf("sync:created:contract:%s:%s", userID.String(), contract.ID) + + if err := api.throttler.Lock(ctx, key); err != nil { + return ErrTokenRefreshFailed{Message: err.Error()} + } + defer api.throttler.Unlock(ctx, key) + + return api.multichainProvider.SyncCreatedTokensForExistingContract(ctx, userID, contract.ID) +} + func (api TokenAPI) RefreshToken(ctx context.Context, tokenDBID persist.DBID) error { if err := validate.ValidateFields(api.validator, validate.ValidationMap{ "tokenID": validate.WithTag(tokenDBID, "required"),