Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ MessageBird's REST API for Python
=================================
This repository contains the open source Python client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/.

Something random

Requirements
------------
- [Sign up](https://www.messagebird.com/en/signup) for a free MessageBird account
Expand Down
2 changes: 1 addition & 1 deletion examples/call_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import messagebird

exampleCallFlow = '{"title":"Test Flow","steps":[{"action":"say","options":{"payload":"Hey, this is your first voice \
exampleCallFlow = '{"steps":[{"action":"say","options":{"payload":"Hey, this is your first voice \
call","language":"en-GB","voice":"female"}}]}'

parser = argparse.ArgumentParser(usage='call_create.py\
Expand Down
1 change: 0 additions & 1 deletion examples/call_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# Print the object information.
print('\nThe following information was returned as a CallFlow object:\n')
print(' id : {}'.format(call.id))
print(' title : {}'.format(call.title))
print(' steps : ')
for step in call.steps:
print(step)
Expand Down
12 changes: 8 additions & 4 deletions messagebird/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,16 @@ def call_flow_list(self, limit=10, offset=0):
query = self._format_query(limit, offset)
return CallFlowList().load(self.request('call-flows?' + query, 'GET', None, VOICE_TYPE))

def call_flow_create(self, title, steps, default=False, record=False):
params = {'title': title, 'steps': steps, 'default': default, 'record': record}
def call_flow_create(self, steps, default=False, record=False, title=None):
params = {'steps': steps, 'default': default, 'record': record}
if title is not None:
params['title'] = title
return CallFlow().load(self.request('call-flows', 'POST', params, VOICE_TYPE))

def call_flow_update(self, id, title, steps, default, record):
params = {'title': title, 'steps': steps, 'default': default, 'record': record}
def call_flow_update(self, id, steps, default, record, title=None):
params = {'steps': steps, 'default': default, 'record': record}
if title is not None:
params['title'] = title
return CallFlow().load(self.request('call-flows/' + str(id), 'PUT', params, VOICE_TYPE))

def call_flow_delete(self, id):
Expand Down
1 change: 0 additions & 1 deletion tests/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_call_create(self):
"source": "31644556677",
"destination": "31612345678",
"callFlow": {
"title": "Say message",
"steps": [
{
"action": "say",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_call_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def test_get_flow_list(self):
"data": [
{
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c635",
"title": "Forward call to 31612345678",
"record": false,
"steps": [
{
Expand All @@ -64,7 +63,6 @@ def test_get_flow_list(self):
},
{
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c634",
"title": "Forward call to 0600123123",
"record": true,
"steps": [
{
Expand Down Expand Up @@ -97,8 +95,9 @@ def test_get_flow_list(self):
call_flow_list = Client('', http_client).call_flow_list(20, 0)

http_client.request.assert_called_once_with('call-flows?limit=20&offset=0', 'GET', None)
self.assertEqual(call_flow_list.data[0].title, None)
self.assertEqual(call_flow_list.data[1].title, None)

self.assertEqual('Forward call to 0600123123', call_flow_list.data[1].title)
self.assertEqual(2, call_flow_list.pagination['totalCount'])

def test_numbers_list(self):
Expand Down