desmos_bindings/proto/desmos/relationships/
v1.rs

1/// Relationship is the struct of a relationship.
2/// It represent the concept of "follow" of traditional social networks.
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(
5    Clone,
6    PartialEq,
7    ::prost::Message,
8    schemars::JsonSchema,
9    serde::Serialize,
10    serde::Deserialize,
11    desmos_std_derive::CosmwasmExt,
12)]
13#[proto_message(type_url = "/desmos.relationships.v1.Relationship")]
14#[serde(rename_all = "snake_case")]
15pub struct Relationship {
16    /// Creator represents the creator of the relationship
17    #[prost(string, tag = "1")]
18    pub creator: ::prost::alloc::string::String,
19    /// Counterparty represents the other user involved in the relationship
20    #[prost(string, tag = "2")]
21    pub counterparty: ::prost::alloc::string::String,
22    /// SubspaceID represents the id of the subspace for which the relationship is
23    /// valid
24    #[prost(uint64, tag = "3")]
25    #[serde(
26        serialize_with = "crate::serde::as_str::serialize",
27        deserialize_with = "crate::serde::as_str::deserialize"
28    )]
29    pub subspace_id: u64,
30}
31/// UserBlock represents the fact that the Blocker has blocked the given Blocked
32/// user.
33#[allow(clippy::derive_partial_eq_without_eq)]
34#[derive(
35    Clone,
36    PartialEq,
37    ::prost::Message,
38    schemars::JsonSchema,
39    serde::Serialize,
40    serde::Deserialize,
41    desmos_std_derive::CosmwasmExt,
42)]
43#[proto_message(type_url = "/desmos.relationships.v1.UserBlock")]
44#[serde(rename_all = "snake_case")]
45pub struct UserBlock {
46    /// Blocker represents the address of the user blocking another one
47    #[prost(string, tag = "1")]
48    pub blocker: ::prost::alloc::string::String,
49    /// Blocked represents the address of the blocked user
50    #[prost(string, tag = "2")]
51    pub blocked: ::prost::alloc::string::String,
52    /// Reason represents the optional reason the user has been blocked for.
53    #[prost(string, tag = "3")]
54    pub reason: ::prost::alloc::string::String,
55    /// SubspaceID represents the ID of the subspace inside which the user should
56    /// be blocked
57    #[prost(uint64, tag = "4")]
58    #[serde(
59        serialize_with = "crate::serde::as_str::serialize",
60        deserialize_with = "crate::serde::as_str::deserialize"
61    )]
62    pub subspace_id: u64,
63}
64/// GenesisState defines the profiles module's genesis state.
65#[allow(clippy::derive_partial_eq_without_eq)]
66#[derive(
67    Clone,
68    PartialEq,
69    ::prost::Message,
70    schemars::JsonSchema,
71    serde::Serialize,
72    serde::Deserialize,
73    desmos_std_derive::CosmwasmExt,
74)]
75#[proto_message(type_url = "/desmos.relationships.v1.GenesisState")]
76#[serde(rename_all = "snake_case")]
77pub struct GenesisState {
78    #[prost(message, repeated, tag = "1")]
79    pub relationships: ::prost::alloc::vec::Vec<Relationship>,
80    #[prost(message, repeated, tag = "2")]
81    pub blocks: ::prost::alloc::vec::Vec<UserBlock>,
82}
83/// MsgCreateRelationship represents a message to create a relationship
84/// between two users on a specific subspace.
85#[allow(clippy::derive_partial_eq_without_eq)]
86#[derive(
87    Clone,
88    PartialEq,
89    ::prost::Message,
90    schemars::JsonSchema,
91    serde::Serialize,
92    serde::Deserialize,
93    desmos_std_derive::CosmwasmExt,
94)]
95#[proto_message(type_url = "/desmos.relationships.v1.MsgCreateRelationship")]
96#[serde(rename_all = "snake_case")]
97pub struct MsgCreateRelationship {
98    /// User creating the relationship
99    #[prost(string, tag = "1")]
100    pub signer: ::prost::alloc::string::String,
101    /// Counterparty of the relationship (i.e. user to be followed)
102    #[prost(string, tag = "2")]
103    pub counterparty: ::prost::alloc::string::String,
104    /// Subspace id inside which the relationship will be valid
105    #[prost(uint64, tag = "3")]
106    #[serde(
107        serialize_with = "crate::serde::as_str::serialize",
108        deserialize_with = "crate::serde::as_str::deserialize"
109    )]
110    pub subspace_id: u64,
111}
112/// MsgCreateRelationshipResponse defines the Msg/CreateRelationship response
113/// type.
114#[allow(clippy::derive_partial_eq_without_eq)]
115#[derive(
116    Clone,
117    PartialEq,
118    ::prost::Message,
119    schemars::JsonSchema,
120    serde::Serialize,
121    serde::Deserialize,
122    desmos_std_derive::CosmwasmExt,
123)]
124#[proto_message(type_url = "/desmos.relationships.v1.MsgCreateRelationshipResponse")]
125#[serde(rename_all = "snake_case")]
126pub struct MsgCreateRelationshipResponse {}
127/// MsgDeleteRelationship represents a message to delete the relationship
128/// between two users.
129#[allow(clippy::derive_partial_eq_without_eq)]
130#[derive(
131    Clone,
132    PartialEq,
133    ::prost::Message,
134    schemars::JsonSchema,
135    serde::Serialize,
136    serde::Deserialize,
137    desmos_std_derive::CosmwasmExt,
138)]
139#[proto_message(type_url = "/desmos.relationships.v1.MsgDeleteRelationship")]
140#[serde(rename_all = "snake_case")]
141pub struct MsgDeleteRelationship {
142    /// User that created the relationship
143    #[prost(string, tag = "1")]
144    pub signer: ::prost::alloc::string::String,
145    /// Counterparty of the relationship that should be deleted
146    #[prost(string, tag = "2")]
147    pub counterparty: ::prost::alloc::string::String,
148    /// Id of the subspace inside which the relationship to delete exists
149    #[prost(uint64, tag = "3")]
150    #[serde(
151        serialize_with = "crate::serde::as_str::serialize",
152        deserialize_with = "crate::serde::as_str::deserialize"
153    )]
154    pub subspace_id: u64,
155}
156/// MsgDeleteRelationshipResponse defines the Msg/DeleteRelationship response
157/// type.
158#[allow(clippy::derive_partial_eq_without_eq)]
159#[derive(
160    Clone,
161    PartialEq,
162    ::prost::Message,
163    schemars::JsonSchema,
164    serde::Serialize,
165    serde::Deserialize,
166    desmos_std_derive::CosmwasmExt,
167)]
168#[proto_message(type_url = "/desmos.relationships.v1.MsgDeleteRelationshipResponse")]
169#[serde(rename_all = "snake_case")]
170pub struct MsgDeleteRelationshipResponse {}
171/// MsgBlockUser represents a message to block another user specifying an
172/// optional reason.
173#[allow(clippy::derive_partial_eq_without_eq)]
174#[derive(
175    Clone,
176    PartialEq,
177    ::prost::Message,
178    schemars::JsonSchema,
179    serde::Serialize,
180    serde::Deserialize,
181    desmos_std_derive::CosmwasmExt,
182)]
183#[proto_message(type_url = "/desmos.relationships.v1.MsgBlockUser")]
184#[serde(rename_all = "snake_case")]
185pub struct MsgBlockUser {
186    /// Address of the user blocking the other user
187    #[prost(string, tag = "1")]
188    pub blocker: ::prost::alloc::string::String,
189    /// Address of the user that should be blocked
190    #[prost(string, tag = "2")]
191    pub blocked: ::prost::alloc::string::String,
192    /// (optional) Reason why the user has been blocked
193    #[prost(string, tag = "3")]
194    pub reason: ::prost::alloc::string::String,
195    /// Id of the subspace inside which the user should be blocked
196    #[prost(uint64, tag = "4")]
197    #[serde(
198        serialize_with = "crate::serde::as_str::serialize",
199        deserialize_with = "crate::serde::as_str::deserialize"
200    )]
201    pub subspace_id: u64,
202}
203/// MsgBlockUserResponse defines the Msg/BlockUser response type.
204#[allow(clippy::derive_partial_eq_without_eq)]
205#[derive(
206    Clone,
207    PartialEq,
208    ::prost::Message,
209    schemars::JsonSchema,
210    serde::Serialize,
211    serde::Deserialize,
212    desmos_std_derive::CosmwasmExt,
213)]
214#[proto_message(type_url = "/desmos.relationships.v1.MsgBlockUserResponse")]
215#[serde(rename_all = "snake_case")]
216pub struct MsgBlockUserResponse {}
217/// MsgUnblockUser represents a message to unblock a previously blocked user.
218#[allow(clippy::derive_partial_eq_without_eq)]
219#[derive(
220    Clone,
221    PartialEq,
222    ::prost::Message,
223    schemars::JsonSchema,
224    serde::Serialize,
225    serde::Deserialize,
226    desmos_std_derive::CosmwasmExt,
227)]
228#[proto_message(type_url = "/desmos.relationships.v1.MsgUnblockUser")]
229#[serde(rename_all = "snake_case")]
230pub struct MsgUnblockUser {
231    /// Address of the user that blocked another user
232    #[prost(string, tag = "1")]
233    pub blocker: ::prost::alloc::string::String,
234    /// Address of the user that should be unblocked
235    #[prost(string, tag = "2")]
236    pub blocked: ::prost::alloc::string::String,
237    /// Id of the subspace inside which the user should be unblocked
238    #[prost(uint64, tag = "4")]
239    #[serde(
240        serialize_with = "crate::serde::as_str::serialize",
241        deserialize_with = "crate::serde::as_str::deserialize"
242    )]
243    pub subspace_id: u64,
244}
245/// MsgUnblockUserResponse defines the Msg/UnblockUser response type.
246#[allow(clippy::derive_partial_eq_without_eq)]
247#[derive(
248    Clone,
249    PartialEq,
250    ::prost::Message,
251    schemars::JsonSchema,
252    serde::Serialize,
253    serde::Deserialize,
254    desmos_std_derive::CosmwasmExt,
255)]
256#[proto_message(type_url = "/desmos.relationships.v1.MsgUnblockUserResponse")]
257#[serde(rename_all = "snake_case")]
258pub struct MsgUnblockUserResponse {}
259/// QueryRelationshipsRequest is the request type for the
260/// Query/Relationships RPC method.
261#[allow(clippy::derive_partial_eq_without_eq)]
262#[derive(
263    Clone,
264    PartialEq,
265    ::prost::Message,
266    schemars::JsonSchema,
267    serde::Serialize,
268    serde::Deserialize,
269    desmos_std_derive::CosmwasmExt,
270)]
271#[proto_message(type_url = "/desmos.relationships.v1.QueryRelationshipsRequest")]
272#[serde(rename_all = "snake_case")]
273#[proto_query(
274    path = "/desmos.relationships.v1.Query/Relationships",
275    response_type = QueryRelationshipsResponse
276)]
277pub struct QueryRelationshipsRequest {
278    /// subspace to query the relationships for
279    #[prost(uint64, tag = "1")]
280    #[serde(
281        serialize_with = "crate::serde::as_str::serialize",
282        deserialize_with = "crate::serde::as_str::deserialize"
283    )]
284    pub subspace_id: u64,
285    /// optional address of the user for which to query the relationships
286    #[prost(string, tag = "2")]
287    pub user: ::prost::alloc::string::String,
288    /// optional address of the counterparty of the relationships (used only if the
289    /// user is provided)
290    #[prost(string, tag = "3")]
291    pub counterparty: ::prost::alloc::string::String,
292    /// pagination defines an optional pagination for the request.
293    #[prost(message, optional, tag = "4")]
294    pub pagination:
295        ::core::option::Option<super::super::super::cosmos::base::query::v1beta1::PageRequest>,
296}
297/// QueryRelationshipsResponse is the response type for the
298/// Query/Relationships RPC method.
299#[allow(clippy::derive_partial_eq_without_eq)]
300#[derive(
301    Clone,
302    PartialEq,
303    ::prost::Message,
304    schemars::JsonSchema,
305    serde::Serialize,
306    serde::Deserialize,
307    desmos_std_derive::CosmwasmExt,
308)]
309#[proto_message(type_url = "/desmos.relationships.v1.QueryRelationshipsResponse")]
310#[serde(rename_all = "snake_case")]
311pub struct QueryRelationshipsResponse {
312    #[prost(message, repeated, tag = "1")]
313    pub relationships: ::prost::alloc::vec::Vec<Relationship>,
314    #[prost(message, optional, tag = "2")]
315    pub pagination:
316        ::core::option::Option<super::super::super::cosmos::base::query::v1beta1::PageResponse>,
317}
318/// QueryBlocksRequest is the request type for the Query/Blocks RPC
319/// endpoint
320#[allow(clippy::derive_partial_eq_without_eq)]
321#[derive(
322    Clone,
323    PartialEq,
324    ::prost::Message,
325    schemars::JsonSchema,
326    serde::Serialize,
327    serde::Deserialize,
328    desmos_std_derive::CosmwasmExt,
329)]
330#[proto_message(type_url = "/desmos.relationships.v1.QueryBlocksRequest")]
331#[serde(rename_all = "snake_case")]
332#[proto_query(
333    path = "/desmos.relationships.v1.Query/Blocks",
334    response_type = QueryBlocksResponse
335)]
336pub struct QueryBlocksRequest {
337    /// subspace to query the blocks for
338    #[prost(uint64, tag = "1")]
339    #[serde(
340        serialize_with = "crate::serde::as_str::serialize",
341        deserialize_with = "crate::serde::as_str::deserialize"
342    )]
343    pub subspace_id: u64,
344    /// optional address of the blocker to query the blocks for
345    #[prost(string, tag = "2")]
346    pub blocker: ::prost::alloc::string::String,
347    /// optional address of the blocked user to query the block for (used only if
348    /// the blocker is provided)
349    #[prost(string, tag = "3")]
350    pub blocked: ::prost::alloc::string::String,
351    /// pagination defines an optional pagination for the request.
352    #[prost(message, optional, tag = "4")]
353    pub pagination:
354        ::core::option::Option<super::super::super::cosmos::base::query::v1beta1::PageRequest>,
355}
356/// QueryBlocksResponse is the response type for the Query/Blocks RPC
357/// method.
358#[allow(clippy::derive_partial_eq_without_eq)]
359#[derive(
360    Clone,
361    PartialEq,
362    ::prost::Message,
363    schemars::JsonSchema,
364    serde::Serialize,
365    serde::Deserialize,
366    desmos_std_derive::CosmwasmExt,
367)]
368#[proto_message(type_url = "/desmos.relationships.v1.QueryBlocksResponse")]
369#[serde(rename_all = "snake_case")]
370pub struct QueryBlocksResponse {
371    #[prost(message, repeated, tag = "1")]
372    pub blocks: ::prost::alloc::vec::Vec<UserBlock>,
373    #[prost(message, optional, tag = "2")]
374    pub pagination:
375        ::core::option::Option<super::super::super::cosmos::base::query::v1beta1::PageResponse>,
376}
377pub struct RelationshipsQuerier<'a, Q: cosmwasm_std::CustomQuery> {
378    querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
379}
380impl<'a, Q: cosmwasm_std::CustomQuery> RelationshipsQuerier<'a, Q> {
381    pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
382        Self { querier }
383    }
384    pub fn relationships(
385        &self,
386        subspace_id: u64,
387        user: ::prost::alloc::string::String,
388        counterparty: ::prost::alloc::string::String,
389        pagination: ::core::option::Option<
390            super::super::super::cosmos::base::query::v1beta1::PageRequest,
391        >,
392    ) -> std::result::Result<QueryRelationshipsResponse, cosmwasm_std::StdError> {
393        QueryRelationshipsRequest {
394            subspace_id,
395            user,
396            counterparty,
397            pagination,
398        }
399        .query(self.querier)
400    }
401    pub fn blocks(
402        &self,
403        subspace_id: u64,
404        blocker: ::prost::alloc::string::String,
405        blocked: ::prost::alloc::string::String,
406        pagination: ::core::option::Option<
407            super::super::super::cosmos::base::query::v1beta1::PageRequest,
408        >,
409    ) -> std::result::Result<QueryBlocksResponse, cosmwasm_std::StdError> {
410        QueryBlocksRequest {
411            subspace_id,
412            blocker,
413            blocked,
414            pagination,
415        }
416        .query(self.querier)
417    }
418}