Comprehensive Buddy Management to maintain list of Buddies, i.e., custom buddy list, Facebook friends, groups, location based, etc. Provides methods to send invite, accept, reject, block, unfriend and reject buddies.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.buddy.Buddy; import com.shephertz.app42.paas.sdk.android.buddy.BuddyService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.buddy;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.buddy.Buddy; import com.shephertz.app42.paas.sdk.java.buddy.BuddyService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.buddy;<script type="text/javascript" src="App42-all-x.x.x.min.js">local App42API = require("App42-Lua-API.App42API") local point = require("App42-Lua-API.Point")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.buddy;include_once '../BuddyService.php'; include_once '../GameService.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../App42Log.php'; include_once '../GeoPoint.php';#include "App42API.h"Not Availableimport com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.buddy.Buddy; import com.shephertz.app42.paas.sdk.as3.buddy.BuddyService;Not Availableimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.buddy.Buddy; import com.shephertz.app42.paas.sdk.jme.buddy.BuddyService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of buddyService, buildBuddyService() method needs to be called.
BuddyService buddyService = App42API.buildBuddyService();BuddyService buddyService = App42API.BuildBuddyService();BuddyService *buddyService = [App42API buildBuddyService];let buddyService = App42API.buildBuddyService() as? BuddyServiceBuddyService buddyService = App42API.buildBuddyService();BuddyService buddyService = App42API.BuildBuddyService();var buddyService = new App42Buddy();local buddyService = App42API:buildBuddyService()BuddyService *buddyService = App42API::BuildBuddyService();BuddyService buddyService = App42API.BuildBuddyService();$buddyService = App42API::buildBuddyService();BuddyService *buddyService = App42API::BuildBuddyService();Not Availablevar buddyService:BuddyService = App42API.buildBuddyService();Not AvailableBuddyService buddyService = App42API.buildBuddyService();
This allows you to send friend request to the buddy user.
Required Parameters
userName - Name of the user who wants to send the request to the buddy.
buddyName - Name of buddy to whom you are sending the request.
message - Describe the message which you want to send to the user.
String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.sendFriendRequest(userName, buddyName, message, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendFriendRequest(userName, buddyName, message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("message is : " + buddy.GetMessage()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); } }NSString *userName = @"User Name"; NSString *buddyName = @"Buddy Name"; NSString *message = @"Welcome to Shephertz"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService sendFriendRequestFromUser:userName toBuddy:buddyName withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@", buddy.userName); NSLog(@"buddyName is : %@", buddy.buddyName); NSLog(@"message is : %@", buddy.message); NSLog(@"sendedOn is : %@", buddy.sendedOn); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let buddyName = "John" let message = "Welcome to Shephertz" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.sendFriendRequestFromUser(userName, toBuddy:buddyName, withMessage:message, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@", buddy.userName) NSLog("buddyName is : %@", buddy.buddyName) NSLog("message is : %@", buddy.message) NSLog("sendedOn is : %@", buddy.sendedOn) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.sendFriendRequest(userName, buddyName, message); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn());String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendFriendRequest(userName, buddyName, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); App42Log.Console("message is : " + buddy.GetMessage()); App42Log.Console("sendedOn is : " + buddy.GetSendedOn()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", message = "Welcome to Shephertz", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.sendFriendRequest(userName, buddyName, message,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("message is : " + result.message) console.log("sendedOn is : " + result.sendedOn) }, error: function(error) { } });local userName = "Nick" local buddyName = "John" local message = "Welcome to Shephertz"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:sendFriendRequest(userName, buddyName, message,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()) print("buddyName is : "..object:getBuddyName()) print("message is : "..object:getMessage()) print("sendedOn is : "..object:getSendedOn()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Welcome to Shephertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendFriendRequest(userName, buddyName, message, app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.SendFriendRequest(userName, buddyName, message); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("message is : " + buddy.GetMessage()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn());$userName = "Nick"; $buddyName = "John"; $message = "Welcome to Shephertz"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->sendFriendRequest($userName, $buddyName,$message); print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("Message is " . $buddy->getMessage()); print_r("Sended On is " . $buddy->getSendedOn()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Welcome to Shephertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendFriendRequest(userName, buddyName, message, this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; var message :String= "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.sendFriendRequest(userName, buddyName, message, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("message is : " + buddy.getMessage()); trace("sendedOn is : " + buddy.getSendedOn()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.sendFriendRequest(userName, buddyName, message); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn());
Fetch all the friend requests for the user.
Required Parameters
userName - Name of the user for which request has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getFriendRequest(userName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("sendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetFriendRequest(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("sendedOn is : " + buddy[i].GetSendedOn()); } } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getFriendRequest:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@", buddy.userName); NSLog(@"buddyName is : %@", buddy.buddyName); NSLog(@"message is : %@", buddy.message); NSLog(@"sendedOn is : %@", buddy.sendedOn); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "John" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.getFriendRequest(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("message is : %@", buddy.message); NSLog("sendedOn is : %@", buddy.sendedOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) }String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getFriendRequest(userName); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("sendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetFriendRequest(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("buddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("sendedOn is : " + buddy[i].GetSendedOn()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getFriendRequest(userName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("buddyName is : " + result[i].buddyName) console.log("message is : " + result[i].message) console.log("sendedOn is : " + result[i].sendedOn) } } else { console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("message is : " + result.message) console.log("sendedOn is : " + result.sendedOn) } }, error: function(error) { } });local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getFriendRequest(userName, App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("User name is:"..object[i]:getUserName()) print("Buddy name is:"..object[i]:getBuddyName()) print("message is : "..object[i]:getMessage()) print("sendedOn is : "..object[i]:getSendedOn()) end else print("userName is : " ..object:getUserName()); print("buddyName is : "..object:getBuddyName()); print("message is : "..object:getMessage()); print("sendedOn is : "..object:getSendedOn()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetFriendRequest( userName, app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetFriendRequest(userName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("sendedOn is : " + buddy[i].GetSendedOn()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse= $buddyService->getFriendRequest($userName); foreach($buddyResponse as $buddy) { print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("Messageis : " . $buddy->getMessage()); print_r("Sended On is " . $buddy->getSendedOn()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetFriendRequest( userName, this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getFriendRequest(userName, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("message is : " + buddy.getMessage()); trace("sendedOn is : " + buddy.getSendedOn()); } } }Not AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getFriendRequest(userName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn()); }
Accept the friend request of buddy.
Required Parameters
userName - Name of the user who is going to accept the request.
buddyName - Name of the buddy whose request has to be accepted.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.acceptFriendRequest(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.AcceptFriendRequest(userName, buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService acceptFriendRequestFromBuddy:userName toUser:buddyName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@", buddy.userName); NSLog(@"buddyName is : %@", buddy.buddyName); NSLog(@"sendedOn is : %@", buddy.sendedOn); NSLog(@"acceptedOn is : %@", buddy.acceptedOn); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let buddyName = "John" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.acceptFriendRequestFromBuddy(userName, toUser:buddyName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("sendedOn is : %@", buddy.sendedOn); NSLog("acceptedOn is : %@", buddy.acceptedOn); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.acceptFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.AcceptFriendRequest(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); App42Log.Console("sendedOn is : " + buddy.GetSendedOn()); App42Log.Console("acceptedOn is : " + buddy.GetAcceptedOn()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.acceptFriendRequest(userName, buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("sendedOn is : " + result.sendedOn); console.log("acceptedOn is : " + result.acceptedOn); }, error: function(error) { } });local userName = "John" local buddyName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:acceptFriendRequest(userName, buddyName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()) print("buddyName is : "..object:getBuddyName()) print("sendedOn is : " ..object:getSendedOn()) print("acceptedOn is : " ..object:getAcceptedOn()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName ="Nick" ; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->AcceptFriendRequest(userName.c_str(), buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.AcceptFriendRequest(userName, buddyName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn());$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy= $buddyService->acceptFriendRequest($userName, $buddyName); print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("Accepted on : " . $buddy->getAcceptedOn()); print_r("Sended On is " . $buddy->getSendedOn()); $jsonResponse = $buddy->toString();const char* userName ="Nick" ; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->AcceptFriendRequest(userName.c_str(), buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.acceptFriendRequest(userName,buddyName new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("sendedOn is : " + buddy.getSendedOn()); trace("acceptedOn is : " + buddy.getAcceptedOn()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.acceptFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());
Reject the friend request of the buddy.
Required Parameters
userName - Name of the user who is going to reject the request.
buddyName - Name of the buddy whose request has to be rejected.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.rejectFriendRequest(userName, buddyName,new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.RejectFriendRequest(userName, buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService rejectFriendRequestFromBuddy:userName toUser:buddyName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@", buddy.userName); NSLog(@"buddyName is : %@", buddy.buddyName); NSLog(@"message is : %@", buddy.message); NSLog(@"sendedOn is : %@", buddy.sendedOn); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let buddyName = "John" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.rejectFriendRequestFromBuddy(userName, toUser:buddyName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("message is : %@", buddy.message); NSLog("sendedOn is : %@", buddy.sendedOn); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.rejectFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.RejectFriendRequest(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); App42Log.Console("sendedOn is : " + buddy.GetSendedOn()); App42Log.Console("acceptedOn is : " + buddy.GetAcceptedOn()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.rejectFriendRequest(userName, buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("sendedOn is : " + result.sendedOn); console.log("acceptedOn is : " + result.acceptedOn); }, error: function(error) { } });local userName = "John" local buddyName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:rejectFriendRequest(userName, buddyName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()) print("buddyName is : "..object:getBuddyName()) print("sendedOn is : " ..object:getSendedOn()) print("acceptedOn is : " ..object:getAcceptedOn()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->RejectFriendRequest(userName, buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.RejectFriendRequest(userName, buddyName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn());$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy= $buddyService->rejectFriendRequest($userName,$buddyName); print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("Sended On is " . $buddy->getSendedOn()); print_r("Rejected On is : " . $buddy->getAcceptedOn()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->RejectFriendRequest(userName, buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.rejectFriendRequest(userName,buddyName new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("sendedOn is : " + buddy.getSendedOn()); trace("acceptedOn is : " + buddy.getAcceptedOn()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.rejectFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());
Fetch all the friends of the user.
Required Parameters
userName - Name of the user who wants to fetch the friends.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllFriends(userName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("acceptedOn is : " + buddy.get(i).getAcceptedOn()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("sendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllFriends(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("sendedOn is : " + buddy[i].GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy[i].GetAcceptedOn()); } } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllFriends:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is :%@", buddy.userName); NSLog(@"buddyName is : %@", buddy.buddyName); NSLog(@"message is : %@", buddy.message); NSLog(@"sendedOn is : %@", buddy.sendedOn); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getAllFriends(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("message is : %@", buddy.message); NSLog("sendedOn is : %@", buddy.sendedOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllFriends(userName); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("sendedOn is : " + buddy.get(i).getSendedOn()); System.out.println("acceptedOn is : " + buddy.get(i).getAcceptedOn()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllFriends(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("buddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("sendedOn is : " + buddy[i].GetSendedOn()); App42Log.Console("acceptedOn is : " + buddy[i].GetAcceptedOn()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllFriends(userName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("buddyName is : " + result[i].buddyName) console.log("message is : " + result[i].message) console.log("sendedOn is : " + result[i].sendedOn) console.log("acceptedOn is : " + result[i].acceptedOn); } } else { console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("message is : " + result.message) console.log("sendedOn is : " + result.sendedOn) console.log("acceptedOn is : " + result.acceptedOn); } }, error: function(error) { } });local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllFriends(userName, App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("User name is:"..object[i]:getUserName()) print("Buddy name is:"..object[i]:getBuddyName()) print("message is : "..object[i]:getMessage()); print("sendedOn is : "..object[i]:getSendedOn()); print("acceptedOn is : " ..object[i]:getAcceptedOn()); end else print("userName is : " ..object:getUserName()); print("buddyName is : "..object:getBuddyName()); print("message is : "..object:getMessage()); print("sendedOn is : "..object:getSendedOn()); print("acceptedOn is : " ..object:getAcceptedOn()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllFriends(userName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllFriends(userName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("sendedOn is : " + buddy[i].GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy[i].acceptedOn); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse =$buddyService->getAllFriends($userName); foreach($buddyResponse as $buddy) { print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("Messageis : " . $buddy->getMessage()); print_r("Sended On is " . $buddy->getSendedOn()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllFriends(userName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n SentOn=%s\n",it->sentOn.c_str()); printf("\n AcceptedOn=%s\n",it->acceptedOn.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllFriends(userName, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("message is : " + buddy.getMessage()); trace("sendedOn is : " + buddy.getSendedOn()); trace("acceptedOn is : " + buddy.getAcceptedOn()); } } }Not AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllFriends(userName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn()); }
Create a group for the user to add the friends in group. User can create multiple group like college friends, school friends etc.
Required Parameters
userName - Name of the user who want to create the group.
groupName - Name of the group which is to be created.
String userName = "Nick"; String groupName = "groupName"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.createGroupByUser(userName, groupName, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy)response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("groupName is : " + buddy.getGroupName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.CreateGroupByUser(userName, groupName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("groupName is : " + buddy.GetGroupName()); } }NSString *userName = @"Nick"; NSString *groupName = @"Group Name"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService createGroup:groupName byUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@", buddy.userName); NSLog(@"groupName is : %@", buddy.groupName); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let groupName = "Group Name" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.createGroup(groupName, byUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.groupName); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.createGroupByUser(userName, groupName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("groupName is : " + buddy.getGroupName());String userName = "Nick"; String groupName = "groupName"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.CreateGroupByUser(userName, groupName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("groupName is : " + buddy.GetGroupName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", groupName = "groupName", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.createGroupByUser(userName, groupName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("groupName is : " + result.groupName) }, error: function(error) { } });local userName = "Nick" local groupName = "groupName" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:createGroupByUser(userName,groupName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()); print("groupName is : " ..object:getGroupName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* groupName = "GroupName"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->CreateGroupByUser(userName,groupName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.CreateGroupByUser(userName, groupName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("groupName is : " + buddy.GetGroupName());$userName = "Nick"; $groupName = "groupName"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->createGroupByUser($userName, $groupName); print_r("UserName is " .$buddy->getUserName()); print_r("GroupName is " .$buddy->getGroupName()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* groupName = "GroupName"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->CreateGroupByUser(userName,groupName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.createGroupByUser(userName, groupName,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("groupName is : " + buddy.getGroupName()); } }Not AvailableString userName = "Nick"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.createGroupByUser(userName, groupName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("groupName is : " + buddy.getGroupName());
Add friends into a group which is created by owner user.
Required Parameters
userName - Name of the user who wants to add friend in the group.
groupName - Name of the group in which friend has to be added.
friendList - List of friends which have to be added in group.
String userName = "Nick"; String groupName = "groupName"; ArrayList<String> friendList = new ArrayList<String>(); friendList.add("Name of the friend"); friendList.add("Name of the friend"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.addFriendToGroup(userName, groupName, friendList, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String groupName = "groupName"; IList<String> friendList = new List<String>(); friendList.Add("Name of the friend"); friendList.Add("Name of the friend"); App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.AddFriendToGroup(userName,groupName,friendList,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); } } }NSString *userName = @"Nick"; NSString *groupName = @"Group Name"; NSArray *friendsArray = [[NSArray alloc]initWithObjects:@"Name of the buddy", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService addFriends:friendsArray ofUser:userName toGroup:groupName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@", buddy.userName); NSLog(@"groupName is : %@", buddy.groupName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let groupName = "groupName" let friendsArray:NSMutableArray = NSMutableArray(); friendsArray.addObject("John") friendsArray.addObject("Monk") App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.addFriends(friendsArray, ofUser:userName, toGroup:groupName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.groupName); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String groupName = "groupName"; ArrayList<String> friendList = new ArrayList<String>(); friendList.add("Name of the friend"); friendList.add("Name of the friend"); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.addFriendToGroup(userName,groupName,friendList); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); }String userName = "Nick"; String groupName = "groupName"; IList<String> friendList = new List<String>(); friendList.Add("Name of the friend"); friendList.Add("Name of the friend"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.AddFriendToGroup(userName,groupName,friendList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { App42Log.Console("UserName is : " + buddy[i].GetUserName()); App42Log.Console("BuddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("GroupName is : " + buddy[i].GetGroupName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick", groupName = "groupName"; var friendList = new Array(); friendList.push("Name of the friend") friendList.push("Name of the friend") App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.addFriendToGroup(userName,groupName,friendList,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("buddyName is : " + result[i].buddyName) console.log("groupName is : " + result[i].groupName) } } else { console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("groupName is : " + result.groupName) } }, error: function(error) { } });local userName = "Nick" local groupName = "groupName" local friendsList={} friendsList[1]="Name of the friend"; friendsList[2]="Name of the friend"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:addFriendToGroup(userName,groupName,friendsList,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("userName is : "..object[i]:getUserName()); print("buddyName is : "..object[i]:getBuddyName()); print("groupName is : " ..object[i]:getGroupName()); end else print("get str response"..object:getStrResponse()) print("userName is : "..object:getUserName()); print("buddyName is : "..object:getBuddyName()); print("groupName is : " ..object:getGroupName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* groupName = "GroupName"; vector<string> friends; friends.push_back("Name of the friend"); friends.push_back("Name of the friend"); App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->AddFriendsToGroup(userName,groupName, friends,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<String> friendList = new List<String>(); friendList.Add("Name of the friend"); friendList.Add("Name of the friend"); IList<Buddy> buddy = buddyService.AddFriendToGroup(userName,groupName,friendList); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); }$userName = "Nick"; $groupName = "groupName"; $friendList = array(); array_push($friendList, "Name of the friend"); array_push($friendList, "Name of the friend"); App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->addFriendToGroup($userName, $groupName, $friendList); foreach($buddyResponse as $buddy) { print_r("Username is " . $buddy->getUserName()); print_r("BuddyName is " . $buddy->getBuddyName()); print_r("GroupName : " . $buddy->getGroupName()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; const char* groupName = "GroupName"; vector<string> friends; friends.push_back("Name of the friend"); friends.push_back("Name of the friend"); App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->AddFriendsToGroup(userName,groupName, friends,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var groupName = "groupName"; var friendList:Array = new Array(); friendList.push("Name of the friend"); friendList.push("Name of the friend"); App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.addFriendToGroup(userName, groupName,friendList,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("groupName is : " + buddy.getGroupName()); } } }Not AvailableString userName = "Nick"; String groupName = "groupName"; Vector friendList = new Vector(); friendList.addElement("Name of the friend"); friendList.addElement("Name of the friend"); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.addFriendToGroup(userName,groupName,friendList); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("groupName is : " + buddy.getGroupName()); }
You can tag your current geo location.
Required Parameters
userName - Name of the user who wants to checkedIn the geo location.
geoPoint - Geo points of user which is to checkedIn.
String userName = "Nick" ; GeoPoint geoPoint = new GeoPoint(); geoPoint.setMarker("Maplewood"); geoPoint.setLat(new BigDecimal(-74.2713)); geoPoint.setLng(new BigDecimal(40.73137)); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.checkedInGeoLocation(userName, geoPoint, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); ArrayList<Buddy.Point> pointList = buddy.getPointList(); for(int i=0;i<pointList.size();i++) { System.out.println("latitude is : " + pointList.get(i).getLatitude()); System.out.println("longitude is : " + pointList.get(i).getLongitude()); System.out.println("markerName is : " + pointList.get(i).getMarkerName()); System.out.println("createdOn is : " + pointList.get(i).getCreatedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; GeoPoint geoPoint = new GeoPoint(); geoPoint.SetMarker("Maplewood"); geoPoint.SetLat(-73.89171); geoPoint.SetLng(40.638868); App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddy.CheckedInGeoLocation(userName, geoPoint, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); IList<Buddy.Point> pointList = buddy.GetPointList(); for(int i=0;i<pointList.Count;i++) { Console.WriteLine("latitude is : " + pointList[i].GetLatitude()); Console.WriteLine("longitude is : " + pointList[i].GetLongitude()); Console.WriteLine("markerName is : " + pointList[i].GetMarkerName()); Console.WriteLine("createdOn is : " + pointList[i].GetCreatedOn()); } } }NSString *userName = @"Nick"; GeoPoint *geoPoint = [[GeoPoint alloc] init]; geoPoint.latitude = -74.2713; geoPoint.longitude = 40.73137; geoPoint.marker = @"Maplewood"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService checkedInWithUser:userName geoLocation:geoPoint completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@", buddy.userName); for(BuddyPoint *point in buddy.pointList){ NSLog(@"latitude is : %f", point.latitude); NSLog(@"longitude is : %f", point.longitude); NSLog(@"markerName is : %@", point.markerName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let geoPoint:GeoPoint = GeoPoint() geoPoint.latitude = 12.0 geoPoint.longitude = 41.0 geoPoint.marker="Maplewood" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.checkedInWithUser(userName, geoLocation: geoPoint, completionBlock: { (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@", buddy.userName); for point in buddy.pointList { NSLog("latitude is : %f", point.latitude); NSLog("longitude is : %f", point.longitude); NSLog("markerName is : %@", point.markerName); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick" ; GeoPoint geoPoint = new GeoPoint(); geoPoint.setMarker("Maplewood"); geoPoint.setLat(new BigDecimal(-74.2713)); geoPoint.setLng(new BigDecimal(40.73137)); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.checkedInGeoLocation(userName, geoPoint); System.out.println("UserName is : " + buddy.getUserName()); ArrayList<Buddy.Point> pointList = buddy.getPointList(); for(int i=0;i<pointList.size();i++) { System.out.println("latitude is : " + pointList.get(i).getLatitude()); System.out.println("longitude is : " + pointList.get(i).getLongitude()); System.out.println("markerName is : " + pointList.get(i).getMarkerName()); System.out.println("createdOn is : " + pointList.get(i).getCreatedOn()); }String userName = "Nick" ; GeoPoint geoPoint = new GeoPoint(); geoPoint.SetMarker("Maplewood"); geoPoint.SetLat(-74.2713); geoPoint.SetLng(40.73137); App42Log.SetDebug(true); //Print output in Your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.CheckedInGeoLocation(userName, geoPoint, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); IList<Buddy.Point> pointList = buddy.GetPointList(); for(int i=0; i<pointList.Count; i++) { App42Log.Console("latitude is : " + pointList[i].GetLatitude()); App42Log.Console("longitude is : " + pointList[i].GetLongitude()); App42Log.Console("markerName is : " + pointList[i].GetMarkerName()); App42Log.Console("createdOn is : " + pointList[i].GetCreatedOn()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result ; var geoPoint={ lat:-74.2713, lng:40.73137, marker: "Maplewood" }; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.checkedInGeoLocation(userName,geoPoint,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName); var pointList = result.points.point; console.log("latitude is : " + pointList.latitude); console.log("longitude is : " + pointList.longitude); console.log("markerName is : " + pointList.markerName); console.log("createdOn is : " + pointList.createdOn); }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} local geoPoint = require("App42-Lua-API.Point") geoPoint:setLatitude(-74.2713) geoPoint:setLongitude(40.73137) geoPoint:setMarkerName("Maplewood") App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:checkedInGeoLocation(buddyName,geoPoint,App42CallBack) function App42CallBack:onSuccess(object) print("Name is:"..object:getUserName()); print("latitude is :"..object:getPointList():getLatitude()); print("markerName is : "..object:getPointList():getMarkerName()); print("longitude is :"..object:getPointList():getLongitude()); print("createdOn is : "..object:getPointList():getCreatedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42GeoPoint *geoPoint = new App42GeoPoint(); geoPoint->latitude = -74.2713; geoPoint->longitude = 40.73137; geoPoint->markerName = "Maplewood"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->CheckedInGeoLocation(userName, geoPoint, app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42GeoPoint>::iterator iit = it->pointList.begin(); iit != it->pointList.end(); ++iit) { printf("\n Latitude=%lf",iit->latitude); printf("\n Longitude=%lf\n",iit->longitude); printf("\n MarkerName=%s\n",iit->markerName.c_str()); printf("\n CreatedOn=%s\n",iit->createdOn.c_str()); } } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick" ; GeoPoint geoPoint = new GeoPoint(); geoPoint.SetMarker("Maplewood"); geoPoint.SetLat(-74.2713); geoPoint.SetLng(40.73137); App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.CheckedInGeoLocation(userName, geoPoint); Console.WriteLine("userName is : " + buddy.GetUserName()); IList<Buddy.Point> pointList = buddy.GetPointList(); for(int i=0;i<pointList.Count;i++) { Console.WriteLine("latitude is : " + pointList[i].GetLatitude()); Console.WriteLine("longitude is : " + pointList[i].GetLongitude()); Console.WriteLine("markerName is : " + pointList[i].GetMarkerName()); Console.WriteLine("createdOn is : " + pointList[i].GetCreatedOn()); }$userName = "Nick" ; $geoPoint = new GeoPoint(); $geoPoint->setLat(-74.2713); $geoPoint->setLng(40.73137); $geoPoint->setMarker("Maplewood"); App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy= $buddyService->checkedInGeoLocation($userName, $geoPoint); print_r("userName is : " . $buddy->getUserName()); $points =$buddy->getPointList(); foreach($points as $pointList) { print_r("latitude is : " .$pointList->getLatitude()); print_r("longitude is : ".$pointList->getLongitude()); print_r("markerName is : " .$pointList->getMarkerName()); print_r("createdOn is : " .$pointList->getCreatedOn()); } $jsonResponse = $buddy->toString();const char* userName = "Nick"; App42GeoPoint *geoPoint = new App42GeoPoint(); geoPoint->latitude = -74.2713; geoPoint->longitude = 40.73137; geoPoint->markerName = "Maplewood"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->CheckedInGeoLocation(userName, geoPoint, this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42GeoPoint>::iterator iit = it->pointList.begin(); iit != it->pointList.end(); ++iit) { printf("\n Latitude=%lf",iit->latitude); printf("\n Longitude=%lf\n",iit->longitude); printf("\n MarkerName=%s\n",iit->markerName.c_str()); printf("\n CreatedOn=%s\n",iit->createdOn.c_str()); } } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick" ; var geoPoint:GeoPoint = new GeoPoint(); geoPoint.setMarker("Maplewood"); geoPoint.setLat(-74.2713); geoPoint.setLng(40.73137); App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.checkedInGeoLocation(userName, geoPoint,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("UserName is" + buddy.getUserName()); if(buddy.getPointList() !=null) { for(var i:int=0;i<buddy.getPointList().length;i++) { trace("getCreatedOn : " + Point(buddy.getPointList()[i]).getCreatedOn()); trace("getMarkerName : " + Point(buddy.getPointList()[i]).getMarkerName()); trace( "getLatitude : " +Point(buddy.getPointList()[i]).getLatitude()); trace( "getLongitude : " +Point(buddy.getPointList()[i]).getLongitude()); } } } }Not AvailableString userName = "userName" ; GeoPoint geoPoint = new GeoPoint(); geoPoint.setMarker("Maplewood"); geoPoint.setLat(new Double(-74.2713)); geoPoint.setLng(new Double(40.73137)); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.checkedInGeoLocation(userName, geoPoint); System.out.println("userName is : " + buddy.getUserName()); Vector pointList = buddy.getPointList(); for(int i=0;i < pointList.size();i++) { Buddy.Point point = (Buddy.Point)pointList.elementAt(i); System.out.println("latitude is : " + point.getLatitude()); System.out.println("longitude is : " + point.getLongitude()); System.out.println("markerName is : " + point.getMarkerName()); System.out.println("createdOn is : " + point.getCreatedOn()); }
To find user’s friends using a query on geo location.
Required Parameters
userName - Name of the user who is finding friend(s).
latitude - Latitude from which friends have to be searched.
longitude - Longitude from which friends have to be searched.
maxDistance - Distance(KM) in which you have to find friends.
max - Max Number of friends you want to search.
String userName = "userName" ; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal maxDistance = new BigDecimal(40.738868); int max = 5; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getFriendsByLocation(userName, lat, lng, maxDistance, max, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); ArrayList<Buddy.Point> pointList = buddy.get(i).getPointList(); for(int j=0;j<pointList.size();j++) { System.out.println("buddyName is : " + pointList.get(j).getBuddyName()); System.out.println("markerName is : " + pointList.get(j).getMarkerName()); System.out.println("latitude is : " + pointList.get(j).getLatitude()); System.out.println("longtitude is : " + pointList.get(j).getLongitude()); System.out.println("createdOn is : " + pointList.get(j).getCreatedOn()); } } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; double lat = -73.99171; double lng = 40.738868; double maxDistance = 1; int max = 1; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetFriendsByLocation(userName, lat,lng, maxDistance,max, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.size();i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); IList<Buddy.Point> pointList = buddy[i].GetPointList(); for(int j=0;j<pointList.Count;j++) { Console.WriteLine("buddyName is : " + pointList[j].GetBuddyName()); Console.WriteLine("markerName is : " + pointList[j].GetMarkerName()); Console.WriteLine("latitude is : " + pointList[j].GetLatitude()); Console.WriteLine("longtitude is : " + pointList[j].GetLongitude()); Console.WriteLine("createdOn is : " + pointList[j].GetCreatedOn()); } } } }NSString *userName = @"User Name"; double latitude = 55.00; double longitude = 73.00; double radius = 100; int max = 10; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getFriendsOfUser:userName withLatitude:latitude andLongitude:longitude inRadius:radius max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for (Buddy *buddy in buddyArray) { NSLog(@"User Name = %@",buddy.userName); for (BuddyPoint *buddyPoint in buddy.pointList) { NSLog(@"BuddyName=%@",buddyPoint.buddyName); NSLog(@"MarkerName=%@",buddyPoint.markerName); NSLog(@"Latitude=%lf",buddyPoint.latitude); NSLog(@"Longitude=%lf",buddyPoint.longitude); NSLog(@"CreatedOn=%@",buddyPoint.createdOn); } } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let buddyName ="John" let latitude = 55.00 let longitude = 73.00 let radius = 100 let max=10 App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getFriendsOfUser(userName, withLatitude:latitude, andLongitude:longitude, inRadius:radius, max:max, completionBlock:{ (success, response, exception) -> Void in { if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); for buddyPoint in pointList { NSLog("BuddyName=%@",buddyPoint.buddyName); NSLog("MarkerName=%@",buddyPoint.markerName); NSLog("Latitude=%lf",buddyPoint.latitude); NSLog("Longitude=%lf",buddyPoint.longitude); NSLog("CreatedOn=%@",buddyPoint.createdOn); } } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "userName" ; BigDecimal lat = new BigDecimal(-73.99171); BigDecimal lng = new BigDecimal(40.738868); BigDecimal maxDistance = new BigDecimal(40.738868); int max = 1; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getFriendsByLocation(userName, lat, lng, maxDistance,max); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); ArrayList<Buddy.Point> pointList = buddy.get(i).getPointList(); for(int j=0;j<pointList.size();j++) { System.out.println("buddyName is : " + pointList.get(j).getBuddyName()); System.out.println("markerName is : " + pointList.get(j).getMarkerName()); System.out.println("latitude is : " + pointList.get(j).getLatitude()); System.out.println("longtitude is : " + pointList.get(j).getLongitude()); System.out.println("createdOn is : " + pointList.get(j).getCreatedOn()); } }String userName = "Nick"; double lat = -73.99171; double lng = 40.738868; double maxDistance = 1; int max = 1; App42Log.SetDebug(true); //Print output in Your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetFriendsByLocation(userName, lat, lng, maxDistance, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0; i < buddy.Count; i++) { App42Log.Console("userName is : " + buddy[i].GetUserName()); IList<Buddy.Point> pointList = buddy[i].GetPointList(); for(int j=0; j<pointList.Count; j++) { App42Log.Console("buddyName is : " + pointList[j].GetBuddyName()); App42Log.Console("markerName is : " + pointList[j].GetMarkerName()); App42Log.Console("latitude is : " + pointList[j].GetLatitude()); App42Log.Console("longtitude is : " + pointList[j].GetLongitude()); App42Log.Console("createdOn is : " + pointList[j].GetCreatedOn()); } } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName ="John", lat = -73.99171 , lng = 40.738868, maxDistance = 1, max = 1, result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getFriendsByLocation(userName,-73.99171,40.738868,2,2,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("result is : "+ result); var pointList = result.points.point; if (pointList instanceof Array) { for(var i = 0;i<pointList.length;i++) { console.log("buddyName is : " + pointList[i].buddyName); console.log("latitude is : " + pointList[i].latitude); console.log("longtitude is : " + pointList[i].longitude); console.log("markerName is : " + pointList[i].markerName); console.log("createdOn is : " + pointList[i].createdOn); } } else { console.log("buddyName is : " + pointList.buddyName); console.log("latitude is : " + pointList.latitude); console.log("longtitude is : " + pointList.longitude); console.log("markerName is : " + pointList.markerName); console.log("createdOn is : " + pointList.createdOn); } }, error: function(error) { } });local userName = "Nick"; local lat = -73.99171; local lng = 40.738868; local maxDistance = 1; local max = 1; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getFriendsByLocation(userName,lat,lng,maxDistance,max,App42CallBack) function App42CallBack:onSuccess(object) for i=1,table.getn(object) do print("UserName is:"..object:getUserName()); print("Buddy Name is :"..object[i]:getPointList():getBuddyName()); print("latitude is :"..object[i]:getPointList():getLatitude()); print("markerName is : "..object[i]:getPointList():getMarkerName()); print("longitude is :"..object[i]:getPointList():getLongitude()); print("createdOn is : "..object[i]:getPointList():getCreatedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; double latitude = -73.99171; double longitude = 40.738868; double maxDistance = 1; int max = 1; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetFriendsByLocation(userName, latitude, longitude, maxDistance, max, app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42GeoPoint>::iterator iit = it->pointList.begin(); iit != it->pointList.end(); ++iit) { printf("\n Latitude=%lf",iit->latitude); printf("\n Longitude=%lf\n",iit->longitude); printf("\n MarkerName=%s\n",iit->markerName.c_str()); printf("\n CreatedOn=%s\n",iit->createdOn.c_str()); } } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; double lat = -73.99171; double lng = 40.738868; double maxDistance = 1; int max = 1; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetFriendsByLocation(userName, lat,lng, maxDistance,max); for(int i=0; i < buddy.Count; i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); IList<Buddy.Point> pointList = buddy[i].GetPointList(); for(int j=0;j<pointList.Count;j++) { Console.WriteLine("buddyName is : " + pointList[j].GetBuddyName()); Console.WriteLine("markerName is : " + pointList[j].GetMarkerName()); Console.WriteLine("latitude is : " + pointList[j].GetLatitude()); Console.WriteLine("longtitude is : " + pointList[j].GetLongitude()); Console.WriteLine("createdOn is : " + pointList[j].GetCreatedOn()); } }$userName = "Nick"; $lat = -73.99171; $lng = 40.738868; $maxDistance = 1; $max = 1; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->getFriendsByLocation($userName, $lat, $lng, $maxDistance, $max); foreach ($buddyResponse as $buddy) { print_r("UserName is : ".$buddy->getUserName()); $list=$buddy->getPointList(); foreach($list as $pointList) { print_r("latitude is : " .$pointList->getLatitude()); print_r("longtitude is : ".$pointList->getLongitude()); print_r("markerName is : " .$pointList->getMarkerName()); print_r("createdOn is : " .$pointList->getCreatedOn()); } } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; double latitude = -73.99171; double longitude = 40.738868; double maxDistance = 1; int max = 1; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetFriendsByLocation(userName, latitude, longitude, maxDistance, max, this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); for(std::vector<App42GeoPoint>::iterator iit = it->pointList.begin(); iit != it->pointList.end(); ++iit) { printf("\n Latitude=%lf",iit->latitude); printf("\n Longitude=%lf\n",iit->longitude); printf("\n MarkerName=%s\n",iit->markerName.c_str()); printf("\n CreatedOn=%s\n",iit->createdOn.c_str()); } } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "userName" ; var lat:int = 73; var lng:int=40; var maxDistance:int =40; var max:int = 5; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getFriendsByLocation(userName, lat, lng, maxDistance, max,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { var array:Array = response as Array; for(var i:int = 0;i < array.length;i++){ var buddyObj:Buddy = Buddy(array[i]); trace("UserName is" + buddyObj.getUserName()); if(buddyObj.getPointList() !=null) { for(var j:int=0;j<buddyObj.getPointList().length;j++) { trace("getCreatedOn : " + Point(buddyObj.getPointList()[j]).getCreatedOn()); trace("getMarkerName : " + Point(buddyObj.getPointList()[j]).getMarkerName()); trace("getBuddyName : " + Point(buddyObj.getPointList()[j]).getBuddyName()); trace( "getLatitude : " +Point(buddyObj.getPointList()[j]).getLatitude()); trace( "getLongitude : " +Point(buddyObj.getPointList()[j]).getLongitude()); } } } } } }Not AvailableString userName = "userName" ; Double lat = new Double(-73.99171); Double lng = new Double(40.738868); Double maxDistance = new Double(40.738868); int max = 1; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getFriendsByLocation(userName,lat, lng, maxDistance,max); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); Vector pointList = buddy.getPointList(); for(int j=0;j < pointList.size();j++) { Buddy.Point point = (Buddy.Point)pointList.elementAt(j); System.out.println("buddyName is : " + point.getBuddyName()); System.out.println("markerName is : " + point.getMarkerName()); System.out.println("latitude is : " + point.getLatitude()); System.out.println("longtitude is : " + point.getLongitude()); System.out.println("createdOn is : " + point.getCreatedOn()); } }
Fetch all the groups created by the user.
Required Parameters
userName - Name of the user for whom group has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllGroups(userName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllGroups(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); } } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllGroups:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@", buddy.userName); NSLog(@"groupName is : %@", buddy.groupName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as? BuddyService buddyService?.getAllGroups(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.groupName); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllGroups(userName); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllGroups(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("groupName is : " + buddy[i].GetGroupName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllGroups(userName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("groupName is : " + result[i].groupName) } } else { console.log("userName is : " + result.userName) console.log("groupName is : " + result.groupName) } }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllGroups(userName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("userName is : "..object[i]:getUserName()); print("groupName is : "..object[i]:getGroupName()); end else print("userName is : " ..object:getUserName()); print("groupName is : "..object:getGroupName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllGroups(userName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllGroups(userName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->getAllGroups($userName); foreach($buddy as $groupList) { print_r("UserName is: " .$groupList->getUserName()); print_r("GruopName is " .$groupList->getGroupName()); } $jsonResponse = $buddy[0]->toString();const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllGroups(userName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllGroups(userName,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("groupName is : " + buddy.getGroupName()); } } }Not AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllGroups(userName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("groupName is : " + buddy.getGroupName()); }
Fetch all the friends in a specific group.
Required Parameters
userName - Name of the user who is going to fetch the friends.
ownerName - Name of the user who has created the group.
groupName - Name of the group for which friends have to be fetched.
String userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllFriendsInGroup(userName,ownerName,groupName,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("ownerName is : " + buddy.get(i).getOwnerName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllFriendsInGroup(userName,ownerName,groupName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); } } }NSString *userName = @"Nick"; NSString *groupName = @"Group Name"; NSString *ownerName = @"Owner Name"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllFriendsOfUser:userName inGroup:groupName ofOwner:ownerName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@", buddy.userName); NSLog(@"groupName is : %@", buddy.groupName); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let groupName = "Group Name" let ownerName = "Owner Name" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getAllFriendsOfUser(userName, inGroup:groupName, ofOwner:ownerName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@", buddy.userName); NSLog("buddyName is : %@", buddy.groupName); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllFriendsInGroup(userName,ownerName,groupName); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("ownerName is : " + buddy.get(i).getOwnerName()); System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); }String userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllFriendsInGroup(userName, ownerName, groupName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("ownerName is : " + buddy[i].GetOwnerName()); App42Log.Console("buddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("groupName is : " + buddy[i].GetGroupName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "John", ownerName = "Nick", groupName = "groupName"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllFriendsInGroup(userName,ownerName,groupName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("ownerName is : " + result[i].ownerName) console.log("buddyName is : " + result[i].buddyName) console.log("groupName is : " + result[i].groupName) } } else { console.log("userName is : " + result.userName) console.log("ownerName is : " + result.ownerName) console.log("buddyName is : " + result.buddyName) console.log("groupName is : " + result.groupName) } }, error: function(error) { } });local userName = "John"; local ownerName = "Nick"; local groupName = "groupName"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllFriendsInGroup(userName,ownerName,groupName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 0 then for i=1,table.getn(object) do print("userName is : " ..object[i]:getUserName()); print("ownerName is : " ..object[i]:getOwnerName()); print("buddyName is : " ..object[i]:getBuddyName()); print("groupName is : " ..object[i]:getGroupName()); end else print("userName is : " ..object:getUserName()); print("ownerName is : " ..object:getOwnerName()); print("buddyName is : " ..object:getBuddyName()); print("groupName is : " ..object:getGroupName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "John"; const char* groupName = "Group Name"; const char* ownerName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllFriendsInGroup(userName,ownerName,groupName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n OwnerName=%s",it->ownerName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllFriendsInGroup(userName,ownerName,groupName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); }$userName = "John"; $ownerName = "Nick"; $groupName = "groupName"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->getAllFriendsInGroup($userName,$userName, $groupName); foreach($buddyResponse as $buddy) { print_r("UserName is :".$buddy->getUserName()); print_r("BuddyName : ".$buddy->getBuddyName()); print_r("GroupName is :".$buddy->getGroupName()); print_r("OwnerName is :".$buddy->getOwnerName()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "John"; const char* groupName = "Group Name"; const char* ownerName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllFriendsInGroup(userName,ownerName,groupName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n OwnerName=%s",it->ownerName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "John"; var ownerName:String = "Nick"; var groupName:String = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllFriendsInGroup(userName,ownerName,groupName,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("ownerName is : " + buddy.getOwnerName()); trace("buddyName is : " + buddy.getBuddyName()); trace("groupName is : " + buddy.getGroupName()); } } }Not AvailableString userName = "John"; String ownerName = "Nick"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllFriendsInGroup(userName,ownerName,groupName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("ownerName is : " + buddy.getOwnerName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("groupName is : " + buddy.getGroupName()); }
Block the friend request of the buddy forever.
Required Parameters
userName - Name of the user who is going to block the request.
buddyName - Name of the buddy whose request has to be blocked.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.blockFriendRequest(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.BlockFriendRequest(userName, buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService blockFriendRequestFromBuddy:buddyName toUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@",buddy.userName); NSLog(@"buddyName is : %@",buddy.buddyName); NSLog(@"sendedOn is : %@",buddy.sendedOn); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let buddyName = "John"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.blockFriendRequestFromBuddy(buddyName, toUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@",buddy.userName); NSLog("buddyName is : %@",buddy.buddyName); NSLog("sendedOn is : %@",buddy.sendedOn); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.blockFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.BlockFriendRequest(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); App42Log.Console("sendedOn is : " + buddy.GetSendedOn()); App42Log.Console("acceptedOn is : " + buddy.GetAcceptedOn()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.blockFriendRequest(userName, buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("sendedOn is : " + result.sendedOn); console.log("acceptedOn is : " + result.acceptedOn); }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:blockFriendRequest(userName,buddyName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : " ..object:getUserName()); print("buddyName is : " ..object:getBuddyName()); print("sendedOn is : " ..object:getSendedOn()); print("acceptedOn is : " ..object:getAcceptedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->BlockFriendRequest(buddyName,userName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n OwnerName=%s",it->ownerName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.BlockFriendRequest(userName, buddyName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("sendedOn is : " + buddy.GetSendedOn()); Console.WriteLine("acceptedOn is : " + buddy.GetAcceptedOn());$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->blockFriendRequest($userName, $buddyName); print_r("BuddyName is :".$buddy->getBuddyName()); print_r("Username is : ".$buddy->getUserName()); print_r("sendedOn is :".$buddy->getSendedOn()); print_r("Blocked On : ".$buddy->getAcceptedOn()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->BlockFriendRequest(buddyName,userName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n GroupName=%s",it->groupName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n OwnerName=%s",it->ownerName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.blockFriendRequest(userName,buddyName new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("sendedOn is : " + buddy.getSendedOn()); trace("acceptedOn is : " + buddy.getAcceptedOn()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.blockFriendRequest(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("sendedOn is : " + buddy.getSendedOn()); System.out.println("acceptedOn is : " + buddy.getAcceptedOn());
Block the user, once you block the user, they will never get any request from blocked user.
Required Parameters
userName - Name of the user who is going to block another user.
buddyName - Name of the buddy who has to be blocked.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.blockUser(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.BlockUser(userName, buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService blockBuddy:buddyName byUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@",buddy.userName); NSLog(@"buddyName is : %@",buddy.buddyName); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let buddyName = "John"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService blockBuddy(buddyName, byUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@",buddy.userName); NSLog("buddyName is : %@",buddy.buddyName); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.blockUser(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName());String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.BlockUser(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.blockUser(userName, buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:blockUser(userName,buddyName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()); print("buddyName is : "..object:getBuddyName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->BlockUser(userName,buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.BlockUser(userName, buddyName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName());$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->blockUser($userName, $buddyName); print_r("BuddyName is : ".$buddy->getBuddyName()); print_r("UserName is : ".$buddy->getUserName()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->BlockUser(userName,buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.blockUser(userName,buddyName new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.blockUser(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName());
Unblock the user who another user has blocked.
Required Parameters
userName - Name of the user who is going to unblock the user.
buddyName - Name of the buddy who has to be unblocked.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.unblockUser(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.UnblockUser(userName, buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService unblockBuddy:buddyName byUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@",buddy.userName); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let buddyName = "John"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.unblockBuddy(buddyName, byUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@",buddy.userName); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.unblockUser(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName());String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.UnblockUser(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.unblockUser(userName, buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:unblockUser(userName,buddyName,App42CallBack); function App42CallBack:onSuccess(object) print("userName is : "..object:getUserName()); print("buddyName is : "..object:getBuddyName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->UnblockUser(userName,buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.UnblockUser(userName, buddyName); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("buddyName is : " + buddy.GetBuddyName());$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->unblockUser($userName, $buddyName); print_r("BuddyName is : ".$buddy->getBuddyName()); print_r("UserName is : ". $buddy->getUserName()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->UnblockUser(userName,buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.unblockUser(userName,buddyName new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.unblockUser(userName, buddyName); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName());
Send the message to the group.
Required Parameters
userName - Name of the user who wants to send the message.
ownerName - Name of the user who created the group.
groupName - Name of the group which is created by the owner user.
message - Message for the receiver.
String userName = "Nick" ; String ownerName = "John" ; String groupName = "groupName" ; String message = "Welcome to Shephertz" ; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.sendMessageToGroup(userName,ownerName,groupName,message,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("ownerName is : " + buddy.get(i).getOwnerName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String ownerName = "ownerName"; String groupName = "groupName"; String message = "message"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendMessageToGroup(userName, ownerName, groupName, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); } } }NSString *userName = @"Nick"; NSString *message = @"Welcome to Shephertz"; NSString *groupName = @"Group Name"; NSString *ownerName = @"Owner Name"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService sendMessage:message fromUser:userName toGroup:groupName ofGroupOwner:ownerName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@",buddy.userName); NSLog(@"buddyName is : %@",buddy.buddyName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let message = "Welcome to Shephertz" let groupName = "Group Name" let ownerName = "Owner Name" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService sendMessage(message, fromUser:userName, toGroup:groupName, ofGroupOwner:ownerName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@",buddy.userName) NSLog("buddyName is : %@", buddy.buddyName) NSLog("message is : %@", buddy.message) NSLog("sendedOn is : %@", buddy.messageId) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick" ; String ownerName = "John" ; String groupName = "groupName" ; String message = "Welcome to Shephertz" ; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.sendMessageToGroup(userName, ownerName, groupName, message); for(int i=0;i<buddy.size();i++) { System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("groupName is : " + buddy.get(i).getGroupName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("ownerName is : " + buddy.get(i).getOwnerName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick" ; String ownerName = "John" ; String groupName = "groupName" ; String message = "Welcome to Shephertz" ; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendMessageToGroup(userName, ownerName, groupName, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { App42Log.Console("buddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("groupName is : " + buddy[i].GetGroupName()); App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("ownerName is : " + buddy[i].GetOwnerName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("messageId is : " + buddy[i].GetMessageId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", ownerName ="John", groupName = "groupName", message = "Welcome to Shephertz", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.sendMessageToGroup(userName, ownerName, groupName, message,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if(result.length == undefined) { console.log("buddyName is : " + result.buddyName) console.log("groupName is : " + result.groupName) console.log("userName is : " + result.userName) console.log("ownerName is : " + result.ownerName) console.log("message is : " + result.message) console.log("messageId is : " + result.messageId) } else { for(var i = 0;i<result.length;i++) { console.log("buddyName is : " + result[i].buddyName) console.log("groupName is : " + result[i].groupName) console.log("userName is : " + result[i].userName) console.log("ownerName is : " + result[i].ownerName) console.log("message is : " + result[i].message) console.log("messageId is : " + result[i].messageId) } } }, error: function(error){ } });local userName = "Nick"; local ownerName ="John"; local groupName = "groupName"; local message = "Welcome to Shephertz"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:sendMessageToGroup(userName,ownerName,groupName,message,App42CallBack) function App42CallBack:onSuccess(object) print("buddyName is : " ..object:getBuddyName()); print("groupName is : "..object:getGroupName()); print("userName is : "..object:getUserName()); print("ownerName is : "..object:getOwnerName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick" ; const char* ownerName = "John" ; const char* groupName = "groupName" ; const char* message = "Welcome to Shephertz" ; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToGroup(userName, ownerName, groupName, message,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick" ; String ownerName = "John" ; String groupName = "groupName" ; String message = "Welcome to Shephertz" ; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.SendMessageToGroup(userName, ownerName, groupName, message); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("groupName is : " + buddy[i].GetGroupName()); Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); }$userName = "Nick" ; $ownerName = "John" ; $groupName = "groupName" ; $message = "Welcome to Shephertz" ; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->sendMessageToGroup( $userName, $ownerName, $groupName, $message); foreach($buddyResponse as $buddy) { print_r("UserName is".$buddy->getUserName()); print_r("GroupName is :".$buddy->getGroupName()); print_r("BuddyName is :".$buddy->getBuddyName()); print_r("OwnerName is :".$buddy->getOwnerName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick" ; const char* ownerName = "John" ; const char* groupName = "groupName" ; const char* message = "Welcome to Shephertz" ; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToGroup(userName, ownerName, groupName, message,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "John"; var ownerName:String = "Nick"; var groupName:String = "groupName"; var message:String = "Welcome to Shephertz" ; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.sendMessageToGroup(userName, ownerName, groupName, message,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("buddyName is : " + buddy.getBuddyName()); trace("groupName is : " + buddy.getGroupName()); trace("userName is : " + buddy.getUserName()); trace("ownerName is : " + buddy.getOwnerName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } } }Not AvailableString userName = "userName" ; String ownerName = "John" ; String groupName = "groupName"; String message = "message"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.sendMessageToGroup(userName, ownerName, groupName, message); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("groupName is : " + buddy.getGroupName()); System.out.println("userName is : " + buddy.getUserName()); System.out.println("ownerName is : " + buddy.getOwnerName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); }
Send message to friend.
Required Parameters
userName - Name of the user who wants to send the message.
buddyName - Name of buddy to whom the message has to sent.
message - Message for the receiver.
String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.sendMessageToFriend(userName,buddyName,message, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("userName is : " + buddy.getUserName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); System.out.println("SendedOn is : " + buddy.getSendedOn()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddy.SendMessageToFriend(userName, buddyName, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Buddy buddy = (Buddy) response; Console.WriteLine("buddyName is : " + buddy.GetBuddyName()); Console.WriteLine("userName is : " + buddy.GetUserName()); Console.WriteLine("message is : " + buddy.GetMessage()); Console.WriteLine("messageId is : " + buddy.GetMessageId()); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; NSString *message = @"Welcome to Shephertz"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService sendMessage:message toFriend:buddyName fromUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"userName is : %@",buddy.userName); NSLog(@"buddyName is : %@",buddy.buddyName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let buddyName = "John" let message = "Welcome to Shephertz" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService sendMessage(message, toFriend:buddyName, fromUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! Buddy NSLog("userName is : %@",buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("message is : %@", buddy.message); NSLog("sendedOn is : %@", buddy.messageId); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "userName" ; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.sendMessageToFriend(userName, buddyName, message); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("userName is : " + buddy.getUserName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); System.out.println("SendedOn is : " + buddy.getSendedOn());String userName = "Nick" ; String buddyName = "John"; String message = "Welcome to Shephertz"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendMessageToFriend(userName, buddyName, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy) response; App42Log.Console("buddyName is : " + buddy.GetBuddyName()); App42Log.Console("userName is : " + buddy.GetUserName()); App42Log.Console("message is : " + buddy.GetMessage()); App42Log.Console("messageId is : " + buddy.GetMessageId()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", message = "Welcome to Shephertz", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.sendMessageToFriend(userName,buddyName,message,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; console.log("buddyName is : " + result.buddyName); console.log("userName is : " + result.userName); console.log("message is : " + result.message); console.log("messageId is : " + result.messageId); }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local message = "Welcome to Shephertz"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:sendMessageToFriend(userName,buddyName,message,App42CallBack) function App42CallBack:onSuccess(object) print("buddyName is : " ..object:getBuddyName()); print("userName is : "..object:getUserName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick" ; const char* buddyName = "John" ; const char* message = "Welcome to Shephertz" ; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToFriend(userName,buddyName,message,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick" ; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); Buddy buddy = buddyService.SendMessageToFriend(userName, buddyName, message); Console.WriteLine("buddyName is : " + buddy.getBuddyName()); Console.WriteLine("userName is : " + buddy.getUserName()); Console.WriteLine("message is : " + buddy.getMessage()); Console.WriteLine("messageId is : " + buddy.getMessageId());$userName = "Nick" ; $buddyName = "John"; $message = "Welcome to Shephertz"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->sendMessageToFriend($userName,$buddyName, $message); print_r("UserName is".$buddy->getUserName()); print_r("BuddyName is :".$buddy->getBuddyName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); $jsonResponse = $buddy->toString();const char* userName = "Nick" ; const char* buddyName = "John" ; const char* message = "Welcome to Shephertz" ; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToFriend(userName,buddyName,message,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName:String = "John"; var message :String= "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.sendMessageToFriend(userName, buddyName, message, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("buddyName is : " + buddy.getBuddyName()); trace("userName is : " + buddy.getUserName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } }Not AvailableString userName = "Nick" ; String buddyName = "John"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Buddy buddy = buddyService.sendMessageToFriend(userName, buddyName, message); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("userName is : " + buddy.getUserName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId());
Send Message to Friends.
Required Parameters
userName - Name of the user who wants to send the message to friends.
message - Message for the friends.
String userName = "Nick"; String message = "Welcome to Shephertz"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.sendMessageToFriends(userName, message, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendMessageToFriends(userName,message,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); } } }NSString *userName = @"Nick"; NSString *message = @"Welcome to Shephertz"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService sendMessageToFriends:message fromUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@",buddy.userName); NSLog(@"buddyName is : %@",buddy.buddyName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let message = "Welcome to Shephertz" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.sendMessageToFriends(message, fromUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@",buddy.userName); NSLog("buddyName is : %@", buddy.buddyName); NSLog("message is : %@", buddy.message); NSLog("messageId is : %@", buddy.messageId); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.sendMessageToFriends(userName,message); for(int i=0;i<buddy.size();i++) { System.out.println("buddyName is : " + buddy.get(i).getBuddyName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick"; String message = "Welcome to Shephertz"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendMessageToFriends(userName,message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("buddyName is : " + buddy[i].GetBuddyName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("messageId is : " + buddy[i].GetMessageId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick", message = "Welcome to Shephertz"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.sendMessageToFriends(userName,message,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("buddyName is : " + result[i].buddyName) console.log("message is : " + result[i].message) console.log("messageId is : " + result[i].messageId) } } else { console.log("userName is : " + result.userName) console.log("buddyName is : " + result.buddyName) console.log("message is : " + result.message) console.log("messageId is : " + result.messageId) } }, error: function(error) { } });local userName = "Nick"; local message = "Welcome to Shephertz"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:sendMessageToFriends(userName,message,App42CallBack) function App42CallBack:onSuccess(object) print("buddyName is : " ..object:getBuddyName()); print("userName is : "..object:getUserName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Welcome to Shephertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToFriends(userName,message,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String message = "Welcome to Shephertz"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.SendMessageToFriends(userName,message); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("buddyName is : " + buddy[i].GetBuddyName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); }$userName = "Nick"; $message = "Welcome to Shephertz"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->sendMessageToFriends($userName, $message); foreach($buddyResponse as $buddy) { print_r("UserName is".$buddy->getUserName()); print_r("BuddyName is :".$buddy->getBuddyName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Welcome to Shephertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendMessageToFriends(userName,message,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var message :String= "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.sendMessageToFriends(userName,message, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("buddyName is : " + buddy.getBuddyName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } } }Not AvailableString userName = "Nick"; String message = "Welcome to Shephertz"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.sendMessageToFriends(userName,message); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); }
Get all messages.
Required Parameters
userName - Name of the user whose messages have to fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllMessages(userName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessages(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); } } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllMessages:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *buddyArray = (NSArray*)responseObj; for(Buddy *buddy in buddyArray){ NSLog(@"userName is : %@",buddy.userName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getAllMessages(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let list = response as! NSArray for buddy in list { NSLog("userName is : %@",buddy.userName); NSLog("message is : %@", buddy.message); NSLog("messageID is : %@", buddy.messageId); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllMessages(userName); for(int i=0;i<buddy.size();i++) { System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessages(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("ownerName is : " + buddy[i].GetOwnerName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("messageId is : " + buddy[i].GetMessageId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllMessages(userName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("ownerName is : " + result[i].ownerName) console.log("message is : " + result[i].message) console.log("messageId is : " + result[i].messageId) } } else { console.log("userName is : " + result.userName) console.log("ownerName is : " + result.ownerName) console.log("message is : " + result.message) console.log("messageId is : " + result.messageId) } }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllMessages(userName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 0 then for i=1,table.getn(object) do print("ownerName is : " ..object[i]:getOwnerName()); print("userName is : "..object[i]:getUserName()); print("message is : " ..object[i]:getMessage()); print("messageId is : " ..object[i]:getMessageId()); print("SendedOn is : "..object[i]:getSendedOn()); end else print("ownerName is : " ..object:getOwnerName()); print("userName is : "..object:getUserName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessages(userName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllMessages(userName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->getAllMessages($buddyName); foreach($buddyResponse as $buddy) { print_r("UserName is".$buddy->getUserName()); print_r("OwnerName is :".$buddy->getOwnerName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessages(userName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllMessages(userName, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("ownerName is : " + buddy.getOwnerName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } } }Not AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllMessages(userName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("ownerName is : " + buddy.getOwnerName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); }
Get all messages from Buddy.
Required Parameters
userName - Name of the user who wants to fetch the message from a buddy.
buddyName - Name of Buddy whose message has to be fetched.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllMessagesFromBuddy(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("Owner Name is : " + buddy.get(i).getOwnerName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessagesFromBuddy(userName,buddyName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); } } }NSString *buddyName = @"Nick"; NSString *userName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllMessagesFromBuddy:buddyName toUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *messageArray = (NSArray*)responseObj; for(Buddy *buddy in messageArray){ NSLog(@"userName is : %@",buddy.userName); NSLog(@"ownerName is = %@ " , buddy.ownerName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let buddyName ="John"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getAllMessagesFromBuddy(buddyName, toUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let message = response as! NSArray for buddy in message { NSLog("userName is : %@",buddy.userName); NSLog("ownerName is = %@ " , buddy.ownerName); NSLog("message is : %@",buddy.message); NSLog("messageId is : %@",buddy.messageId); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllMessagesFromBuddy(userName,buddyName); for(int i=0;i<buddy.size();i++) { System.out.println("Owner Name is : " + buddy.get(i).getOwnerName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessagesFromBuddy(userName,buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("ownerName is : " + buddy[i].GetOwnerName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("messageId is : " + buddy[i].GetMessageId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick", buddyName = "John"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllMessagesFromBuddy(userName,buddyName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("ownerName is : " + result[i].ownerName) console.log("message is : " + result[i].message) console.log("messageId is : " + result[i].messageId) } } else { console.log("userName is : " + result.userName) console.log("ownerName is : " + result.ownerName) console.log("message is : " + result.message) console.log("messageId is : " + result.messageId) } }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllMessagesFromBuddy(buddyName,userName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 0 then for i=1,table.getn(object) do print("ownerName is : " ..object[i]:getOwnerName()); print("userName is : "..object[i]:getUserName()); print("message is : " ..object[i]:getMessage()); print("messageId is : " ..object[i]:getMessageId()); print("SendedOn is : "..object[i]:getSendedOn()); end else print("buddyName is : " ..object:getBuddyName()); print("userName is : "..object:getUserName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessagesFromBuddy(userName,buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllMessagesFromBuddy(userName,buddyName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); }$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->getAllMessagesFromBuddy($userName, $userName); foreach($buddyResponse as $buddy) { print_r("UserName is".$buddy->getUserName()); print_r("OwnerName is :".$buddy->getOwnerName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessagesFromBuddy(userName,buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var buddyName :String= "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllMessagesFromBuddy(userName,buddyName, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("ownerName is : " + buddy.getOwnerName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } } }Not AvailableString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllMessagesFromBuddy(userName,buddyName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("ownerName is : " + buddy.getOwnerName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); }
Get all messages from a group based upon UserName, OwnerName, GroupName.
Required Parameters
userName - Name of the user who wants to fetch the message from the group.
groupOwner - Name of owner of the group.
groupName - Name of the group from which message has to be fetched.
String userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.getAllMessagesFromGroup(userName, groupOwner, groupName,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Buddy> buddy = (ArrayList<Buddy> )response; for(int i=0;i<buddy.size();i++) { System.out.println("Owner Name is : " + buddy.get(i).getOwnerName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessagesFromGroup(userName, groupOwner, groupName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++){ Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); } } }NSString *userName = @"Nick"; NSString *groupOwner = @"John"; NSString *groupName = @"groupName"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService getAllMessagesFromGroup:groupName ofGroupOwner:groupOwner toUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *messageArray = (NSArray*)responseObj; for(Buddy *buddy in messageArray){ NSLog(@"userName is : %@",buddy.userName); NSLog(@"ownerName is = %@ " , buddy.ownerName); NSLog(@"message is : %@",buddy.message); NSLog(@"messageId is : %@",buddy.messageId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let groupOwner = "John" let groupName = "groupName" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.getAllMessagesFromGroup(groupName, ofGroupOwner:groupOwner, toUser:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let message = response as! NSArray for buddy in message)] { NSLog("userName is : %@",buddy.userName); NSLog("ownerName is = %@ " ,buddy.ownerName); NSLog("message is : %@",buddy.message); NSLog("messageId is : %@",buddy.messageId); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); ArrayList<Buddy> buddy = buddyService.getAllMessagesFromGroup(userName,groupOwner,groupName); for(int i=0;i<buddy.size();i++) { System.out.println("Owner Name is : " + buddy.get(i).getOwnerName()); System.out.println("userName is : " + buddy.get(i).getUserName()); System.out.println("message is : " + buddy.get(i).getMessage()); System.out.println("messageId is : " + buddy.get(i).getMessageId()); System.out.println("SendedOn is : " + buddy.get(i).getSendedOn()); }String userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.GetAllMessagesFromGroup(userName,groupOwner,groupName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Buddy> buddy = (List<Buddy>) response; for(int i=0;i<buddy.Count;i++) { App42Log.Console("userName is : " + buddy[i].GetUserName()); App42Log.Console("ownerName is : " + buddy[i].GetOwnerName()); App42Log.Console("message is : " + buddy[i].GetMessage()); App42Log.Console("messageId is : " + buddy[i].GetMessageId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result, userName = "Nick", groupOwner = "John", groupName = "groupName"; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.getAllMessagesFromGroup(userName,groupOwner,groupName,{ success: function(object) { var buddyObj = JSON.parse(object); result = buddyObj.app42.response.buddies.buddy; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("userName is : " + result[i].userName) console.log("ownerName is : " + result[i].ownerName) console.log("message is : " + result[i].message) console.log("messageId is : " + result[i].messageId) } } else { console.log("userName is : " + result.userName) console.log("ownerName is : " + result.ownerName) console.log("message is : " + result.message) console.log("messageId is : " + result.messageId) } }, error: function(error) { } });local userName = "Nick"; local groupOwner = "John"; local groupName = "groupName"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:getAllMessagesFromGroup(userName,groupOwner,groupName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 0 then for i=1,table.getn(object) do print("ownerName is : " ..object[i]:getOwnerName()); print("userName is : "..object[i]:getUserName()); print("message is : " ..object[i]:getMessage()); print("messageId is : " ..object[i]:getMessageId()); print("SendedOn is : "..object[i]:getSendedOn()); end else print("ownerName is : " ..object:getOwnerName()); print("userName is : "..object:getUserName()); print("message is : " ..object:getMessage()); print("messageId is : " ..object:getMessageId()); print("SendedOn is : "..object:getSendedOn()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* ownerName = "John"; const char* groupName = "GroupName"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessagesFromGroup(userName, ownerName, groupName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<Buddy> buddy = buddyService.GetAllMessagesFromGroup(userName,groupOwner,groupName); for(int i=0;i<buddy.Count;i++) { Console.WriteLine("userName is : " + buddy[i].GetUserName()); Console.WriteLine("ownerName is : " + buddy[i].GetOwnerName()); Console.WriteLine("message is : " + buddy[i].GetMessage()); Console.WriteLine("messageId is : " + buddy[i].GetMessageId()); }$userName = "Nick"; $groupOwner = "John"; $groupName = "groupName"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddyResponse = $buddyService->getAllMessagesFromGroup($userName, $groupOwner, $groupName); foreach($buddyResponse as $buddy) { print_r("UserName is".$buddy->getUserName()); print_r("OwnerName is :".$buddy->getOwnerName()); print_r("Sended on is :".$buddy->getSendedOn()); print_r("Message is :".$buddy->getMessage()); print_r("MessageId is : ".$buddy->getMessageId()); } $jsonResponse = $buddyResponse[0]->toString();const char* userName = "Nick"; const char* ownerName = "John"; const char* groupName = "GroupName"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->GetAllMessagesFromGroup(userName, ownerName, groupName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n BuddyName=%s\n",it->buddyName.c_str()); printf("\n Message=%s\n",it->message.c_str()); printf("\n MessageId=%s\n",it->messageId.c_str()); } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; var groupOwner:String = "John"; var groupName:String = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.getAllMessagesFromGroup(userName,groupOwner,groupName, new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception is : " + exception); } public function onSuccess(response:Object):void { var responseArray:Array =response as Array; for(var i:int=0;i<responseArray.length;i++) { var buddy:Buddy = Buddy(responseArray[i]); trace("userName is : " + buddy.getUserName()); trace("ownerName is : " + buddy.getOwnerName()); trace("message is : " + buddy.getMessage()); trace("messageId is : " + buddy.getMessageId()); } } }Not AvailableString userName = "Nick"; String groupOwner = "John"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); Vector buddyList = buddyService.getAllMessagesFromGroup(userName,groupOwner,groupName); for(int i=0;i < buddyList.size();i++) { Buddy buddy = (Buddy)buddyList.elementAt(i); System.out.println("userName is : " + buddy.getUserName()); System.out.println("ownerName is : " + buddy.getOwnerName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("messageId is : " + buddy.getMessageId()); }
Delete the message by message ID of a particular user.
Required Parameters
userName - Name of the user whose message has to deleted.
messageId - The ID of the message which has to be deleted.
String userName = "Nick"; String messageId = "messageId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.deleteMessageById(userName,messageId, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is: " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String messageId = "messageId"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.DeleteMessageById(userName, messageId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } }NSString *userName = @"Nick"; NSString *messageId = @"534b870ee4b018ef802e8283"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService deleteMessageById:messageId userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"Response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let messageId = "534b870ee4b018ef802e8283" App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.deleteMessageById(messageId, userName:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! App42Response NSLog("%@", buddy.strResponse) NSLog("%d", buddy.totalRecords) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String messageId = "messageId"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.deleteMessageById(userName, messageId); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String userName = "Nick"; String messageId = "messageId"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.DeleteMessageById(userName,messageId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42response = (App42Response) response; App42Log.Console("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", messageId = "messageId", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.deleteMessageById(userName,messageId,{ success: function(object) { var buddy = JSON.parse(object); result = buddy.app42.response; console.log("response is : " +result) }, error: function(error) { } });local userName = "Nick"; local messageId = "messageId"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:deleteMessageById(userName,messageId,App42CallBack) function App42CallBack:onSuccess(object) print("Response is "..object:getStrResponse()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* messageId = "messageId"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->DeleteMessageById(userName,messageId,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String messageId = "messageId"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); App42Response response = buddyService.DeleteMessageById(userName,messageId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; $messageId = "messageId"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy= $buddyService->deleteMessageById($userName,$messageId); print_r("Response is :".$buddy->toString()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* messageId = "messageId"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->DeleteMessageById(userName,messageId,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var messageId:String = "messageId"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.deleteMessageById(userName, messageId, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("response is : " + buddy); } }Coming SoonString userName = "Nick"; String messageId = "messageId"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.deleteMessageById(userName, messageId); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();
Delete the messages by message id’s of particular user.
Required Parameters
userName - Name of the user whose messages have to delete.
messageIds - Id's of the messages which have to be deleted.
String userName = "Nick"; ArrayList<String> messageIds = new ArrayList<String>(); messageIds.add("messageId1"); messageIds.add("messageId2"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.deleteMessageByIds(userName,messageIds, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is: " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; IList<String> messageIds = new List<String>(); messageIds.Add("messageId1"); messageIds.Add("messageId2"); App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.DeleteMessageByIds(userName, messageIds, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } }NSString *userName = @"Nick"; NSString *messageId = @"534b870ee4b018ef802e8283"; NSArray *messageIds = [NSArray arrayWithObjects:messageId, nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService deleteMessageByIds:messageIds userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"Response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let messageIds:NSMutableArray = NSMutableArray(); messageIds.addObject("562e2a4ae4b01f95b6399f82") App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.deleteMessageByIds(messageIds as [AnyObject], userName:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! App42Response NSLog("%@", buddy.strResponse) NSLog("%d", buddy.totalRecords) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; ArrayList<String> messageIds = new ArrayList<String>(); messageIds.add("messageId1"); messageIds.add("messageId2"); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.deleteMessageByIds(userName,messageIds); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String userName = "Nick"; IList<String> messageIds = new List<String>(); messageIds.Add("messageId1"); messageIds.Add("messageId2"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.DeleteMessageByIds(userName, messageIds, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42response = (App42Response) response; App42Log.Console("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result ; var messageIds =new Array(); messageIds.push("messageId1"); messageIds.push("messageId2"); App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.deleteMessageByIds(userName,messageIds,{ success: function(object) { var buddy = JSON.parse(object); result = buddy.app42.response; console.log("response is : " +result) }, error: function(error) { } });local userName = "Nick" local messageIds={} messageIds[1]="messageId1"; messageIds[2]="messageId2"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:deleteMessageByIds(userName, messageIds,App42CallBack) function App42CallBack:onSuccess(object) print("Response is : "..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; vector<string> messageIds; messageIds.push_back("53cf97a6e4b05e4ed335db0a"); messageIds.push_back("53cf97b1e4b0a53e3dc82927"); App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->DeleteMessageByIds(userName,messageIds,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); IList<String> messageIds = new List<String>(); messageIds.Add("messageId1"); messageIds.Add("messageId2"); App42Response response = buddyService.DeleteMessageByIds(userName, messageIds); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; $messageIds = array(); array_push($messageIds, "messageId1"); array_push($messageIds, "messageId1"); App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy = $buddyService->deleteMessageByIds($userName, $messageIds); print_r("Response is :".$buddy->toString()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; vector<string> messageIds; messageIds.push_back("53cf97a6e4b05e4ed335db0a"); messageIds.push_back("53cf97b1e4b0a53e3dc82927"); App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->DeleteMessageByIds(userName,messageIds,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var messageIds:Array = new Array(); messageIds.push("messageId1"); messageIds.push("messageId2"); App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.deleteMessageByIds(userName, messageIds, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("response is : " + buddy); } }Coming SoonString userName = "Nick"; Vector messageIds = new Vector(); messageIds.addElement("messageId1"); messageIds.addElement("messageId2"); App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.deleteMessageByIds(userName, messageIds); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();
Unfriend the friend from user’s friend list.
Required Parameters
userName - Name of the user who is going to unfriend the friend.
buddyName - Name of the buddy who is to be removed from friend list.
String userName = "Nick"; String buddyName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.unFriend(userName, buddyName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is: " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.UnFriend(userName, buddyName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } }NSString *userName = @"Nick"; NSString *buddyName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService unFriend:userName buddyName:buddyName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"Response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let buddyName ="John"; App42API.initializeWithAPIKey("API-KEY", andSecretKey: "SECRET_KEY") let buddyService = App42API.buildBuddyService() as! BuddyService buddyService?.unFriend(userName, buddyName:buddyName, completionBlock:{ (success, response, exception) -> Void in if (success) { let buddy = response as! App42Response NSLog("%@", buddy.strResponse) NSLog("%d", buddy.totalRecords) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.unFriend(userName, buddyName); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String userName = "Nick"; String buddyName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.UnFriend(userName, buddyName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42response = (App42Response) response; App42Log.Console("App42Response is : " + app42response) Boolean success = app42response.IsResponseSuccess(); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", buddyName = "John", result ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.unFriend(userName,buddyName,{ success: function(object) { var buddy = JSON.parse(object); result = buddy.app42.response; console.log("response is : " +result) }, error: function(error) { } });local userName = "Nick"; local buddyName = "John"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:unFriend(userName,buddyName,App42CallBack) function App42CallBack:onSuccess(object) print("Response is "..object:getStrResponse()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->UnFriend(userName,buddyName,app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }String userName = "Nick"; String buddyName = "John"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); App42Response response = buddyService.UnFriend(userName, buddyName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; $buddyName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); $buddy=$buddyService->unFriend($userName, $buddyName); print_r("Resposne is :".$buddy->toString()); $jsonResponse = $buddy->toString();const char* userName = "Nick"; const char* buddyName = "John"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->UnFriend(userName,buddyName,this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; var buddyName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.unFriend(userName, buddyName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var buddy:Buddy = Buddy(response); trace("response is : " + buddy); } }Coming SoonString userName = "Nick"; String buddyName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); App42Response app42response = buddyService.unFriend(userName, buddyName); System.out.println("Response is: " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();
The functions available under Buddy API can throw some exceptions in abnormal conditions. For example, if a developer is sending a friend request to his buddy for which he is already sent, the function will throw the App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “4601” and the details as “The request parameters are invalid. Request already sent for user Nick”.
String userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); buddyService.sendFriendRequest(userName, buddyName, message, new App42CallBack() { public void onSuccess(Object response) { Buddy buddy = (Buddy )response; System.out.println("userName is : " + buddy.getUserName()); System.out.println("buddyName is : " + buddy.getBuddyName()); System.out.println("message is : " + buddy.getMessage()); System.out.println("sendedOn is : " + buddy.getSendedOn()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); } });String userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendFriendRequest(userName, buddyName, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 4601) { Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { User user = (User) response; String jsonResponse = user.ToString(); } }NSString *userName = @"User Name"; NSString *buddyName = @"Buddy Name"; NSString *message = @"Welcome to Shephertz"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; BuddyService *buddyService = [App42API buildBuddyService]; [buddyService sendFriendRequestFromUser:userName toBuddy:buddyName withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Buddy *buddy = (Buddy*)responseObj; NSLog(@"Response=%@",buddy.strResponse); } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // Handle here for Client is not authorized } else if(appErrorCode == 1500) { // Handle here for Internal Server Error } NSString *jsonText = exception.reason; } }];Coming SoonString userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); try { Buddy buddy = buddyService.sendFriendRequest(userName, buddyName, message); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4601) { Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }String userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); buddyService.SendFriendRequest(userName, buddyName, message,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("response is : " + response.ToString()); } public void OnException(Exception e) { App42Exception exception = (App42Exception)e; int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } }var userName = "John", buddyName = "Nick", message = "Hi i am using App42 Buddy Service", appErrorCode ; App42.initialize("API_KEY","SECRET_KEY"); var buddyService = new App42Buddy(); buddyService.sendFriendRequest(userName, buddyName, message,{ success: function(object) { }, error: function(error) { var buddyObj = JSON.parse(error); appErrorCode = buddyObj.app42Fault.appErrorCode; if(appErrorCode == 4601) { Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });local userName = "Nick" local buddyName = "John" local message = "Welcome to Shephertz"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local buddyService = App42API:buildBuddyService() buddyService:sendFriendRequest(userName, buddyName, message,App42CallBack) function App42CallBack:onSuccess(object) print("Response Success is "..object:getResponseSuccess()) end function App42CallBack:onException(exception) local appErrorCode = exception:getAppErrorCode() if appErrorCode == 4601 then -- Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') elseif appErrorCode == 1401 then -- handle here for Client is not authorized elseif appErrorCode == 1500 then -- handle here for Internal Server Error end endconst char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Hi i am using App42 Buddy Service"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendFriendRequest(userName, buddyName, message, app42callback(Sample_Class::onBuddyServiceRequestCompleted, this)); void Sample_Class::onBuddyServiceRequestCompleted(void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { // Handle success response here. } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); int appErrorCode = app42BuddyResponse->appErrorCode; if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }String userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42API.Initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.BuildBuddyService(); try { Buddy buddy = buddyService.SendFriendRequest(userName, buddyName, message); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); }$userName = "John"; $buddyName = "Nick"; $message = "Hi i am using App42 Buddy Service"; App42API::initialize("API_KEY","SECRET_KEY"); $buddyService = App42API::buildBuddyService(); try { $buddy = $buddyService->SendFriendRequest($userName, $buddyName, $message); } catch(App42Exception $exception) { $appErrorCode = $exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }const char* userName = "Nick"; const char* buddyName = "John"; const char* message = "Hi i am using App42 Buddy Service"; App42API::Initialize("API_KEY", "SECRET_KEY"); BuddyService *buddyService = App42API::BuildBuddyService(); buddyService->SendFriendRequest(userName, buddyName, message, this, app42callfuncND_selector(Sample_Class::onBuddyServiceRequestCompleted)); void Sample_Class::onBuddyServiceRequestCompleted(App42CallBack *sender, void *response) { App42BuddyResponse *app42BuddyResponse = (App42BuddyResponse*)response; if(app42BuddyResponse->isSuccess) { printf("\ncode=%d",app42BuddyResponse->getCode()); printf("\nisSuccess=%d",app42BuddyResponse->isSuccess); printf("\nResponse Body=%s",app42BuddyResponse->getBody().c_str()); for(std::vector<App42Buddy>::iterator it = app42BuddyResponse->buddyList.begin(); it != app42BuddyResponse->buddyList.end(); ++it) { // Handle success response here. } } else { printf("\nerrordetails:%s",app42BuddyResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42BuddyResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42BuddyResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42BuddyResponse->httpErrorCode); int appErrorCode = app42BuddyResponse->appErrorCode; if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Not Availablevar userName:String = "John"; var buddyName:String = "Nick"; var message:String = "Hi i am using App42 Buddy Service"; App42API.initialize("API_KEY","SECRET_KEY"); var buddyService:BuddyService = App42API.buildBuddyService(); buddyService.sendFriendRequest(userName, buddyName, message,new callback()); public class callback implements App42CallBack { public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 4601) { // Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } public function onSuccess(response:Object):void { trace("response is : " + response) } }Not AvailableString userName = "John"; String buddyName = "Nick"; String message = "Hi i am using App42 Buddy Service"; App42API.initialize("API_KEY","SECRET_KEY"); BuddyService buddyService = App42API.buildBuddyService(); try { Buddy buddy = buddyService.sendFriendRequest(userName, buddyName, message); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4601) { Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick') } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }
Functions in Buddy API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The requested parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
4600 - NOT FOUND - User by the name '@userName does not exist.
4601 - BAD REQUEST - The request parameters are invalid. Request already sended for user '@userName'.
4602 - NOT FOUND - Requests for user '@userName' does not exist.
4603 - NOT FOUND - Request from user '@buddyName' does not exist.
4604 - NOT FOUND - User by the name '@userName friends does not exist.
4605 - BAD REQUEST - The request parameters are invalid. Group by the name '@groupName' for user '@userName' already exists.
4606 - NOT FOUND - User by the name '@userName friendsList '@friendsList' does not exist.
4607 - NOT FOUND - Group by the name '@groupName' for user '@ownerName' does not exist.
4608 - NOT FOUND - Friends for location does not exist.
4609 - NOT FOUND - User by the name '@userName' group does not exist.
4610 - BAD REQUEST - The request parameters are invalid. Group by the name '@groupName' for users '@userName' already added.
4611 - NOT FOUND - Group by the name '@groupName' friends does not exist.
4612 - BAD REQUEST - The request parameters are invalid. User by the name '@userName' can not block itself.
4613 - BAD REQUEST - The request parameters are invalid. Buddy by the name '@userName' is already a friend.
4614 - BAD REQUEST - The request parameters are invalid. Request already received from user '@userName'.
4615 - BAD REQUEST - The request parameters are invalid. User by the name '@userName' can not send message to self.
4616 - BAD REQUEST - Passed JSON string '@message' is not valid.
4617 - BAD REQUEST - Passed JSON string '@message' is not valid.
4618 - NOT FOUND - User by the name '@userName' messages does not exist.
4619 - BAD REQUEST - Invalid message ID.
4620 - NOT FOUND - Invalid Buddy Request.
4621 - NOT FOUND - Friend by the name '@buddyName' for the user '@userName' does not exist.
4622 - BAD REQUEST - The request parameters are invalid. User by the name '@userName' can not unfriend itself.