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
Create a schedule for your account or subaccount
Parameters
token
- NodePing API token that is provided with accountid
- The name or ID you want to give your scheduledata
-Map
containing schedule informationtime1
- start of time spantime2
- end of time spanexclude
- inverts the time span so it is all day except for the time between time1 and time2disabled
- disables notifications for this dayallday
- 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)
Create a schedule for your account or subaccount
Parameters
token
- NodePing API token that is provided with accountid
- The name or ID you want to give your scheduledata
-Map
containing schedule informationtime1
- start of time spantime2
- end of time spanexclude
- inverts the time span so it is all day except for the time between time1 and time2disabled
- disables notifications for this dayallday
- 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)
Delete a schedule by its name (ID) on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountname
- The name or ID of the schedule to deletecustomerid
- 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)
Delete a schedule by its name (ID) on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountname
- The name or ID of the schedule to deletecustomerid
- 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)
Get all schedules on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountcustomerid
- optional ID to access a subaccount
Examples
iex> token = System.fetch_env!("TOKEN")
iex> {:ok, result} = NodePing.Schedules.get_all(token)
Get all schedules on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountcustomerid
- optional ID to access a subaccount
Examples
iex> token = System.fetch_env!("TOKEN")
iex> result = NodePing.Schedules.get_all!(token)
Get a schedule by its name (ID) on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountname
- The name or ID you want to give your schedulecustomerid
- 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)
Get a schedule by its name (ID) on your account or subaccount
Parameters
token
- NodePing API token that is provided with accountname
- The name or ID you want to give your schedulecustomerid
- 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)
Create a schedule for your account or subaccount
Parameters
token
- NodePing API token that is provided with accountid
- The name or ID you want to give your scheduledata
-Map
containing schedule informationtime1
- start of time spantime2
- end of time spanexclude
- inverts the time span so it is all day except for the time between time1 and time2disabled
- disables notifications for this dayallday
- 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)
Create a schedule for your account or subaccount
Parameters
token
- NodePing API token that is provided with accountid
- The name or ID you want to give your scheduledata
-Map
containing schedule informationtime1
- start of time spantime2
- end of time spanexclude
- inverts the time span so it is all day except for the time between time1 and time2disabled
- disables notifications for this dayallday
- 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)