NodePing.Schedules (NodePing Elixir v1.7.1) View Source

Schedules are used for setting time windows for notifications. This module manages schedules for your account/subaccounts

Link to this section Summary

Functions

Create a schedule for your account or subaccount

Create a schedule for your account or subaccount

Delete a schedule by its name (ID) on your account or subaccount

Delete a schedule by its name (ID) on your account or subaccount

Get all schedules on your account or subaccount

Get all schedules on your account or subaccount

Get a schedule by its name (ID) on your account or subaccount

Get a schedule by its name (ID) on your account or subaccount

Create a schedule for your account or subaccount

Create a schedule for your account or subaccount

Link to this section Functions

Link to this function

create(token, id, data, customerid \\ nil)

View Source

Create a schedule for your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • id - The name or ID you want to give your schedule
  • data - Map containing schedule information
    • time1 - start of time span
    • time2 - end of time span
    • exclude - inverts the time span so it is all day except for the time between time1 and time2
    • disabled - disables notifications for this day
    • allday - enables notifications for the entire day
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> id = "My Work Schedule"
iex> data = %{
"data" => %{
  "friday" => %{"exclude" => 1, "time1" => "6:00", "time2" => "18:00"},
  "monday" => %{"disabled" => true},
  "saturday" => %{"allday" => true},
  "sunday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "thursday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "tuesday" => %{"exclude" => 0, "time1" => "12:00", "time2" => "18:00"},
  "wednesday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"}
  }
}
iex> {:ok, result} = NodePing.Schedules.create(token, id, data)
Link to this function

create!(token, id, data, customerid \\ nil)

View Source

Create a schedule for your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • id - The name or ID you want to give your schedule
  • data - Map containing schedule information
    • time1 - start of time span
    • time2 - end of time span
    • exclude - inverts the time span so it is all day except for the time between time1 and time2
    • disabled - disables notifications for this day
    • allday - enables notifications for the entire day
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> id = "My Work Schedule"
iex> data = %{
"data" => %{
  "friday" => %{"exclude" => 1, "time1" => "6:00", "time2" => "18:00"},
  "monday" => %{"disabled" => true},
  "saturday" => %{"allday" => true},
  "sunday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "thursday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "tuesday" => %{"exclude" => 0, "time1" => "12:00", "time2" => "18:00"},
  "wednesday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"}
  }
}
iex> result = NodePing.Schedules.create!(token, id, data)
Link to this function

delete(token, name, customerid \\ nil)

View Source

Delete a schedule by its name (ID) on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • name - The name or ID of the schedule to delete
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> name = "My work schedule"
iex> {:ok, result} = NodePing.Schedules.delete(token, name)
Link to this function

delete!(token, name, customerid \\ nil)

View Source

Delete a schedule by its name (ID) on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • name - The name or ID of the schedule to delete
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> name = "My work schedule"
iex> result = NodePing.Schedules.delete!(token, name)
Link to this function

get_all(token, customerid \\ nil)

View Source

Get all schedules on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> {:ok, result} = NodePing.Schedules.get_all(token)
Link to this function

get_all!(token, customerid \\ nil)

View Source

Get all schedules on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> result = NodePing.Schedules.get_all!(token)
Link to this function

get_by_name(token, name, customerid \\ nil)

View Source

Get a schedule by its name (ID) on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • name - The name or ID you want to give your schedule
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> name = "My work schedule"
iex> {:ok, result} = NodePing.Schedules.get_by_name(token, name)
Link to this function

get_by_name!(token, name, customerid \\ nil)

View Source

Get a schedule by its name (ID) on your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • name - The name or ID you want to give your schedule
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> name = "My work schedule"
iex> result = NodePing.Schedules.get_by_name!(token, name)
Link to this function

update(token, id, data, customerid \\ nil)

View Source

Create a schedule for your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • id - The name or ID you want to give your schedule
  • data - Map containing schedule information
    • time1 - start of time span
    • time2 - end of time span
    • exclude - inverts the time span so it is all day except for the time between time1 and time2
    • disabled - disables notifications for this day
    • allday - enables notifications for the entire day
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> id = "My Work Schedule"
iex> data = %{
"data" => %{
  "friday" => %{"exclude" => 1, "time1" => "6:00", "time2" => "18:00"},
  "monday" => %{"disabled" => true},
  "saturday" => %{"allday" => true},
  "sunday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "thursday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "tuesday" => %{"exclude" => 0, "time1" => "12:00", "time2" => "18:00"},
  "wednesday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"}
  }
}
iex> {:ok, result} = NodePing.Schedules.update(token, id, data)
Link to this function

update!(token, id, data, customerid \\ nil)

View Source

Create a schedule for your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • id - The name or ID you want to give your schedule
  • data - Map containing schedule information
    • time1 - start of time span
    • time2 - end of time span
    • exclude - inverts the time span so it is all day except for the time between time1 and time2
    • disabled - disables notifications for this day
    • allday - enables notifications for the entire day
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> id = "My Work Schedule"
iex> data = %{
"data" => %{
  "friday" => %{"exclude" => 1, "time1" => "6:00", "time2" => "18:00"},
  "monday" => %{"disabled" => true},
  "saturday" => %{"allday" => true},
  "sunday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "thursday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "tuesday" => %{"exclude" => 0, "time1" => "12:00", "time2" => "18:00"},
  "wednesday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"}
  }
}
iex> result = NodePing.Schedules.update!(token, id, data)