Notifications (risksense_api.__subject.__notifications.__notifications
)¶
Notification module defined for different notification related api endpoints.
- class risksense_api.__subject.__notifications.__notifications.Notifications(profile)[source]¶
Bases:
Subject
Class for notification function definitions.
- Parameters:
profile (
object
) – Profile Object
To utlise notification function:
- Usage:
self.{risksenseobjectname}.notifications.{function}
Examples
To get a model for notification using
get_model()
function>>> self.{risksenseobjectname}.notifications.get_model()
- __init__(profile)[source]¶
Initialization of Notifications object.
- Parameters:
profile (
object
) – Profile Object
- subscribe_notifications(notificationtypeid, csvdump=False, subscribe=True, client_id=None)[source]¶
Subscribe to a notification
- Parameters:
notificationtypeid (
int
) – The notification id to subscribe.csvdump (
bool
) – dumps the data in csvsubscribe – Whether to subscribe or not
client_id – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Success json
Examples
>>> apiobj = self.{risksenseobject}.notifications.subscribe_notifications(123)
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.subscribe_notifications(123,csvdump=True)
- unsubscribe_notifications(notificationtypeid, csvdump=False, subscribe=False, client_id=None)[source]¶
Unsubscribe to a notification
- Parameters:
notificationtypeid (
int
) – The notification id to subscribe.subscribe (
bool
) – Whether to subscribe or notcsvdump (
bool
) – dumps the data in csvclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Success json
Examples
>>> apiobj = self.{risksenseobject}.notifications.unsubscribe_notifications(123)
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.unsubscribe_notifications(123,csvdump=True)
- markasread(notificationids, markasread=False, client_id=None)[source]¶
Mark as read/unread notifications
- Parameters:
notificationtypeid – The notification id to subscribe.
markasread (
bool
) – Whether to markread or notclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
bool
- Returns:
Success json
Examples
>>> apiobj = self.{risksenseobject}.notifications.markasread(123,markasread=True)
- Parameters:
notificationids (
list
) –
- create_delivery_channel(channelname, channeltype, address, verificationcode, webhookcontenttype=None, client_id=None)[source]¶
Creates delivery channel for the user
- Parameters:
channelname (
str
) – Name of channelchanneltype (
str
) – Type of channeladdress (
str
) – Addressverificationcode (
str
) – Verification code of userwebhookcontenttype (
typing.Optional
[bool
]) – Webhook content typeclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
str
- Returns:
Status
Examples
>>> apiobj = self.{risksenseobject}.notifications.create_delivery_channel('test','EMAIL','abc@xyz.com','12345')
- edit_delivery_channel(channelid, channelname, channeltype, address, verificationcode, webhookcontenttype=None, disabled=False, shared=False, client_id=None)[source]¶
Edits delivery channel for the user
- Parameters:
channelid (
int
) – Channel idchannelname (
str
) – Name of channelchanneltype (
str
) – Type of channeladdress (
str
) – Addressverificationcode (
int
) – Verification code of userwebhookcontenttype – Webhook content type
disabled (
bool
) – Enable/disable notificationsshared (
bool
) – Sharedclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
str
- Returns:
Status
Examples
>>> apiobj = self.{risksenseobject}.notifications.edit_delivery_channel(123,'test','EMAIL','abc@xyz.com','1234')
- delete_delivery_channel(channelids, client_id=None)[source]¶
Deletes delivery channels
- Parameters:
channelids (
list
) – Channel idsclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
str
- Returns:
Status
Examples
>>> apiobj = self.{risksenseobject}.notifications.delete_delivery_channel([123,123])
- list_channel(order='ASC', csvdump=False, client_id=None)[source]¶
Get list of channel for admin
- Parameters:
order (
str
) – sort ordercsvdump (
bool
) – Toogle to dump the data to csvclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
List channel
Examples
>>> apiobj = self.{risksenseobject}.notifications.list_channel()
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.list_channel(csvdump=True)
- list_channel_user(order='ASC', csvdump=False, client_id=None)[source]¶
List delivery channels for normal user
- Parameters:
order (
str
) – Sort ordercsvdump (
bool
) – csvdumpclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Status
Examples
>>> apiobj = self.{risksenseobject}.notifications.list_channel_user()
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.list_channel_user(csvdump=True)
- send_verification_code(channelname, channeladdress, channeltype, client_id=None)[source]¶
Sends verification code to the user
- Parameters:
channelname (
str
) – Name of the channel.channeladdress (
str
) – Address of the channel.channeltype (
str
) – TYPE of channelclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
str
- Returns:
Status
Examples
>>> apiobj = self.{risksenseobject}.notifications.send_verification_code('test','https://abc.com','SLACK')
- get_model(client_id=None)[source]¶
List projections and their models that can be requested from the search endpoint.
- Parameters:
client_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id- Return type:
dict
- Returns:
Model of endpoint
Examples
>>> apiobj = self.{risksenseobject}.notifications.get_model()
- search_filters(client_id=None)[source]¶
List fields that can be filtered by in the search endpoint
- Parameters:
client_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id- Return type:
dict
- Returns:
Search filter fields
Examples
>>> apiobj = self.{risksenseobject}.notifications.search_filters()
- notification_search(filters, csvdump=False, client_id=None)[source]¶
Search for notifications
- Parameters:
filters (
list
) – Search filterscsvdump (
bool
) – csvdumpclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Success json
Examples
>>> apiobj = self.{risksenseobject}.notifications.notification_search([])
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.notification_search([],csvdump=True)
- enablenotification(id, channelname, channeltype, client_id=None)[source]¶
Enable notifications
- Parameters:
id (
int
) – Notification Idchannelname (
str
) – Channel namechanneltype (
str
) – Channel typeclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Jsonified response
Examples
>>> apiobj = self.{risksenseobject}.notifications.enablenotification(123,'test','EMAIL')
- disablenotification(id, channelname, channeltype, client_id=None)[source]¶
Disable notifications
- Parameters:
id (
int
) – Notification Idchannelname (
str
) – Channel namechanneltype (
str
) – Channel typeclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
dict
- Returns:
Jsonified response
Examples
>>> apiobj = self.{risksenseobject}.notifications.disablenotification(123,'test','EMAIL')
- get_notifications(page=0, page_size=50, client_id=None)[source]¶
Get Notifications
- Parameters:
client_id (
typing.Optional
[int
]) – The client id , if none will provide the default client idpage (
int
) – Page numberpage_size (
int
) – Page size
- Return type:
dict
- Returns:
Jsonified response
Examples
>>> apiobj = self.{risksenseobject}.notifications.get_notifications(client_id=123)
- get_detailpane(notification_id, csvdump=False, client_id=None)[source]¶
Get details pane
- Parameters:
notificationid – The notiifcation id to get details of
csvdump (
bool
) – dumps the data in csvclient_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id
- Return type:
list
- Returns:
Notifications detail
Examples
>>> apiobj = self.{risksenseobject}.notifications.get_detailpane(123)
Note
You can also dump the data of the notification in a csv file. Just make csvdump as True:
>>> self.{risksenseobject}.notifications.subscribe_notifications(123,csvdump=True)
- Parameters:
notification_id (
int
) –
- get_delivery_channel_template(client_id=None)[source]¶
Get delivery channel template
- Parameters:
client_id (
typing.Optional
[int
]) – The client id , if none will provide the default client id- Returns:
Delivery channel template
Examples
>>> apiobj = self.{risksenseobject}.notifications.get_delivery_channel_template()
- trigger_systemfilter(filterid, subject, description, client_id=None)[source]¶
Trigger system filter
- Parameters:
filterid (
int
) – Filter Idsubject (
str
) – Filter subjectdescription (
str
) – Description
- Returns:
Jsonified response
Examples
>>> apiobj = self.{risksenseobject}.notifications.trigger_systemfilter(123,'test','test')
- Parameters:
client_id (
typing.Optional
[int
]) –