Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Voice API #50

Merged
merged 15 commits into from
Oct 5, 2017
Merged

Add Voice API #50

merged 15 commits into from
Oct 5, 2017

Conversation

dstotijn
Copy link
Contributor

@dstotijn dstotijn commented Sep 5, 2017

This PR adds Voice API endpoints to the PHP client.

@selirah
Copy link

selirah commented Sep 5, 2017

Is there a way you can add contact through the PHP API?. Because when I was testing that I got the error "You are not authorized to perform this operation"

@dstotijn
Copy link
Contributor Author

dstotijn commented Sep 5, 2017

@EddieSeli: Is that related to this PR? Otherwise better suited for #45, which deals with contacts and groups.

@selirah
Copy link

selirah commented Sep 5, 2017

Okay, thanks. Will check that out


try {
$data = $messageBird->voiceRecordings->download('c226420d-f107-4db1-b2f9-4646656a90bc', '4f5ab5f4-c4b6-4586-9255-980bb3fd7336', 'a94f7d51-19b5-4eb8-9e8e-90fce490a577'); // Set call, leg and recording id here
echo sprintf("Received %d bytes.", mb_strlen($data));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be very handy to add to the example how to save the wave file locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


try {
$data = $messageBird->voiceTranscriptions->download('c226420d-f107-4db1-b2f9-4646656a90bc', '4f5ab5f4-c4b6-4586-9255-980bb3fd7336', 'a94f7d51-19b5-4eb8-9e8e-90fce490a577', '44e73d1f-201d-4a7d-963a-9d76bbca6c4f'); // Set call, leg, recording and transcription id here
echo sprintf("Received %d bytes.", mb_strlen($data));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, how about outputting the actual content of the transcription?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Dirk94
Copy link
Contributor

Dirk94 commented Sep 19, 2017

Client->voiceCallFlows()->getList() returns a BaseList object. BaseList expects the API to return

{ 
  "offset": 0,
  "limit": 20,
  "count": 1,
  "totalCount": 1,
  "links": {
    "first": "url-here",
    "previous": null,
    "next": null,
    "last": "url-here"
  }
  ...
}

However the voice API returns

{
  ...
  "pagination": {
    ...
  }
}

Therefore the BaseList attributes (offset, limit, links, etc) are null and the pagination attributes are ignored.

@dstotijn
Copy link
Contributor Author

@Dirk94 Pushed a fix for this. Because Voice API currently has different pagination params (e.g. no offset) and also no links param, I've introduced a new BaseList for Voice specific resources.

@samwierema
Copy link
Contributor

@Dirk94 tests are still failing. It seems like the PR uses the new array notation []. Can you fix?

@samwierema
Copy link
Contributor

@dstotijn can you do review of the changes since this week?

@dstotijn
Copy link
Contributor Author

OK, looks good!

@dstotijn dstotijn merged commit e131f3f into master Oct 5, 2017
@epels epels deleted the add-voice-api branch August 9, 2018 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants