Skip to content

List Archives (Session filter) #151

@IGitGotIt

Description

@IGitGotIt

This is a proposal to add a new OpenTok Java SDK API for listing archives with session filter support.
https://tokbox.com/developer/rest/#listing_archives

The API's belongs to OpenTok class and the new list of methods are:

  • public ArchiveList listArchives(String sessionId) throws OpenTokException
  • public ArchiveList listArchives(String sessionId, int offset, int count) throws OpenTokException

The complete list (including the above new ones) to get archive list now looks like :

  • public ArchiveList listArchives() throws OpenTokException
  • public ArchiveList listArchives(String sessionId) throws OpenTokException
  • public ArchiveList listArchives(int offset, int count) throws OpenTokException
  • public ArchiveList listArchives(String sessionId, int offset, int count) throws OpenTokException

Usage:

/* initialization 
opentok = new OpenTok.Builder(apiKey, apiSecret).build();
*/
try {
             ArchiveList archives = sdk.listArchives();
             archives = sdk.listArchives(sessionId);
             archives = sdk.listArchives(offset, count);
             archives = sdk.listArchives(sessionId, offset, count);
} catch (Exception e) {
    // do something..
}

Exceptions:

The sessionId are non-empty and non null strings of a valid session. If any/both of the string value is a null or is empty then an InvalidArgumentException is thrown. If the offset is negative or if the count parameter is > 1000 an InvalidArgumentException is thrown.

If an API error occurs a RequestException (subclass of OpenTokException) is thrown. The error code maps to HTTP error codes with additional description as follows:

         switch (response.getStatusCode()) {
                case 200:
                    responseString = response.getResponseBody();
                    break;
                case 403:
                    throw new RequestException("Could not get OpenTok Archives. The request was not authorized.");
                case 500:
                    throw new RequestException("Could not get OpenTok Archives. A server error occurred.");
                default:
                    throw new RequestException("Could not get OpenTok Archives. The server response was invalid." +
                            " response code: " + response.getStatusCode());
            }
        } catch (InterruptedException | ExecutionException e) {
            throw new RequestException("Could not get OpenTok Archives", e);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions