slackline/api/dnd

This module is generated by gleam run -m slackline_codegen/generate. Do not edit it by hand.

Do Not Disturb settings (dnd.*).

Types

A user’s Do Not Disturb and snooze status. The snooze_* fields are only present when the queried user is the current user, and snooze_endtime and snooze_remaining only when snooze_enabled is true.

pub type DndInfo {
  DndInfo(
    dnd_enabled: option.Option(Bool),
    next_dnd_start_ts: option.Option(Int),
    next_dnd_end_ts: option.Option(Int),
    snooze_enabled: option.Option(Bool),
    snooze_endtime: option.Option(Int),
    snooze_remaining: option.Option(Int),
    snooze_is_indefinite: option.Option(Bool),
  )
}

Constructors

  • DndInfo(
      dnd_enabled: option.Option(Bool),
      next_dnd_start_ts: option.Option(Int),
      next_dnd_end_ts: option.Option(Int),
      snooze_enabled: option.Option(Bool),
      snooze_endtime: option.Option(Int),
      snooze_remaining: option.Option(Int),
      snooze_is_indefinite: option.Option(Bool),
    )

    Arguments

    dnd_enabled

    Whether Do Not Disturb is enabled.

    next_dnd_start_ts

    Unix timestamp of when the next Do Not Disturb period starts.

    next_dnd_end_ts

    Unix timestamp of when the next Do Not Disturb period ends.

    snooze_enabled

    Whether snooze is active.

    snooze_endtime

    Unix timestamp of when the snooze ends.

    snooze_remaining

    Seconds of snooze remaining.

    snooze_is_indefinite

    Whether the snooze has no end. Cannot currently be set to true.

A user’s Do Not Disturb status, as returned by dnd.teamInfo.

pub type DndStatus {
  DndStatus(
    dnd_enabled: option.Option(Bool),
    next_dnd_start_ts: option.Option(Int),
    next_dnd_end_ts: option.Option(Int),
  )
}

Constructors

  • DndStatus(
      dnd_enabled: option.Option(Bool),
      next_dnd_start_ts: option.Option(Int),
      next_dnd_end_ts: option.Option(Int),
    )

    Arguments

    dnd_enabled

    Whether Do Not Disturb is enabled.

    next_dnd_start_ts

    Unix timestamp of when the next Do Not Disturb period starts.

    next_dnd_end_ts

    Unix timestamp of when the next Do Not Disturb period ends.

Identifies dnd.endDnd in the slackline.Call that end_dnd returns.

pub type EndDnd

Identifies dnd.endSnooze in the slackline.Call that end_snooze returns.

pub type EndSnooze

Identifies dnd.info in the slackline.Call that info returns.

pub type Info

Identifies dnd.setSnooze in the slackline.Call that set_snooze returns.

pub type SetSnooze

Identifies dnd.teamInfo in the slackline.Call that team_info returns.

pub type TeamInfo

A successful response from dnd.teamInfo.

pub type TeamInfoResponse {
  TeamInfoResponse(
    users: option.Option(dict.Dict(String, DndStatus)),
  )
}

Constructors

Values

pub fn dnd_info_decoder() -> decode.Decoder(DndInfo)

Decodes DndInfo from json.

pub fn dnd_info_to_json(it: DndInfo) -> json.Json

Encodes DndInfo as json.

pub fn dnd_status_decoder() -> decode.Decoder(DndStatus)

Decodes DndStatus from json.

pub fn dnd_status_to_json(it: DndStatus) -> json.Json

Encodes DndStatus as json.

pub fn end_dnd() -> slackline.Call(EndDnd, Nil)

dnd.endDnd: Ends the current user’s Do Not Disturb session immediately.

dnd.EndDnd identifies this method in slackline.Call.

User token scopes: dnd:write.

Rate limit tier: t2.

Documented errors: not_in_dnd.

pub fn end_snooze() -> slackline.Call(EndSnooze, DndInfo)

dnd.endSnooze: Ends the current user’s snooze mode immediately.

dnd.EndSnooze identifies this method in slackline.Call.

User token scopes: dnd:write.

Rate limit tier: t2.

Documented errors: snooze_end_failed.

pub fn info() -> slackline.Call(Info, DndInfo)

dnd.info: Retrieves a user’s current Do Not Disturb status.

dnd.Info identifies this method in slackline.Call.

Set optional arguments with the functions in slackline/api/dnd/info.

Bot token scopes: dnd:read. User token scopes: dnd:read.

Rate limit tier: t3.

Documented errors: user_not_found, user_not_visible.

pub fn set_snooze(
  num_minutes num_minutes: Int,
) -> slackline.Call(SetSnooze, DndInfo)

dnd.setSnooze: Turns on Do Not Disturb mode for the current user, or changes its duration.

dnd.SetSnooze identifies this method in slackline.Call.

User token scopes: dnd:write.

Rate limit tier: t2.

Documented errors: missing_duration, snooze_failed, too_long.

pub fn team_info(
  users users: List(String),
) -> slackline.Call(TeamInfo, TeamInfoResponse)

dnd.teamInfo: Retrieves the Do Not Disturb status for up to 50 users on a team.

dnd.TeamInfo identifies this method in slackline.Call.

Set optional arguments with the functions in slackline/api/dnd/team_info.

Bot token scopes: dnd:read. User token scopes: dnd:read.

Rate limit tier: t2.

Documented errors: no_users_provided, user_not_visible.

pub fn team_info_response_decoder() -> decode.Decoder(
  TeamInfoResponse,
)

Decodes the response from dnd.teamInfo.

✨ Search Document