/
expected_keepers.go
60 lines (44 loc) · 2.71 KB
/
expected_keepers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package types
// DONTCOVER
import (
sdk "github.com/cosmos/cosmos-sdk/types"
poststypes "github.com/desmos-labs/desmos/v7/x/posts/types"
subspacestypes "github.com/desmos-labs/desmos/v7/x/subspaces/types"
)
// ProfilesKeeper represents a keeper that deals with profiles
type ProfilesKeeper interface {
// HasProfile returns true iff the given user has a profile, or an error if something is wrong.
HasProfile(ctx sdk.Context, user string) bool
}
// SubspacesKeeper represents a keeper that deals with subspaces
type SubspacesKeeper interface {
// HasSubspace tells whether the subspace with the given id exists or not
HasSubspace(ctx sdk.Context, subspaceID uint64) bool
// HasPermission tells whether the given user has the provided permission inside the subspace with the specified id
HasPermission(ctx sdk.Context, subspaceID uint64, sectionID uint32, user string, permission subspacestypes.Permission) bool
// IterateSubspaces iterates through the subspaces set and performs the given function
IterateSubspaces(ctx sdk.Context, fn func(subspace subspacestypes.Subspace) (stop bool))
// GetAllSubspaces returns a list of all the subspaces that have been store inside the given context
GetAllSubspaces(ctx sdk.Context) []subspacestypes.Subspace
// GetUsersWithRootPermissions returns all the users that have a given permission inside the specified subspace
GetUsersWithRootPermissions(ctx sdk.Context, subspaceID uint64, permission subspacestypes.Permissions) []string
}
// RelationshipsKeeper represents a keeper that deals with relationships
type RelationshipsKeeper interface {
// HasUserBlocked tells whether the given blocker has blocked the user inside the provided subspace
HasUserBlocked(ctx sdk.Context, blocker, user string, subspaceID uint64) bool
// HasRelationship tells whether the relationship between the user and counterparty exists for the given subspace
HasRelationship(ctx sdk.Context, user, counterparty string, subspaceID uint64) bool
}
// PostsKeeper represents a keeper that deals with posts
type PostsKeeper interface {
// HasPost tells whether the given post exists or not
HasPost(ctx sdk.Context, subspaceID uint64, postID uint64) bool
// GetPost returns the post associated with the given id.
// If there is no post associated with the given id the function will return an empty post and false.
GetPost(ctx sdk.Context, subspaceID uint64, postID uint64) (post poststypes.Post, found bool)
// IteratePosts iterates over all the posts stored inside the context and performs the provided function
IteratePosts(ctx sdk.Context, fn func(post poststypes.Post) (stop bool))
// GetSubspacePosts returns all the posts for the given subspace
GetSubspacePosts(ctx sdk.Context, subspaceID uint64) []poststypes.Post
}