Skip to main content

Activity

Struct Activity 

Source
pub struct Activity {
    pub activity_id: u64,
    pub app: String,
    pub activity_type: String,
    pub user: String,
    pub subject: String,
    pub message: Option<String>,
    pub datetime: String,
    pub link: Option<String>,
    pub object_type: Option<String>,
    pub object_id: Option<u64>,
    pub object_name: Option<String>,
}
Expand description

A Nextcloud activity entry in the activity stream.

Returned in the OCS data payload from GET /ocs/v2.php/apps/activity/api/v2/activity.

See the Nextcloud Activity API documentation and developer_manual source.

Fields§

§activity_id: u64

Unique auto-incremented database ID for the activity event.

§app: String

Identifier of the application that generated this activity (e.g. "files").

§activity_type: String

Activity type identifier (corresponds to the JSON type field, e.g. "file_created").

§user: String

User ID of the actor who performed the action (may be empty if generated by the system).

§subject: String

Translated plain-text summary describing the activity.

§message: Option<String>

Additional translated plain-text message or context, if available.

§datetime: String

ISO 8601 formatted timestamp when the activity took place.

§link: Option<String>

Full URL pointing to the resource or context associated with this activity.

§object_type: Option<String>

Category or type of the related target object (e.g. "files").

§object_id: Option<u64>

Numeric identifier of the related target object.

§object_name: Option<String>

Name or path of the related target object (e.g. "/test/hello.txt").

Implementations§

Source§

impl Activity

Source

pub fn new( activity_id: u64, app: impl Into<String>, activity_type: impl Into<String>, user: impl Into<String>, subject: impl Into<String>, datetime: impl Into<String>, ) -> Self

Creates a new Activity with the required core fields.

Source

pub const fn activity_id(&self) -> u64

Unique activity ID.

Source

pub fn app(&self) -> &str

App that generated the activity.

Source

pub fn activity_type(&self) -> &str

Activity type identifier.

Source

pub fn user(&self) -> &str

User ID of the actor.

Source

pub fn subject(&self) -> &str

Plain-text subject.

Source

pub fn message(&self) -> Option<&str>

Plain-text message, if set.

Source

pub fn datetime(&self) -> &str

ISO 8601 timestamp string.

Associated URL link, if set.

Source

pub fn object_type(&self) -> Option<&str>

Type of the related object, if set.

Source

pub const fn object_id(&self) -> Option<u64>

Identifier of the related object, if set.

Source

pub fn object_name(&self) -> Option<&str>

Name or path of the related object, if set.

Source

pub fn with_message(self, message: impl Into<String>) -> Self

Sets the optional message text.

Sets the optional link URL.

Source

pub fn with_object( self, object_type: impl Into<String>, object_id: u64, object_name: impl Into<String>, ) -> Self

Sets the optional object metadata (type, ID, and name).

Trait Implementations§

Source§

impl Clone for Activity

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Activity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Activity

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Activity

Source§

impl PartialEq for Activity

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Activity

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Activity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more