Skip to content

Commit b0f6951

Browse files
committed
Added more documentation
Copied most of the body from the README and reformatted it for the index.rst.
1 parent 885edf3 commit b0f6951

File tree

1 file changed

+118
-2
lines changed

1 file changed

+118
-2
lines changed

docs/index.rst

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,126 @@ intercom
77

88
api/modules
99

10-
Source `documentation <api/modules.html>`_.
11-
1210
Installation
1311
============
1412

1513
``pip install python-intercom``
1614

15+
Python wrapper for the Intercom API
16+
===================================
17+
18+
Authentication
19+
---------------
20+
21+
More information on `docs.intercom.io <http://docs.intercom.io/api#authentication>`_.
22+
23+
::
24+
25+
from intercom import Intercom
26+
Intercom.app_id = 'dummy-app-id'
27+
Intercom.api_key = 'dummy-api-key'
28+
29+
Users
30+
-----
31+
32+
Getting all Users
33+
+++++++++++++++++
34+
35+
More information on `docs.intercom.io <http://docs.intercom.io/api#getting_all_users>`_.
36+
37+
::
38+
39+
from intercom import User
40+
for user in User.all():
41+
print user.email
42+
43+
Getting a User
44+
++++++++++++++
45+
46+
More information on `docs.intercom.io <http://docs.intercom.io/api#getting_a_user>`_.
47+
48+
::
49+
50+
user = User.find(email="ben@intercom.io")
51+
52+
Creating a User
53+
+++++++++++++++
54+
55+
More infomation on `docs.intercom.io <http://docs.intercom.io/api#creating_a_user>`_.
56+
57+
::
58+
59+
user = User.create(email="ben@intercom.io",
60+
user_id=7902,
61+
name="Ben McRedmond",
62+
created_at=datetime.now(),
63+
custom_data={"plan": "pro"},
64+
last_seen_ip="1.2.3.4",
65+
last_seen_user_agent="ie6")
66+
67+
Updating a User
68+
+++++++++++++++
69+
70+
More information on `docs.intercom.io <http://docs.intercom.io/api#updating_a_user>`_.
71+
72+
::
73+
74+
user = User.find(email="ben@intercom.io")
75+
user.name = "Benjamin McRedmond"
76+
user.save()
77+
78+
Impressions
79+
-----------
80+
81+
Creating an Impression
82+
++++++++++++++++++++++
83+
84+
More information on `docs.intercom.io <http://docs.intercom.io/api#creating_an_impression>`_.
85+
86+
::
87+
88+
from intercom import Impression
89+
impression = Impression.create(email="ben@intercom.io",
90+
user_agent="my-awesome-android-app-v0.0.1")
91+
92+
Message Threads
93+
---------------
94+
95+
Getting Message Threads
96+
+++++++++++++++++++++++
97+
98+
More information on `docs.intercom.io <http://docs.intercom.io/api#getting_messages>`_.
99+
100+
::
101+
102+
from intercom import MessageThread
103+
104+
# all message threads
105+
message_threads = MessageThread.find_all(email="ben@intercom.io")
106+
107+
# a specific thread
108+
message_threads = MessageThread.find_all(email="ben@intercom.io",
109+
thread_id=123)
110+
111+
Creating a Message Thread
112+
+++++++++++++++++++++++++
113+
114+
::
115+
116+
message_thread = MessageThread.create(email="ben@intercom.io",
117+
body="Hey Intercom, What is up?")
118+
119+
Reply on a Message Thread
120+
+++++++++++++++++++++++++
121+
122+
::
123+
124+
message_thread = MessageThread.create(email="ben@intercom.io",
125+
thread_id=123,
126+
body="No much either :(")
127+
128+
pydoc
129+
=====
130+
131+
View the extensive `pydoc <api/modules.html>`_ which has liberal helpings of
132+
`doctests` to display usage.

0 commit comments

Comments
 (0)