Struct pallet_spaces::Space[][src]

pub struct Space<T: Trait> {
    pub id: SpaceId,
    pub created: WhoAndWhen<T>,
    pub updated: Option<WhoAndWhen<T>>,
    pub owner: T::AccountId,
    pub parent_id: Option<SpaceId>,
    pub handle: Option<Vec<u8>>,
    pub content: Content,
    pub hidden: bool,
    pub posts_count: u32,
    pub hidden_posts_count: u32,
    pub followers_count: u32,
    pub score: i32,
    pub permissions: Option<SpacePermissions>,
}

Information about a space’s owner, its’ content, visibility and custom permissions.

Fields

id: SpaceId

Unique sequential identifier of a space. Examples of space ids: 1, 2, 3, and so on.

created: WhoAndWhen<T>updated: Option<WhoAndWhen<T>>owner: T::AccountId

The current owner of a given space.

parent_id: Option<SpaceId>handle: Option<Vec<u8>>

Unique alpha-numeric identifier that can be used in a space’s URL. Handle can only contain numbers, letter and underscore: 0-9, a-z, _.

content: Contenthidden: bool

Hidden field is used to recommend to end clients (web and mobile apps) that a particular space and its’ posts should not be shown.

posts_count: u32

The total number of posts in a given space.

hidden_posts_count: u32

The number of hidden posts in a given space.

followers_count: u32

The number of account following a given space.

score: i32permissions: Option<SpacePermissions>

This allows you to override Subsocial’s default permissions by enabling or disabling role permissions.

Implementations

impl<T: Trait> Space<T>[src]

pub fn new(
    id: SpaceId,
    parent_id: Option<SpaceId>,
    created_by: T::AccountId,
    content: Content,
    handle: Option<Vec<u8>>,
    permissions: Option<SpacePermissions>
) -> Self
[src]

pub fn is_owner(&self, account: &T::AccountId) -> bool[src]

pub fn is_follower(&self, account: &T::AccountId) -> bool[src]

pub fn ensure_space_owner(&self, account: T::AccountId) -> DispatchResult[src]

pub fn inc_posts(&mut self)[src]

pub fn dec_posts(&mut self)[src]

pub fn inc_hidden_posts(&mut self)[src]

pub fn dec_hidden_posts(&mut self)[src]

pub fn inc_followers(&mut self)[src]

pub fn dec_followers(&mut self)[src]

pub fn change_score(&mut self, diff: i16)[src]

pub fn try_get_parent(&self) -> Result<SpaceId, DispatchError>[src]

pub fn is_public(&self) -> bool[src]

pub fn is_unlisted(&self) -> bool[src]

Trait Implementations

impl<T: Clone + Trait> Clone for Space<T> where
    T::AccountId: Clone
[src]

impl<T: Trait> Debug for Space<T> where
    T: Debug
[src]

impl<T: Trait> Decode for Space<T> where
    WhoAndWhen<T>: Decode,
    WhoAndWhen<T>: Decode,
    Option<WhoAndWhen<T>>: Decode,
    Option<WhoAndWhen<T>>: Decode,
    T::AccountId: Decode,
    T::AccountId: Decode
[src]

impl<T: Trait> Encode for Space<T> where
    WhoAndWhen<T>: Encode,
    WhoAndWhen<T>: Encode,
    Option<WhoAndWhen<T>>: Encode,
    Option<WhoAndWhen<T>>: Encode,
    T::AccountId: Encode,
    T::AccountId: Encode
[src]

impl<T: Trait> EncodeLike<Space<T>> for Space<T> where
    WhoAndWhen<T>: Encode,
    WhoAndWhen<T>: Encode,
    Option<WhoAndWhen<T>>: Encode,
    Option<WhoAndWhen<T>>: Encode,
    T::AccountId: Encode,
    T::AccountId: Encode
[src]

impl<T: Eq + Trait> Eq for Space<T> where
    T::AccountId: Eq
[src]

impl<T: Trait> From<Space<T>> for FlatSpace<T::AccountId, T::BlockNumber>[src]

impl<T: PartialEq + Trait> PartialEq<Space<T>> for Space<T> where
    T::AccountId: PartialEq
[src]

impl<T: Trait> StorageMap<u64, Space<T>> for SpaceById<T>[src]

type Query = Option<Space<T>>

The type that get/take returns.

type Hasher = Twox64Concat

Hasher. Used for generating final key.

impl<T: Trait> StoragePrefixedMap<Space<T>> for SpaceById<T>[src]

impl<T: Trait> StructuralEq for Space<T>[src]

impl<T: Trait> StructuralPartialEq for Space<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Space<T> where
    <T as Trait>::AccountId: RefUnwindSafe,
    <T as Trait>::BlockNumber: RefUnwindSafe,
    <T as Trait>::Moment: RefUnwindSafe

impl<T> Send for Space<T> where
    <T as Trait>::Moment: Send

impl<T> Sync for Space<T> where
    <T as Trait>::Moment: Sync

impl<T> Unpin for Space<T> where
    <T as Trait>::AccountId: Unpin,
    <T as Trait>::BlockNumber: Unpin,
    <T as Trait>::Moment: Unpin

impl<T> UnwindSafe for Space<T> where
    <T as Trait>::AccountId: UnwindSafe,
    <T as Trait>::BlockNumber: UnwindSafe,
    <T as Trait>::Moment: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<S> Codec for S where
    S: Encode + Decode
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DecodeLimit for T where
    T: Decode
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T, Global>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: Encode + ToOwned
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T> Hashable for T where
    T: Codec
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe
[src]

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]