public class

KickflipApiClient

io.kickflip.sdk.api.KickflipApiClient

Class Overview

Kickflip API Client

After construction, requests can be immediately performed. The client will handle acquiring and refreshing OAuth Access tokens as needed.

The client is intended to manage a unique Kickflip user per Android device installation.

Summary

Public Constructors
KickflipApiClient(Context appContext, String key, String secret)
Construct a KickflipApiClient.
KickflipApiClient(Context appContext, String key, String secret, KickflipCallback cb)
Construct a KickflipApiClient.
Public Methods
boolean activeUserOwnsStream(Stream stream)
Check if a Stream is owned by the active Kickflip User.
void createNewUser(String username, String password, String email, String displayName, Map extraInfo, KickflipCallback cb)
Create a new Kickflip User.
void createNewUser(KickflipCallback cb)
Create a new Kickflip User.
void flagStream(Stream stream, KickflipCallback cb)
Flag a Stream.
User getActiveUser()
Get the current active Kickflip User.
void getStreamInfo(Stream stream, KickflipCallback cb)
Get Stream Metadata for a a public Stream.
void getStreamInfo(String streamId, KickflipCallback cb)
Get Stream Metadata for a a public io.kickflip.sdk.api.json.Stream#mStreamId.
void getStreamsByKeyword(String keyword, int pageNumber, int itemsPerPage, KickflipCallback cb)
Get a List of Streams containing a keyword.
void getStreamsByLocation(Location location, int radius, int pageNumber, int itemsPerPage, KickflipCallback cb)
Get a List of Streams near a geographic location.
void getStreamsByUsername(String username, int pageNumber, int itemsPerPage, KickflipCallback cb)
Get a List of Stream objects created by the given Kickflip User.
void getUserInfo(String username, KickflipCallback cb)
Get public user info
void loginUser(String username, String password, KickflipCallback cb)
Login an exiting Kickflip User and make it active.
void setStreamInfo(Stream stream, KickflipCallback cb)
Send Stream Metadata for a Stream.
void setUserInfo(String newPassword, String email, String displayName, Map extraInfo, KickflipCallback cb)
Set the current active user's meta info.
void startStream(Stream stream, KickflipCallback cb)
Start a new Stream.
void stopStream(Stream stream, KickflipCallback cb)
Stop a Stream.

Public Constructors

public KickflipApiClient (Context appContext, String key, String secret)

Construct a KickflipApiClient. All callbacks from this client will occur on the current calling thread.

Parameters
appContext Your Application Context
key Your Kickflip Account Key
secret Your Kickflip Account Secret

public KickflipApiClient (Context appContext, String key, String secret, KickflipCallback cb)

Construct a KickflipApiClient. All callbacks from this client will occur on the current calling thread.

Parameters
appContext Your Application Context
key Your Kickflip Account Key
secret Your Kickflip Account Secret
cb A callback to be notified when the provided Kickflip credentials are verified

Public Methods

public boolean activeUserOwnsStream (Stream stream)

Check if a Stream is owned by the active Kickflip User.

Parameters
stream the Stream to test.
Returns
  • true if the active Kickflip User owns the Stream. false otherwise.

public void createNewUser (String username, String password, String email, String displayName, Map extraInfo, KickflipCallback cb)

Create a new Kickflip User. The User created as a result of this request is cached and managed by this KickflipApiClient throughout the life of the host Android application installation.

The other methods of this client will be performed on behalf of the user created by this request, unless noted otherwise.

Parameters
username The desired username for this Kickflip User. Will be altered if not unique for this Kickflip app.
password The password for this Kickflip user.
email The email address for this Kickflip user.
displayName The display name for this Kickflip user.
extraInfo Map data to be associated with this Kickflip User.
cb This callback will receive a User in onSuccess(io.kickflip.sdk.api.json.Response) or an Exception onError(io.kickflip.sdk.exception.KickflipException).

public void createNewUser (KickflipCallback cb)

Create a new Kickflip User. The User created as a result of this request is active for this KickflipApiClient instance throughout the life of the host Android application installation, until a subsequent call to this method or loginUser(String, String, KickflipCallback) }

The other methods of this client will be performed on behalf of the user created by this request, unless noted otherwise.

Parameters
cb This callback will receive a User in onSuccess(io.kickflip.sdk.api.json.Response) or an Exception onError(io.kickflip.sdk.exception.KickflipException).

public void flagStream (Stream stream, KickflipCallback cb)

Flag a Stream. Used when the active Kickflip User does not own the Stream.

To delete a recording the active Kickflip User owns, use setStreamInfo(io.kickflip.sdk.api.json.Stream, KickflipCallback)

Parameters
stream The Stream to flag.
cb A callback to receive the result of the flagging operation.

public User getActiveUser ()

Get the current active Kickflip User. If no User has been created, returns null.

This will be the User created on the last call to createNewUser(KickflipCallback)

public void getStreamInfo (Stream stream, KickflipCallback cb)

Get Stream Metadata for a a public Stream. The target Stream must belong a User of your Kickflip app.

Parameters
stream the Stream to get Meta data for
cb A callback to receive the updated Stream upon request completion

public void getStreamInfo (String streamId, KickflipCallback cb)

Get Stream Metadata for a a public io.kickflip.sdk.api.json.Stream#mStreamId. The target Stream must belong a User within your Kickflip app.

This method is useful when digesting a Kickflip.io/ url, where only the StreamId String is known.

Parameters
streamId the stream Id of the given stream. This is the value that appears in urls of form kickflip.io/
cb A callback to receive the current Stream upon request completion

public void getStreamsByKeyword (String keyword, int pageNumber, int itemsPerPage, KickflipCallback cb)

Get a List of Streams containing a keyword.

This method searches all public recordings made by Users of your Kickflip app.

Parameters
keyword The String keyword to query
cb A callback to receive the resulting List of Streams

public void getStreamsByLocation (Location location, int radius, int pageNumber, int itemsPerPage, KickflipCallback cb)

Get a List of Streams near a geographic location.

This method searches all public recordings made by Users of your Kickflip app.

Parameters
location The target Location
radius The target Radius in meters
cb A callback to receive the resulting List of Streams

public void getStreamsByUsername (String username, int pageNumber, int itemsPerPage, KickflipCallback cb)

Get a List of Stream objects created by the given Kickflip User.

Parameters
username the target Kickflip username
cb A callback to receive the resulting List of Streams

public void getUserInfo (String username, KickflipCallback cb)

Get public user info

Parameters
username The Kickflip user's username
cb This callback will receive a User in onSuccess(io.kickflip.sdk.api.json.Response) or an Exception onError(io.kickflip.sdk.exception.KickflipException).

public void loginUser (String username, String password, KickflipCallback cb)

Login an exiting Kickflip User and make it active.

Parameters
username The Kickflip user's username
password The Kickflip user's password
cb This callback will receive a User in onSuccess(io.kickflip.sdk.api.json.Response) or an Exception onError(io.kickflip.sdk.exception.KickflipException).

public void setStreamInfo (Stream stream, KickflipCallback cb)

Send Stream Metadata for a Stream. The target Stream must be owned by the User created with createNewUser(KickflipCallback) from this KickflipApiClient.

Parameters
stream the Stream to get Meta data for
cb A callback to receive the updated Stream upon request completion

public void setUserInfo (String newPassword, String email, String displayName, Map extraInfo, KickflipCallback cb)

Set the current active user's meta info. Pass a null argument to leave it as-is.

Parameters
newPassword the user's new password
email the user's new email address
displayName The desired display name
extraInfo Arbitrary String data to associate with this user.
cb This callback will receive a User in onSuccess(io.kickflip.sdk.api.json.Response) or an Exception onError(io.kickflip.sdk.exception.KickflipException).

public void startStream (Stream stream, KickflipCallback cb)

Start a new Stream. Must be called after createNewUser(KickflipCallback) Delivers stream endpoint destination data via a KickflipCallback.

Parameters
cb This callback will receive a Stream subclass in onSuccess(io.kickflip.sdk.api.json.Response) depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, RtmpStream, etc.

public void stopStream (Stream stream, KickflipCallback cb)

Parameters
cb This callback will receive a Stream subclass in onSuccess(io.kickflip.sdk.api.json.Response) depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, StartRtmpStreamResponse, etc.