This class represent the chateagratis API's, this is single abstraction for all API methods.

This class cannot connect with server, this responsibility it is class that implement ClientInterface for example ChateaGratisClient or ChateaGratisAppClient
author Xabier Fernández Rodríguez in Ant-Web S.L.
package Ant\ChateaClient\Client
see
see
see

 Methods

Create a new API object

__construct(\Ant\ChateaClient\Service\Client\Client $client) 

Parameters

$client

\Ant\ChateaClient\Service\Client\Client

The http client liable to request server commands

Add new Photo Album in user accont

addAlbum(int $user_id, string $title, string $description) : array | string
examples Add Photo Album $your_api_instance->addAlbum(1,'new Album', 'this is me personal photobook'); array( "id" => 2, "participant" => array( "id" => 1, "username" => "alex", "email" => "alex@chateagratis.net" ), "title" => "new Album", "description" => "this is me personal photobook" );

Parameters

$user_id

int

The user ID

$title

string

One name for the Album

$description

string

A short description of type photos

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with new album data | Message with error in json format

Insert a photo entity into album id

addAlbumPhoto(int $user_id, int $photo_id, int $album_id) : array | string
examples Add photo 1 on album 1 $your_api_instance->addAlbumPhoto(1,1,1); // ouput message Photo inserted

Parameters

$user_id

int

The user id to retrieve data

$photo_id

int

The photo id to insert

$album_id

int

The album id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with the album one user | Message with error in json format

Create un new Channel

addChanel(string $name, string $title, string $description, string $channel_type) : array | string
examples $your_api_instance->addChanel('new channel name','API - Channel Name', 'This is channel about loves, friends and others', 'love');

Sample Ouput

array( "id" =>96 "name" =>"new channel name", "slug" =>"new-channel-name", "title" =>"API - Channel Name", "description" =>"This is channel about loves, friends and others", "owner" => array( "id" =>1 "username" =>"alan" ), "channel_type" => array( "name" =>"love" ), "_links" => array( "self" => array( "href" =>"https://api.chatsfree.net/api/channels/96" ), "fans" => array( "href" =>"https://api.chatsfree.net/api/channels/96/fans" ), "owner" => array( "href" =>"https://api.chatsfree.net/api/users/1" ) ) );

Parameters

$name

string

The name of channel this is unique

$title

string

The title of channel

$description

string

The long description of channel

$channel_type

string

The type pof channel, This value have a subset available in server, you can view the channels type with command @link #showChannelsTypes()

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with new channel | Message with error in json format

Sends a friendship request between two users

addFriends(int $user_id, int $friend_id) : string
examples Sends a friendship request between user 1 to user 3 $your_api_instance->addFriends(1,3);

Parameters

$user_id

int

Your user id

$friend_id

int

The user id that retrieve the request

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMassage endorsement , if the request have been sent

Accept request new Friend

addFriendshipRequest(int $user_id, int $user_accept_id) : string
examples User 1 accept like new Friend to user 3 $your_api_instance->showFriendshipsRequest(1,3); Friendship accepted

Parameters

$user_id

int

The user id that you retrieve request new Friend

$user_accept_id

int

The user id pending friendship

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage accepted | Message with error in json format

upload new photo at server api

addPhoto(int $user_id, string $imageFile, string $imageTile) : array | string
examples Add Photo $your_api_instance->addPhoto(1,'my face in wall', '/home/alex/my_face_wall.png'); array( "id" => 9, "participant" => array( "id" => 1, "username" => "alex", ), "publicated_at" => "2013-10-30T08:11:22+0100", "path" => "2013/10/30/5270b11b25f5c.png", "number_votes" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/photos/9", ), "creator" => array( "href" => "http://api.chateagratis.net/api/users/1", ), "path" => array( "href" => "http://api.chateagratis.net/uploads/2013/10/30/5270b11b25f5c.png", "type" => "image/*", ) ) );

Parameters

$user_id

int

The user owner of photo

$imageFile

string

The path to upload photo

$imageTile

string

The name of photo

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with new album data | Message with error in json format

Add one vote at photo

addPhotoVote(int $user_id, int $photo_id, int $score) : array | string
examples array ( "score" => 10, "photo" => array( "id" => 6, "number_votes" => 21, "score" => 47.571428571428, ), "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/photos/6/votes", ), "photo" => array( "href" => "http://api.chatsfree.net/api/photos/6", ), "participant" => array( "href" => "http://api.chatsfree.net/api/users/1", ) ) );

Parameters

$user_id

int

The user id to retrieve data

$photo_id

int

The photo id to retrieve data

$score

int

The score photo, The score ha to be between one and ten

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with you vote | Message with error in json format

Report a photo

addReportPhoto(int $photo_id, string $reason) : array | string
examples Add Photo report $your_api_instance->addReportPhoto(1,'This photo is not adequate'); array( "reason" => "this is not me photo", "created_at" => "2013-10-29T12:13:07+0100", "id" => 9, );

Parameters

$photo_id

int

The Photo ID to be reported

$reason

string

The reason this report

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with report | Message with error in json format

Create new thread

addThread(int $user_id, string $recipient_name, string $subject, string $body) : array | string
examples Add new thread $your_api_instance->addThread(1,'alex2','Subject sample',"this is my body in 1rst message ") array( "id" => 5, "subject" => "Subject sample", );

Parameters

$user_id

int

The user id that create the thread

$recipient_name

string

The ID username that retrieve the message

$subject

string

The short description of thread

$body

string

The long text of thread

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with data thread | Message with error in json format

Add one message on thread

addThreadMessage(int $user_id, int $thread_id, string $body) : array | string
examples Add one message on thread $your_api_instance->showThreadMessages(1,1,'this is entity body'); array( "id" => 15, "body" => "this is entity body", "created_at" => "2013-10-30T14:00:53+0100" );

Parameters

$user_id

int

The user id that create the thread

$thread_id

int

The ID of thread

$body

string

the text of message

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with messages | Message with error in json format

Blocked one user

addUserBlocked(int $user_id, int $user_blocked_id) : string
examples Blocked one user $your_api_instance->addUserBlocked(1,6); //output User blocked

Parameters

$user_id

int

User to retrieve by ID

$user_blocked_id

int

User to blocked by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can blocked an user | Message with error in json format

Make channel's fan one user

addUserChannelFan(int $channel_id, int $user_id) : string
examples add the user 1 fan of channel 1 $your_api_instance->addUserChannelFan(1,1);

The ouput message:

The user is a fan of the channel successfully

Parameters

$channel_id

int

Channel id to receive a fan

$user_id

int

The user id will be fan

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMassage ok if user is new fan

addUserProfile()

addUserProfile(int $user_id, string $about, string $seeking, $gender, $youWant, $birthday) : array | string
todo comprobaciones para gender and youWant Add new profile one user
examples Create profile one user $your_api_instance->addUserProfile(1,'about-10','bisexual'); array( "id" => 11, "about" => "about-10", "seeking" => "bisexual", "count_visits" => 0, "publicated_at" => "2013-10-30T16:43:51+0100", );

Parameters

$user_id

int

User to retrieve by ID

$about

string

Short description your profile

$seeking

string

Choice between

$gender

$youWant

$birthday

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with profile data | Message with error in json format

Report a user

addUserReports(int $user_reported_id, string $reason) : array | string

Parameters

$user_reported_id

int

The user id that is report

$reason

string

Description for report the user

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error array( "reason" => "this user is heterosexual", "created_at" => "2013-10-30T17:03:29+0100", "id" => 44, );

Returns

arraystringAssociative array with report data | Message with error in json format

Change user password

changePassword(string $current_password, string $new_password, string $repeat_new_password) : string
examples $your_api_instance->changePassword('current_password','new_password','repeat_new_password'); //ouput message Password changed sucessfully

Parameters

$current_password

string

your actual password

$new_password

string

your new password

$repeat_new_password

string

repeat your new password

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringmessage password changed sucessfully if your password have been changed | Message with error in json format

Delete one album

delAlbum(int $user_id, int $album_id) : string
examples Delete an abum 1 to user 1 $your_api_instance->delAlbum(1,1); // ouput message Album deleted

Parameters

$user_id

int

The user id to retrieve data

$album_id

int

The album id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can delete the album | Message with error in json format

Delete channel

delChannel(int $channel_id) : string
examples $your_api_instance->delChannel(96);

Ouput this message:

Channel deleted

Parameters

$channel_id

int

Channel to update by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringThe message ok, if channel has been deleted

Delete friends between two users

delFriend(int $user_id, int $user_delete_id) : string
examples User 1 delete friendship to user 3 $your_api_instance->delFriend(1,3); Friendship deleted

Parameters

$user_id

int

The user id that you delere friend

$user_delete_id

int

The user id, you want deleted.

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage delete | Message with error in json format

Decline a friendship request

delFriendshipRequest(int $user_id, int $user_decline_id) : string
examples User 1 declined like new Friend to user 3 $your_api_instance->delFriendshipRequest(1,3); Friendship declined

Parameters

$user_id

int

The user id that you decliene new Friend

$user_decline_id

int

The user id pending friendship

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage declined | Message with error in json format

Delete my user

delMe() : string
examples Delete me user $your_api_instance->delMe(); //ouput message User deleted

Exceptions

\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage deleted user | Message with error in json format

Delete a Photo

delPhoto(int $photo_id) : string
examples Delete Photo $your_api_instance->delPhoto(1); Photo deleted

Parameters

$photo_id

int

The photo id you like deleting

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can delete the photo | Message with error in json format

Delete a photo of album

delPhotoAlbum(int $user_id, int $photo_id) : string
examples Delete an abum 1 to user 1 $your_api_instance->delAlbum(1,1); Photo deleted of Album

Parameters

$user_id

int

The user id to retrieve data

$photo_id

int

The photo id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can delete photo of album | Message with error in json format

Delete one vote of one photo

delPhotoVote(int $user_id, int $photo_id) : string
examples Delete one vote of photo 6 $your_api_instance->delPhotoVote(1,6); //output Vote deleted

Parameters

$user_id

int

The user id to delete data

$photo_id

int

The phot id to delete vote

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can delete the vote | Message with error in json format

Delete one thread ant all messages

delThread(int $user_id, int $thread_id) : string
examples Delete thread 6 $your_api_instance->delThread(6); //ouput message Thread deleted

Parameters

$user_id

int

The user id that create the thread

$thread_id

int

The ID of thread

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can delete thread | Message with error in json format

UnBlocked one user

delUserBlocked(int $user_id, int $user_blocked_id) : string
exampless Unblocked one user $your_api_instance->delUserBlocked(1,6); //output User unblocked

Parameters

$user_id

int

User to retrieve by ID

$user_blocked_id

int

User to blocked by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMessage sucessfully if can blocked an user | Message with error in json format

Remove channel's fan one user

delUserChannelFan(int $channel_id, int $user_id) : string
examples remove the user 1 fan of channel 1 $your_api_instance->delUserChannelFan(1,1);

The ouput message:

The user has been removed as fan of the channel successfully

Parameters

$channel_id

int

Channel id to receive a fan

$user_id

int

The user id will be fan

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringMassage ok if user is not fan

Request reset the user password. The server send email with new password, this this request is only once for day.

forgotPassword(string $username_or_email) : string
examples Request reset the user password $your_api_instance->forgotPassword('you_user_name'); $your_api_instance->forgotPassword('you_email@antwebs.es');

Parameters

$username_or_email

string

The user email or username

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringmessage ok message if your new password have been sent

Revokes the access token and logout the user session in server.

logout() : string
exampless $your_api_instance->logout() //Sample output Access token revoked

Exceptions

\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

stringa message ok and the HTTP status code 200

Get my user

me() 
examples $your_api_instance->me(); array( 'id' => '1', 'username' => 'xabier', 'email' => 'xabier@antweb.es', "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1", ), "channels" => array( "href" => "http://api.chateagratis.net/api/users/1/channels", ), "channels_fan" => array( "href" => "http://api.chateagratis.net/api/users/1/channelsFan", ), "blocked_users" => array( "href" => "http://api.chateagratis.net/api/users/1/blocked", ) ) );

Exceptions

\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Register new user at server

register(string $username, string $email, string $new_password, string $repeat_new_password, string $affiliate_host, $ip) : array | string
examples Register new user at server $your_api_instance->register('new user name','new_password','repeat_new_password','your hosts name');

Ouput

array{ "id"=> 1234, "username"=> "new-username", "email"=> "newUserName@ant.com" }

Parameters

$username

string

The name of user. This is unique for user

$email

string

The email for user. This is unique for user

$new_password

string

The user password

$repeat_new_password

string

Repeat the password

$affiliate_host

string

The name of your server, where you make send request. You don't use protocols (http:// or ftp ) or subdomains only use primary name

$ip

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with you profile | Message with error in json format

Set a nick to a user

setUserNick(int $user_id, string $nick) : string | string

Parameters

$user_id

int

The id of the user to set the nick

$nick

string

Description for report the user

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error array( "nick" => "mysupernick", "id" => 44, );

Returns

stringstringSuccessfull message | Message with error in json format

Show one album of user

showAlbum(int $user_id, int $album_id) : array | string
examples Show an abum 1 to user 1 $your_api_instance->showUserAlbum(1,1); array( "id" => 1, "title" => "la foto 1", "description" => "default album", "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1/albums/1", ), "participant" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "photos" => array( "href" => "http://api.chatsfree.net/api/albums/1/photos", ) ) );

Parameters

$user_id

int

The user id to retrieve data

$album_id

int

The album id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with the album one user | Message with error in json format

Show all abums one user

showAlbums(int $user_id, int $limit, int $offset) : array | string
examples Show all abums to user 1, only 1rst $your_api_instance->showUserAlbums(1); array( "total" => 1, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1/albums", ) ), "resources" => array( array( "id" => 1, "title" => "la foto 1", "description" => "default album", "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1/albums/1", ), "participant" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "photos" => array( "href" => "http://api.chatsfree.net/api/albums/1/photos", ) ) ) ) );

Parameters

$user_id

int

The user id to retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all albums one user | Message with error in json format

Get channel. Show data channel by id

showChannel(int $channel_id) : array | string
examples $your_api_instance->showChannel(96); //Sample Ouput array( "id" =>96 "name" =>"update channel name", "slug" =>"update-channel-name", "title" =>"API - Channel title", "description" =>"This is channel about loves, friends and others", "owner" => array( "id" =>1 "username" =>"alex" ), "channel_type" => array( "name" =>"love" ), "_links" => array( "self" => array( "href" =>"https://api.chatsfree.net/api/channels/96" ), "fans" => array( "href" =>"https://api.chatsfree.net/api/channels/96/fans" ), "owner" => array( "href" =>"https://api.chatsfree.net/api/users/1" ) ) );

Parameters

$channel_id

int

Channel to retrieve by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with channel data | Message with error in json format

Get fans (users) the channel

showChannelFans(int $channel_id, int $limit, int $offset) : array | string
examples Show Channels Fans of channel 2, only the first $your_api_instance->showChannelFans(3,1,0);

Sample Ouput

array( "total" => 2, "limit" => 2, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/channels/2/fans" ) ), "resources" => array( array( "id" => 1, "username" => "alex", "email" => "alex@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1" ), "channels" => array( "href" => "http://api.chateagratis.net/api/users/1/channels" ), "channels_fan" => array( "href" => "http://api.chateagratis.net/api/users/1/channelsFan" ), "blocked_users" => array( "href" => "http://api.chateagratis.net/api/users/1/blocked" ) ) ) ) );

Parameters

$channel_id

int

Channel to retrieve fans

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with users that are fans a channel | Message with error in json format

List all channels register in Server

showChannels(int $limit, int $offset, array $filter, array $order) : array | string
examples Get first twenty channels what type is love $your_api_instance->showChannels(25,0, array('channelType'=>'love'), array('name' => 'desc'));

Sample Ouput

array( "id"=>11, "name" => "channel 11", "slug" => "channel-11", "owner"=>array( id: 1 username: alex ), "channel_type" => array( "name" => "default" ), "_links" => array( "self" => array( href => "http://api.chateagratis.net/api/channels/11" ), "fans" => array( "href" => "http://api.chateagratis.net/api/channels/11/fans" ), "owner" => array( "href => http://api.chateagratis.net/api/users/1" ) );

Parameters

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

$filter

array

Associative array with format filter_name =>value_name

$order

array

Associative array with format order_field => order

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with channels data | Message with error in json format

Get Channles types

showChannelsTypes(int $limit, int $offset) : array | string
examples Show Channels types, only the first $your_api_instance->showChannelsTypes(1,0);

Sample Ouput

array( "total" => 6, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/channelstype" ), ), "resources" => array( array( "name" => "adult", "_links" => array( "channelsType" => array( "href" => "http://api.chateagratis.net/api/channels?filter%3DchannelType=adult", ) ) ) ) );

Parameters

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error
\InvalidArgumentException This exception is thrown if any parameter has errors

Returns

arraystringAssociative array with channels types use one channel | Message with error in json format

Get me friends

showFriends(int $user_id, int $limit, int $offset) : array | string
examples Show User friends for user id = 1, only the first friend $your_api_instance->showFriends(1,1,0); array( "total" => 4, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/friends", ), ), "resources" => array( array( "id" => 3, "username" => "alex3", "email" => "alex3@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/3", ), "channels" => array( "href" => "http://api.chateagratis.net/api/users/3/channels", ), "channels_fan" => array( "href" => "http://api.chateagratis.net/api/users/3/channelsFan", ), "blocked_users" => array( "href" => "http://api.chateagratis.net/api/users/3/blocked", ), ), ), ) );

Parameters

$user_id

int

The user id retrieve friends

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with users's are friends one user | Message with error in json format

Show list user, that one user will pending have your friendship

showFriendshipsPending(int $user_id, int $limit, int $offset) : array | string
examples Show a friendship pending by user 1, only the first friendship $your_api_instance->showFriendshipsPending(1); array( "total" => 4, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/friends/pending", ), ), "resources" => array( array( "id" => 3, "username" => "alex3", "username_canonical" => "alex3", "email" => "alex3@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/3", ), "channels" => array( "href" => "http://api.chateagratis.net/api/users/3/channels", ), "channels_fan" => array( "href" => "http://api.chateagratis.net/api/users/3/channelsFan", ), "blocked_users" => array( "href" => "http://api.chateagratis.net/api/users/3/blocked", ), ) ) ) );

Parameters

$user_id

int

The user id that you retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with users's are friends one user | Message with error in json format

Show the friendship requests sent by user id, and it pending to be accepted

showFriendshipsRequest(int $user_id, int $limit, int $offset) : array | string
examples Show the friendship requests sent by user 1, only the first request friendship $your_api_instance->showFriendshipsRequest(1,1,0); array( "total" => 4, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/friends/pending", ), ), "resources" => array( array( "id" => 3, "username" => "alex3", "username_canonical" => "alex3", "email" => "alex3@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/3", ), "channels" => array( "href" => "http://api.chateagratis.net/api/users/3/channels", ), "channels_fan" => array( "href" => "http://api.chateagratis.net/api/users/3/channelsFan", ), "blocked_users" => array( "href" => "http://api.chateagratis.net/api/users/3/blocked", ), ) ) ) );

Parameters

$user_id

int

The user id that you retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with users's are friends one user | Message with error in json format

Show Photo

showPhoto(string $photo_id) : array | string
examples Show a photo $your_api_instance->showPhoto(1); array( "id" => 1, "participant" => array( "id" => 1, "username" => "alex", ), "publicated_at" => "2013-10-29T12:27:34+0100", "path" => "photo1-path.jpg", "title" => "la foto 1", "number_votes" => 15, "score" => 15, "album" => array( "id" => 1, "title" => "la foto 1", "description" => "default album", ), "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/photos/1", ), "creator" => array( "href" => "http://api.chateagratis.net/api/users/1", ), "path" => array( "href" => "http://api.chateagratis.net/api/users/uploads/photo1-path.jpg", "type" => "image/*", ), "album" => array( "href" => "http://api.chateagratis.net/api/users/1/albums/1", ), ) );

Parameters

$photo_id

string

The photo ID that you to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with photo data | Message with error in json format

List all photos of an album

showPhotoAlbum(string $album_id, int $limit, int $offset) : array | string
examples Show first photo of photo album $your_api_instance->showPhotoAlbum(1); array( "total" => 6, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/albums/1/photos", ) ), "resources" => array( array( "id" => 1, "participant" => array( "id" => 1, "username" => "alex", ), "publicated_at" => "2013-10-29T12:27:34+0100", "path" => "photo1-path.jpg", "title" => "la foto 1", "number_votes" => 15, "score" => 15, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/photos/1", ), "creator" => array( "href" => "http://api.chateagratis.net/api/users/1", ), "path" => array( "href" => "http://api.chateagratis.net/api/users/uploads/photo1-path.jpg", "type" => "image/*", ), "album" => array( "href" => "http://api.chateagratis.net/api/users/1/albums/1", ), ), ), ) );

Parameters

$album_id

string

The photo album ID that you to retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with photos an album | Message with error in json format

Show score I had put to one photo

showPhotoVotes(int $user_id, int $photo_id) : array | string
examples Show score User id 1 had put to 5 photo $your_api_instance->showPhotoVotes(1,5); array( "score" => 100, "photo" => array( "id" => 5, "number_votes" => 15, "score" => 55, ), "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/photos/5/votes", ), "photo" => array( "href" => "http://api.chateagratis.net/api/photos/5", ), "participant" => array( "href" => "http://api.chateagratis.net/api/users/1", ) ) );

Parameters

$user_id

int

The user id to retrieve data

$photo_id

int

The photo id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with photos an album | Message with error in json format

Shows the details of a report

showReport(int $report_id) : array | string
examples Show report ID 1 $your_api_instance->showReport(1); array( "reason" => "I dislike a lot this guy", "created_at" => "2013-08-27T15:01:01+0200", "reviewed_at" => "2013-08-27T16:01:01+0200", "id" => 1, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/reports/1", ), "reporter" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "resource" => array( "href" => "http://api.chatsfree.net/api/users/2", ) ) );

Parameters

$report_id

int

The report id to retrieve data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all albums one user | Message with error in json format

Show all reports

showReports(int $limit, int $offset) : array | string
examples Show all reports, only 1rst $your_api_instance->showReports(); array( "total" => 42, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/reports", ) ), "resources" => array( array( "reason" => "I dislike a lot this guy", "created_at" => "2013-08-27T15:01:01+0200", "reviewed_at" => "2013-08-27T16:01:01+0200", "id" => 1, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/reports/1", ), "reporter" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "resource" => array( "href" => "http://api.chatsfree.net/api/users/2", ) ) ) ) );

Parameters

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all albums one user | Message with error in json format

List all message one thread

showThreadMessages(int $user_id, int $thread_id) : array | string
examples Show messages on thread $your_api_instance->showThreadMessages(1,1); array( array( "id" => 1, "body" => "este es el contenido del msg 1", "created_at" => "2013-08-25T15:01:01+0200", ),array( "id" => 2, "body" => "este es el contenido del msg 2", "created_at" => "2013-08-25T15:31:01+0200", ) );

Parameters

$user_id

int

The user id that create the thread

$thread_id

int

The ID of thread

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with messages | Message with error in json format

Show user messages have in inbox

showThreadsInbox(int $user_id) : array | string
examples Show messages inbox $your_api_instance->addThread(1); array( array( "id" => 1, "subject" => "hola thread 1", ), array( "id" => 4, "subject" => "hola thread 4", ) );

Parameters

$user_id

int

The user id see her/his inbox

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with the subject | Message with error in json format

Show all thread that you sent

showThreadsSent(int $user_id) : array | string
examples Show messages sent $your_api_instance->showThreadsSent(1); array( array( "id" => 1, "subject" => "thread sent 1", ), array( "id" => 4, "subject" => "thread sent 2", ) );

Parameters

$user_id

int

The user id see her/his sent messages

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with the subject | Message with error in json format

Show user by ID

showUser(int $user_id) : array | string
examples Show user with DI 1 $your_api_instance->showUser(); array( "id" => 1, "username" => "alex", "email" => "alex@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "channels" => array( "href" => "http://api.chatsfree.net/api/users/1/channels", ), "channels_fan" => array( "href" => "http://api.chatsfree.net/api/users/1/channelsFan", ), "blocked_users" => array( "href" => "http://api.chatsfree.net/api/users/1/blocked", ) ) );

Parameters

$user_id

int

User to retrieve by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with user data | Message with error in json format

Show channels created for the user

showUserChannels(int $user_id, int $limit, int $offset) : array | string
examples Show Channels created by user id = 1, only the first channel $your_api_instance->showUserChannels(1,1,0); array( "total" => 32, "limit" => 32, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/channels", ), ), "resources" => array( array( "id" => 1, "name" => "channel 1", "slug" => "channel-1", "owner" => array( "id" => 1, "username" => "alex", ), "channel_type" => array( "name" => "adult", ), "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/channels/1", ), "fans" => array( "href" => "http://api.chateagratis.net/api/channels/1/fans", ), "owner" => array( "href" => "http://api.chateagratis.net/api/users/1", ), ) ) ) );

Parameters

$user_id

int

User id to retrieve channel

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with channels created one user | Message with error in json format

Show channels favorites one user

showUserChannelsFan(int $user_id, int $limit, int $offset) : array | string
examples Show Channels favorites for user id = 1, only the first channel $your_api_instance->showUserChannelsFan(1,1,0); array( "total" => 2, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/channelsFan" ), ), "resources" => array( array( "id" => 2, "name" => "channel 2", "slug" => "channel-2", "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/channels/2" ), "fans" => array( "href" => "http://api.chateagratis.net/api/channels/2/fans", ), "owner" => array( "href" => "http://api.chateagratis.net/api/users/2" ) ) ) ) );

Parameters

$user_id

int

User id to retrieve fans channels

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with channel's is fan one user | Message with error in json format

Show all votes of one user

showUserPhotoVotes(int $user_id, int $limit, int $offset) : array | string
examples Show votes User id 1 had put to all photos, only first voto $your_api_instance->showUserPhotoVotes(1,1,0); array( "total" => 3, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1/votes", ) ), "resources" => array( array( "score" => 3, "photo" => array( "id" => 2, "number_votes" => 25, "score" => 25, ), "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1/photos/2/votes", ), "photo" => array( "href" => "http://api.chatsfree.net/api/photos/2", ), "participant" => array( "href" => "http://api.chatsfree.net/api/users/1", ) ) ) ) );

Parameters

$user_id

int

The user id to retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all votes one user | Message with error in json format

Show all photos one user

showUserPhotos(int $user_id, int $limit, int $offset) : array | string
examples Show photos of user id, only the first $your_api_instance->showUserPhotos(1,1,0); array ( "total" => 40, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/users/1/photos", ), ), "resources" => array( array( "id" => 1, "participant" => array( "id" => 1, "username" => "alex", ), "publicated_at" => "2013-10-29T12:27:34+0100", "path" => "photo1-path.jpg", "title" => "la foto 1", "number_votes" => 15, "score" => 15, "album" => array( "id" => 1, "title" => "la foto 1", "description" => "default album", ), "_links" => array( "self" => array( "href" => "http://api.chateagratis.net/api/photos/1", ), "creator" => array( "href" => "http://api.chateagratis.net/api/users/1", ), "path" => array( "href" => "http://api.chateagratis.net/api/users/uploads/photo1-path.jpg", "type" => "image/*", ), "album" => array( "href" => "http://api.chateagratis.net/api/users/1/albums/1", ) ) ) );

Parameters

$user_id

int

The user id to retrieve data

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with photos an album | Message with error in json format

Show profile by user ID

showUserProfile(int $user_id) : array | string
examples Create profile one user $your_api_instance->showUserProfile(1); array( "id" => 11, "about" => "about-10", "seeking" => "bisexual", "count_visits" => 0, "publicated_at" => "2013-10-30T16:43:51+0100", );

Parameters

$user_id

int

User to retrieve by ID

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with profile data | Message with error in json format

Show count visits on one profile and who visits of one profile

showUserVisitors(int $user_id, int $limit, int $offset) : array | string
exampless $your_api_instance->showUserVisitors(1); // Sample output array( array( "participant" => array( "id" => 1, "username" => "alex", "email" => "alex@chateagratis.net", ), "participant_voyeur" => array( "id" => 2, "username" => "alex2", "email" => "alex2@chateagratis.net", ), "frequency" => 1, ) );

Parameters

$user_id

int

User to retrieve by ID

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystring

Get all the users

showUsers(int $limit, int $offset, $filters, $order) : array | string
examples Show all users, only first $your_api_instance->showUsers(); array( "total" => 12, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users", ) ), "resources" => array( array( "id" => 1, "username" => "alex", "email" => "alex@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/1", ), "channels" => array( "href" => "http://api.chatsfree.net/api/users/1/channels", ), "channels_fan" => array( "href" => "http://api.chatsfree.net/api/users/1/channelsFan", ), "blocked_users" => array( "href" => "http://api.chatsfree.net/api/users/1/blocked", ) ) ) ) );

Parameters

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

$filters

$order

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all users | Message with error in json format

Show user blocked by ID user

showUsersBlocked(int $user_id, int $limit, int $offset) : array | string
examples Show all users blocked, only first $your_api_instance->showUsersBlocked(1); array( "total" => 2, "limit" => 1, "offset" => 0, "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users", ) ), "resources" => array( array( "id" => 2, "username" => "alex2", "email" => "alex2@chateagratis.net", "_links" => array( "self" => array( "href" => "http://api.chatsfree.net/api/users/2", ), "channels" => array( "href" => "http://api.chatsfree.net/api/users/2/channels", ), "channels_fan" => array( "href" => "http://api.chatsfree.net/api/users/2/channelsFan", ), "blocked_users" => array( "href" => "http://api.chatsfree.net/api/users/2/blocked", ) ) ) ) );

Parameters

$user_id

int

User to retrieve by ID

$limit

int

number of items to retrieve at most

$offset

int

The distance (displacement) from the start of a data

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with all users blocked | Message with error in json format

Update a channel

updateChannel(int $channel_id, string $name, string $title, string $description, string $channel_type) : array | string
exampless $your_api_instance->updateChannel(96, 'update channel name','API - Channel title', 'This is channel about loves, friends and others', 'love');

Sample Ouput

array( "id" =>96 "name" =>"update channel name", "slug" =>"update-channel-name", "title" =>"API - Channel title", "description" =>"This is channel about loves, friends and others", "owner" => array( "id" =>1 "username" =>"alex" ), "channel_type" => array( "name" =>"love" ), "_links" => array( "self" => array( "href" =>"https://api.chatsfree.net/api/channels/96" ), "fans" => array( "href" =>"https://api.chatsfree.net/api/channels/96/fans" ), "owner" => array( "href" =>"https://api.chatsfree.net/api/users/1" ) ) );

Parameters

$channel_id

int

Channel to update by ID

$name

string

The new name of channel, if you would like update this field.

$title

string

The new title of channel, if you would like update this field.

$description

string

The new description, of channel if you would like update this field.

$channel_type

string

The type, of channel if you would like update this field.

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with updated channel | Message with error in json format

Update a profile of me user

updateMe(string $username, string $email, string $current_password) : array | string
examples $your_api_instance->updateMe('xabier','xabier@antweb.es','mySecretPassword'); array( 'id' => '1', 'username' => 'xabier', 'email' => 'xabier@antweb.es', );

Parameters

$username

string

your user name | the new username

$email

string

your email | the new user email

$current_password

string

your password. This method can not change your password for this use @link #changePassword

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with you profile updated | Message with error in json format

Update user profile

updateUserProfile(int $user_id, string $about, string $seeking) : array | string
examples Update profile an user $your_api_instance->updateUserProfile(1,'about-103156','homosexual')); array( "id" => 11, "about" => "about-10", "seeking" => "homosexual", "count_visits" => 0, "publicated_at" => "2013-10-30T16:43:51+0100", );

Parameters

$user_id

int

User to retrieve by ID

$about

string

Short description your profile

$seeking

string

Choice between

Exceptions

\InvalidArgumentException This exception is thrown if any parameter has errors
\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringAssociative array with profile data | Message with error in json format

who()

who($limit, $offset) 

Parameters

$limit

$offset

whoami()

whoami() 

Converts a associative array to a string representatation in the form of key1=value1[,keyN=valueN .

associativeArrayToString(array $data) : string
..]
examples Convert associative array to string $this->associativeArrayToString(arrary('key1' => 'value1', 'key2' => 'value2')) //output "key1=value1,key2=value2"

Parameters

$data

array

The associative array to convert to string

Returns

string

Execute the command in server

executeCommand(\Guzzle\Service\Command\CommandInterface $command) : array | string

Parameters

Exceptions

\Ant\ChateaClient\Client\ApiException This exception is thrown if server send one error

Returns

arraystringreturn a collection of data or a message. | Message with error in json format

 Properties

 

Http Client

$client : \Ant\ChateaClient\Service\Client\Client