Skip to content

Commit 2dc79d9

Browse files
authored
[TOOLSLIBS-394] Attributes++ Listing and Lookup Support (#169)
* adds attributes, email, and named_user information * adds channel listing and lookup items * unicode!
1 parent c36a946 commit 2dc79d9

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Adds iOS platform options for: interruption_level, relevance_score, and target_content_id
44
- Adds amazon platform options for: notification_tag, notification_channel, icon, icon_color
5+
- Adds attributes, device_attributes, named_user_id, commercial_opted_in, commercial_opted_out, transactional_opted_in, transactional_opted_out to channel look up and listing.
56
- Adds support for setting attributes on channel ids and named user ids
67
- Adds support for removing attributes from channel ids and named user ids
78

@@ -45,7 +46,7 @@
4546

4647
## 5.3.1
4748

48-
- Fixes an issue where SegmentsList URL was not being bulit properly.
49+
- Fixes an issue where SegmentsList URL was not being built properly.
4950

5051
---
5152

urbanairship/devices/devicelist.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datetime
22
import logging
3+
34
from urbanairship import common
45

56
logger = logging.getLogger("urbanairship")
@@ -29,7 +30,20 @@ class ChannelInfo(object):
2930
:ivar open: Open channel specific information, e.g. ``identifiers`` and
3031
``open_platform_name``.
3132
:ivar web: Web notify specific information, e.g. ``subscription``.
32-
33+
:ivar named_user_id: A customer-chosen ID that represents the device user.
34+
:ivar device_attributes: Native attribute properties that Airship gathers
35+
automatically assigns to a channel. Varies by channel type.
36+
:ivar attributes: A dictionary of attributes that you've associated with the
37+
channel.
38+
:ivar commercial_opted_in: The date-time when a user gave explicit permission
39+
to receive commercial emails.
40+
:ivar commcercial_opted_out: The date-time when a user explicitly denied permission
41+
to receive commercial emails.
42+
:ivar transactional_opted_in: The date-time when a user gave explicit permission to
43+
receive transactional emails. Users do not need to opt-in to receive
44+
transactional emails unless they have previously opted out.
45+
:ivar transactional_opted_out: The date-time when a user explicitly denied
46+
permission to receive transactional emails.
3347
"""
3448

3549
airship = None
@@ -48,6 +62,13 @@ class ChannelInfo(object):
4862
ios = None
4963
open = None
5064
web = None
65+
named_user_id = None
66+
device_attributes = None
67+
attributes = None
68+
commercial_opted_in = None
69+
commercial_opted_out = None
70+
transactional_opted_in = None
71+
transactional_opted_out = None
5172

5273
def __init__(self, airship):
5374
self.airship = airship
@@ -60,7 +81,14 @@ def from_payload(cls, payload, device_key, airship):
6081
if airship:
6182
obj.airship = airship
6283
for key in payload:
63-
if key in ("created", "last_registration"):
84+
if key in (
85+
"created",
86+
"last_registration",
87+
"commercial_opted_in",
88+
"commercial_opted_out",
89+
"transactional_opted_in",
90+
"transactional_opted_out",
91+
):
6492
try:
6593
payload[key] = datetime.datetime.strptime(
6694
payload[key], "%Y-%m-%dT%H:%M:%S"

0 commit comments

Comments
 (0)