Skip to main content

GetViews

Struct GetViews 

Source
pub struct GetViews {
    pub path: String,
    pub year: Option<Year>,
    pub month: Option<Month>,
    pub day: Option<Day>,
    pub hour: Option<Hour>,
}
Expand description

Use this method to get the number of views for a Telegraph article. Returns a PageViews object on success. By default, the total number of page views will be returned.

  • path (String) Required. Path to the Telegraph page (in the format Title-12-31, where 12 is the month and 31 the day the article was first published).

  • year (Integer, 2000-2100) Required if month is passed. If passed, the number of page views for the requested year will be returned.

  • month (Integer, 1-12) Required if day is passed. If passed, the number of page views for the requested month will be returned.

  • day (Integer, 1-31) Required if hour is passed. If passed, the number of page views for the requested day will be returned.

  • hour (Integer, 0-24) If passed, the number of page views for the requested hour will be returned.

  • Sample request https://api.telegra.ph/getViews/Sample-Page-12-15?year=2016&month=12

Fields§

§path: String§year: Option<Year>§month: Option<Month>§day: Option<Day>§hour: Option<Hour>

Implementations§

Source§

impl GetViews

Source

pub fn new(path: String, year: u16) -> Self

Source

pub async fn run( &mut self, f: Box<dyn for<'a> Fn(&'a mut GetViews) -> Pin<Box<dyn Future<Output = Ret<PageViews>> + 'a>>>, ) -> Ret<PageViews>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.