App42 Gift Service facilitates complete Gift Management for any mobile or web app. It enables gift creation, retrieval, updation and distribution to users in their apps & games.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.gift.Gift; import com.shephertz.app42.paas.sdk.android.gift.GiftService;Not Available#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.gift.Gift; import com.shephertz.app42.paas.sdk.java.gift.GiftService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.gift;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>Not AvailableNot AvailableNot Availableinclude_once '../GiftService.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../App42Log.php';Not AvailableNot Availableimport com.shephertz.app42.paas.sdk.as3.App42CallBack; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.gift.Gift; import com.shephertz.app42.paas.sdk.as3.gift.GiftService; import com.shephertz.app42.paas.sdk.as3.gift.Requests;Not AvailableNot Available
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 GiftService, buildGiftService() method needs to be called.
GiftService giftService = App42API.buildGiftService();Not AvailableGiftService *giftService = [App42API buildGiftService];let giftService = App42API.buildGiftService() as? GiftServiceGiftService giftService = App42API.buildGiftService();GiftService giftService = App42API.BuildGiftService();var giftService = new App42Gift();Not AvailableNot AvailableNot Available$giftService = App42API::buildGiftService();Not AvailableNot Availablevar giftService:GiftService = App42API.buildGiftService();Coming SoonNot Available
Create a gift for distributing among friends in app & games.
Required Parameters
giftName - Name of the gift which has to be created.
icon - Local path for the file.
displayName - Name of the gift which you want to display.
description - Description of your gift.
tagName - Specify the tag name for which you want to create the gift e.g. Entertainment , News , Sports.
String giftName = "Power"; String icon = "File path from gallery /sd card"; String displayName = "Power Up"; String description = "Gift is created in App42 DataBase."; String tagName = "Entertainment"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.createGift(giftName, icon, displayName, description, tagName, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSString *iconPath = @"File path for gift icon"; NSString *displayName = @"Power Up"; NSString *description = @"Gift is created in App42 DataBase."; NSString *tag = @"Entertainment"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService createGiftWithName:giftName giftIconPath:iconPath displayName:displayName giftTag:tag description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.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 giftName = "Power" let iconPath = "File path from gallery /sd card" let displayName = "Power Up" let description = "Gift is created in App42 DataBase." let tag = "Entertainment" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService as! GiftService giftService?.createGiftWithName(giftName, giftIconPath:icon, displayName:displayName, giftTag:tagName, description:description, completionBlock: { (success, response, exception) -> Void in if(success) { let gift = response as! GiftService NSLog("GiftName = %@",giftName); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; String icon = "File path from gallery /sd card"; String displayName = "Power Up"; String description = "Gift is created in App42 DataBase."; String tagName = "Entertainment"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.createGift(giftName, icon, displayName, description, tagName); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag());String giftName = "Power"; String icon = "File path from gallery /sd card"; String displayName = "Power Up"; String description = "Gift is created in App42 DataBase."; String tagName = "Entertainment"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.CreateGift(giftName, icon, displayName, description, tagName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Icon url is : " + gift.GetIcon ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power", icon = "File path from gallery /sd card", displayName = "Power Up", description = "Gift is created in App42 DataBase.", tagName = "Entertainment" , result ; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.createGift(giftName, icon, displayName, description, tagName,{ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $icon = "File path from gallery /sd card"; $displayName = "Power Up"; $description = "Gift is created in App42 DataBase."; $tagName = "Entertainment"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->createGift($giftName, $icon, $displayName, $description, $tagName); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag());Not AvailableNot Availablevar giftName:String = "Power"; var icon:String = "File path from gallery /sd card"; var displayName:String = "Power Up"; var description:String = "Gift is created in App42 DataBase."; var tagName:String = "Entertainment"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.createGift(giftName, icon, displayName, description,tagName,new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name "+gift.getDisplayName()); trace("Get Icon Url: "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonNot Available
Once gift is created, you can distribute gifts among the users with specifying the number of counts & recipients.
Required Parameters
giftName - Name of the gift which has to be distributed
recipientsList - List of the users among which gift is to be distributed.
counts - Number of same gift count to a recipients list.
String giftName = "Power"; ArrayList<String> recipientsList = new ArrayList<String>(); recipientsList.add("Nick"); recipientsList.add("John"); recipientsList.add("Pamila"); int counts = 2; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.distributeGifts(giftName, recipientsList, counts, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSArray *recipients = @[@"Nick",@"John"]; int counts = 2; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService distributeGiftsWithName:giftName to:recipients count:counts completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 giftName = "Power"; let recipients:NSMutableArray = NSMutableArray(); recipients.addObject("Nick") let counts:Int32 = 2 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.distributeGiftsWithName(giftName, to:recipients as [AnyObject], count:counts, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",giftName); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; ArrayList<String> recipientsList = new ArrayList<String>(); recipientsList.add("Nick"); recipientsList.add("John"); recipientsList.add("Pamila"); int counts = 2; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.distributeGifts(giftName, recipientsList, counts); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String giftName = "Power"; IList<string> recipientsList = new List<string>(); recipientsList.add("Nick"); recipientsList.add("John"); recipientsList.add("Pamila"); int counts = 2; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.DistributeGifts(giftName, recipientsList, counts, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; var recipientsList = new Array(); recipientsList.push("Nick"); recipientsList.push("John"); recipientsList.push("Pamila"); var counts =2 ; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.distributeGifts(giftName, recipientsList, counts,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $recipientsList = array(); array_push($recipientsList, "Nick"); array_push($recipientsList, "Pamila"); $counts = 2; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->distributeGifts($giftName, $recipientsList, $counts); print_r($gift->toString()); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("type is: " . $requestList->getType()); }Not AvailableNot Availablevar giftName:String = "Power"; var recipientsList:Array = new Array(); recipientsList.push("Nick"); recipientsList.push("John"); recipientsList.push("Pamila"); var counts:int = 2; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.distributeGifts(giftName, recipientsList,counts, new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Send gift among the recipients.
Note: You cannot send the gift until you have received at least one gift.
Required Parameters
giftName - Name of the gift which you need to send.
senderName - Name of the sender who wants to send the gift.
recipientList - List of the users among which gift is to be sent.
message - Message which you want to send with the gift.
String giftName = "Power"; String senderName = "Nick"; ArrayList<String> recipientList = new ArrayList<String>(); recipientList.add("John"); recipientList.add("Pamila"); String message = "Keep going"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.sendGift(giftName, senderName, recipientList, message, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSString *sender = @"Nick"; NSArray *recipients = @[@"John",@"Pamila"]; NSString *message = @"Keep going"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService sendGiftWithName:giftName from:sender to:recipients withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 giftName = "Power"; let recipients:NSMutableArray = NSMutableArray(); recipients.addObject("John") recipients.addObject("Pamila") let message = "Keep going" let sender = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.sendGiftWithName(giftName, from:sender, to:recipients as! [AnyObject], withMessage:message, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",giftName); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; String senderName = "Nick"; ArrayList<String> recipientList = new ArrayList<String>(); recipientList.add("John"); recipientList.add("Pamila"); String message = "Keep going"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.sendGift(giftName, senderName, recipientList, message); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String giftName = "Power"; String senderName = "Nick"; IList<string> recipientsList = new List<string>(); recipientsList.add("John"); recipientsList.add("Pamila"); String message = "Keep going"; int counts = 2; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.SendGift(giftName, senderName, recipientList, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("Message : " + gift.GetRequestsList ()[i].GetMessage()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; var recipientsList = new Array(); recipientsList.push("John"); recipientsList.push("Pamila"); var message = "Keep going",senderName = "Nick"; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.sendGift(giftName, senderName, recipientList, message,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $senderName = "Nick"; $recipientsList = array(); array_push($recipientsList, "John"); array_push($recipientsList, "Pamila"); $message = "Keep going"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->sendGift($giftName, $senderName, $recipientsList, $message); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("Message is: " . $requestList->getMessage()); print_r("type is: " . $requestList->getType()); }Not AvailableNot Availablevar giftName:String = "Power"; var senderName:String = "Nick"; var recipientsList:Array = new Array(); recipientsList.push("John"); recipientsList.push("Pamila"); var message:String = "Keep going"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.sendGift(giftName, senderName,recipientsList,message, new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); trace("Message is : " + request.getMessage()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
User can request a gift from friends, such as”lives”.
Required Parameters
giftName - Name of the gift which you need to request.
senderName - Name of the sender who wants to request the gift.
recipientList - List of the users among which gift is to be requested.
message - Message which you want to request with the gift.
String giftName = "Power"; String senderName = "Nick"; ArrayList<String> recipientList = new ArrayList<String>(); recipientList.add("Karter"); recipientList.add("Steve"); String message = "Help me ! I am stuck....."; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.requestGift(giftName, senderName, recipientList, message, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSString *sender = @"Nick"; NSArray *recipients = @[@"Karter",@"Steve"]; NSString *message = @"Help me ! I am stuck....."; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService requestGiftWithName:giftName from:sender to:recipients withMessage:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 giftName = "Power" let recipients:NSMutableArray = NSMutableArray(); recipients.addObject("John") recipients.addObject("Pamila") let message = "Keep Going...." let sender = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.requestGiftWithName(giftName, from:sender, to:recipients as [AnyObject], withMessage:message, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; String senderName = "Nick"; ArrayList<String> recipientList = new ArrayList<String>(); recipientList.add("Karter"); recipientList.add("Steve"); String message = "Help me ! I am stuck....."; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.requestGift(giftName, senderName, recipientList, message); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String giftName = "Power"; String senderName = "Nick"; IList<string> recipientsList = new List<string>(); recipientsList.add("John"); recipientsList.add("Pamila"); String message = "Keep going"; int counts = 2; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.RequestGift(giftName, senderName, recipientList, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("Message : " + gift.GetRequestsList ()[i].GetMessage()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); App42Log.Console ("Type is : "+ gift.GetRequestsList ()[i].GetType()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; var recipientsList = new Array(); recipientsList.push("Karter"); recipientsList.push("Steve"); var message = "Help me ! I am stuck.....",senderName = "Nick"; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.requestGift(giftName, senderName, recipientList, message,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $senderName = "Nick"; $message = "Help me ! I am stuck....."; $recipientsList = array(); array_push($recipientsList, "Karter"); array_push($recipientsList, "Steve"); App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->requestGift($giftName, $senderName, $recipientsList, $message); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("Message is: " . $requestList->getMessage()); print_r("type is: " . $requestList->getType()); }Not AvailableNot Availablevar giftName:String = "Power"; var senderName:String = "Nick"; var recipientsList:Array = new Array(); recipientsList.push("Karter"); recipientsList.push("Steve"); var message:String = "Help me ! I am stuck....."; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.requestGift(giftName, senderName,recipientsList,message, new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); trace("Message is : " + request.getMessage()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Fetch all the pending request of gifts that you have received from friends.
Required Parameters
giftName - Name of the gift which you want to fetch the request.
userName - Name of the user for whom you want to fetch the pending request.
String giftName = "Power"; String userName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.getGiftRequest(giftName,userName, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSString *userName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService getGiftRequestWithName:giftName fromUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 giftName = "Power" let userName = "John" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.getGiftRequestWithName(giftName, fromUser:userName, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; String userName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.getGiftRequest(giftName,userName); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String giftName = "Power"; String userName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.GetGiftRequest(giftName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("Message : " + gift.GetRequestsList ()[i].GetMessage()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); App42Log.Console ("Type is : "+ gift.GetRequestsList ()[i].GetType()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; userName = "John"; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.getGiftRequest(giftName,userName,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $userName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->getGiftRequest($giftName, $userName); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("Message is: " . $requestList->getMessage()); print_r("type is: " . $requestList->getType()); }Not AvailableNot Availablevar giftName:String = "Power"; var userName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.getGiftRequest(giftName, userName, new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); trace("Message is : " + request.getMessage()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Accept the Gift Request by the recipient, which is requested by his friend.
Required Parameters
requestId - Request ID of the Gift which has to be accepted.
recipient - Name of the recipient who wants to accept the request of a gift.
String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.acceptGiftRequest(requestId, recipient, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("ReceivedOn is : " + giftRequest.get(i).getReceivedOn()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *requestId = @"requestId"; NSString *recipient = @"Steve"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService acceptGiftRequestWithId:requestId by:recipient completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 requestId ="requestId" let recipient ="Steve" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.acceptGiftRequestWithId(requestId, by:recipient, completionBlock: { (success, response, exception) -> Void in { if (success) { let gift = response as! Gift NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.acceptGiftRequest(requestId, recipient); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("ReceivedOn is : " + giftRequest.get(i).getReceivedOn()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String requestId ="requestId"; String recipient ="Steve"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.AcceptGiftRequest(requestId, recipient, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("Message : " + gift.GetRequestsList ()[i].GetMessage()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); App42Log.Console ("ReceivedOn : " + gift.GetRequestsList ()[i].GetReceivedOn()); App42Log.Console ("Type is : "+ gift.GetRequestsList ()[i].GetType()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var requestId ="requestId"; recipient ="Steve"; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.acceptGiftRequest(requestId, recipient,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("ReceivedOn is : " + requestList[i].receivedOn); console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$requestId ="requestId"; $recipient ="Steve"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->acceptGiftRequest($requestId, $recipient); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("Message is: " . $requestList->getMessage()); print_r("type is: " . $requestList->getType()); print_r("ReceivedOn is: " . $requestList->getReceivedOn()); }Not AvailableNot Availablevar requestId:String ="requestId"; var recipient:String ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.acceptGiftRequest(requestId,recipient,new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); trace("Message is : " + request.getMessage()); trace("ReceivedOn is : " + request.getReceivedOn()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Reject the Gift Request by the recipient which is requested by his friend.
Required Parameters
requestId - Request ID of the Gift which has to be rejected.
recipient - Name of the recipient who wants to reject the request of a friend.
String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.rejectGiftRequest(requestId, recipient, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("ReceivedOn is : " + giftRequest.get(i).getReceivedOn()); System.out.println("Type is : "+giftRequest.get(i).getType()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *requestId = @"requestId"; NSString *recipient = @"Steve"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService rejectGiftRequestWithId:requestId by:recipient completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.createdOn); for (Request *request in gift.requests) { NSLog(@"Sender = %@",request.sender); NSLog(@"Recipient = %@",request.recipient); NSLog(@"Expired On = %@",request.expiration); NSLog(@"Type = %@",request.type); NSLog(@"RequestId = %@",request.requestId); NSLog(@"sentOn = %@",request.sentOn); } } 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 requestId ="requestId" let recipient = "Steve" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.rejectGiftRequestWithId(requestId, by:recipient, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); for request in gift.requests { NSLog("Sender = %@",request.sender); NSLog("Recipient = %@",request.recipient); NSLog("Expired On = %@",request.expiration); NSLog("Type = %@",request.type); NSLog("RequestId = %@",request.requestId); NSLog("sentOn = %@",request.sentOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.rejectGiftRequest(requestId, recipient); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); ArrayList<Gift.Requests> giftRequest = gift.getRequestsList(); for(int i=0;i<giftRequest.size();i++) { System.out.println("Sender Name is : " + giftRequest.get(i).getSender()); System.out.println("Recipient is : "+giftRequest.get(i).getRecipient()); System.out.println("Expired On : " + giftRequest.get(i).getExpiration()); System.out.println("SentOn is : "+giftRequest.get(i).getSentOn()); System.out.println("Message is : " + giftRequest.get(i).getMessage()); System.out.println("Request Id is : " + giftRequest.get(i).getRequestId()); System.out.println("ReceivedOn is : " + giftRequest.get(i).getReceivedOn()); System.out.println("Type is : "+giftRequest.get(i).getType()); }String requestId ="requestId"; String recipient ="Steve"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.RejectGiftRequest(requestId, recipient, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); for(int i=0;i<gift.GetRequestsList ().Count; i++) { App42Log.Console ("Sender : " + gift.GetRequestsList ()[i].GetSender()); App42Log.Console ("Recipient : " + gift.GetRequestsList ()[i].GetRecipient()); App42Log.Console ("Message : " + gift.GetRequestsList ()[i].GetMessage()); App42Log.Console ("RequestId : " + gift.GetRequestsList ()[i].GetRequestId()); App42Log.Console ("SentOn : " + gift.GetRequestsList ()[i].GetSentOn()); App42Log.Console ("ReceivedOn : " + gift.GetRequestsList ()[i].GetReceivedOn()); App42Log.Console ("Type is : "+ gift.GetRequestsList ()[i].GetType()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var requestId ="requestId"; recipient ="Steve"; var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.rejectGiftRequest(requestId, recipient,{ success: function(object) { var gift = JSON.parse(object); result = gift.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); var requestList = result.requests; for(var i=0;i<requestList.length;i++) { console.log("Sender Name is : " + requestList[i].sender) console.log("Recipient is : " + requestList[i].recipient) console.log("Expired On : " + requestList[i].expiration) console.log("sentOn is : " + requestList[i].sentOn) console.log("Request Id is : " + requestList[i].requestId) console.log("ReceivedOn is : " + requestList[i].receivedOn); console.log("Type is : " + requestList[i].type) } }, error: function(error) { } });Not AvailableNot AvailableNot Available$requestId ="requestId"; $recipient ="Steve"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->rejectGiftRequest($requestId, $recipient); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); $requestResponse = $gift->getRequestsList(); foreach ($requestResponse as $requestList) { print_r("Sender is : " . $requestList->getSender()); print_r("Recipient is : " . $requestList->getRecipient()); print_r("Expiration is : " . $requestList->getExpiration()); print_r("SentOn is: " . $requestList->getSentOn()); print_r("RequestId is: " . $requestList->getRequestId()); print_r("Message is: " . $requestList->getMessage()); print_r("type is: " . $requestList->getType()); print_r("ReceivedOn is: " . $requestList->getReceivedOn()); }Not AvailableNot Availablevar requestId:String ="requestId"; var recipient:String ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.rejectGiftRequest(requestId,recipient,new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name is :"+gift.getDisplayName()); trace("Icon is : "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); var request:Requests = new Requests(); var requestList:Array = gift.getRequestsList(); for(var j:int=0; j < requestList.length ;j++){ request = Requests(requestList[j]); trace("Sender is : " + request.getSender()); trace("Recipient is : " + request.getRecipient()); trace("SentON is : " + request.getSentOn()); trace("Type is : " + request.getType()); trace("Request is : " + request.getRequestId()); trace("Expiration is : " + request.getExpiration()); trace("Message is : " + request.getMessage()); trace("ReceivedOn is : " + request.getReceivedOn()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Remove the Gift by the recipient which is sent by his friend.
Required Parameters
requestId - Request ID of the Gift which has to be removed.
recipient - Name of the recipient who wants to remove the gift from his friend.
String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.removeGift(requestId, recipient, 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()); } });Not AvailableNSString *requestId = @"requestId"; NSString *recipient = @"Steve"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService removeGiftWithRequestId:requestId by:recipient completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *app42Response = (App42Response*)responseObj; NSLog(@"isSuccess = %d",app42Response.isResponseSuccess); NSLog(@"Response=%@",app42Response.strResponse); } 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 requestId = "requestId" let recipient = "Steve" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.removeGiftWithRequestId(requestId, by:recipient, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("isSuccess = %d",gift.isResponseSuccess); NSLog("Response=%@",gift.strResponse); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String requestId ="requestId"; String recipient ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); App42Response app42Response = giftService.removeGift(requestId, recipient); System.out.println("app42Response is" + app42Response);String requestId ="requestId"; String recipient ="Steve"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.RemoveGift(requestId, recipient, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response)response; App42Log.Console ("App42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var requestId ="requestId"; recipient ="Steve"; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.removeGift(requestId, recipient,{ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift; console.log("Response is " + result) }, error: function(error) { } });Not AvailableNot AvailableNot Available$requestId ="requestId"; $recipient ="Steve"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $response = $giftService->removeGift($requestId, $recipient); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Not AvailableNot Availablevar requestId:String ="requestId"; var recipient:String ="Steve"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.removeGift(requestId,recipient,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Fetch all the gifts and their details.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.getAllGifts(new App42CallBack() { public void onSuccess(Object response) { ArrayList<Gift> gift = (ArrayList<Gift>)response; for(int i=0;i<gift.size();i++) { System.out.println("Gift Name is : " + gift.get(i).getName()); System.out.println("Display name is : " + gift.get(i).getDisplayName()); System.out.println("Icon url is : " + gift.get(i).getIcon()); System.out.println("Description is : " + gift.get(i).getDescription()); System.out.println("Created on is : " + gift.get(i).getCreatedOn()); System.out.println("Tag is : " + gift.get(i).getTag()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not Available[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService getAllGifts:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *gifts = (NSArray*)responseObj; for (Gift *gift in gifts) { NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.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]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.getAllGifts( {(success, response, exception) -> Void in if (success) { let list = response as! NSArray for gift in list { NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); ArrayList<Gift> gift = giftService.getAllGifts(); for(int i=0;i<gift.size();i++) { System.out.println("Gift Name is : " + gift.get(i).getName()); System.out.println("Display name is : " + gift.get(i).getDisplayName()); System.out.println("Icon url is : " + gift.get(i).getIcon()); System.out.println("Description is : " + gift.get(i).getDescription()); System.out.println("Created on is : " + gift.get(i).getCreatedOn()); System.out.println("Tag is : " + gift.get(i).getTag()); }App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.GetAllGifts(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Gift> giftList = (IList<Gift>)response; for (int i=0; i<giftList.Count;i++) { Gift gift = (Gift)giftList[i]; App42Log.Console ("Name : " + gift.GetName ()); App42Log.Console ("DisplayName : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL : " + gift.GetIcon ()); App42Log.Console ("Tag : " + gift.GetTag ()); App42Log.Console ("Description : " + gift.GetDescription ()); App42Log.Console ("CreatedOn : " + gift.GetCreatedOn ()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.getAllGifts({ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift if (result instanceof Array) { for (var i = 0; i < result.length; i++) { console.log("Gift Name is : " +result[i].name); console.log("Display name is : " + result[i].displayName); console.log("Icon url is : " +result[i].icon); console.log("Description is : " + result[i].description); console.log("Created on is : " + result[i].createdOn); console.log("Tag is : " + result[i].tag); } } else { console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); } }, error: function(error) { } });Not AvailableNot AvailableNot AvailableApp42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $giftResponse = $giftService->getAllGifts(); print_r($giftResponse[0]->toString()); foreach ($giftResponse as $gift ) { print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); }Not AvailableNot AvailableApp42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.getAllGifts(new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { for(var i:int = 0;i < response.length;i++) { var gift:Gift = Gift(response[i]) trace("Gift Name "+gift.getName()); trace("Display Name "+gift.getDisplayName()); trace("Get Icon Url: "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Get the count of all the gifts.
Required Parameters
giftName - Name of the gift for which you need to fetch the count.
userName - Name of the user for whom you need to fetch the count.
String giftName = "Power"; String userName = "John"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.getGiftCount(giftName,userName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Total Records : " + app42response.getTotalRecords()) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; NSString *userName = @"John"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService getGiftCountWithName:giftName forUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *app42Response = (App42Response*)responseObj; NSLog(@"isResponseSuccess = %d",app42Response.isResponseSuccess); NSLog(@"Response = %@",app42Response.strResponse); NSLog(@"Total Gifts = %d",app42Response.totalRecords); } 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 giftName = "Power" let userName = "John" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.getGiftCountWithName(giftName, forUser:userName, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("isResponseSuccess = %d",gift.isResponseSuccess); NSLog("Response = %",gift.strResponse); NSLog("Total Gifts = %d",gift.totalRecords); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; String userName = "John"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); App42Response response = giftService.getGiftCount(giftName,userName); System.out.println("Success is : " + response.isResponseSuccess()); System.out.println("Total Gift is : " + response.getTotalRecords());String giftName = "Power"; String userName = "John"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.GetGiftCount(giftName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response)response; App42Log.Console("App42Response is : " + app42Response.ToString()); App42Log.Console("Total Gifts are : " + app42Response.GetTotalRecords()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; userName = "John"; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.getGiftCount(giftName,userName,{ success: function(object) { var giftObj = JSON.parse(object); console.log("Response is "+giftObj.app42.response.totalRecords); }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; $userName = "John"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $response = $giftService->getGiftCount($giftName, $userName); print_r("Total Records is " . $response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Not AvailableNot Availablevar giftName:String = "Power"; var userName:String = "John"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.getGiftCount(giftName,userName,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("Total Records : " + app42response.getTotalRecords()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Get gift details based on gift name.
Required Parameters
giftName - Name of the gift for which you want to fetch the details.
String giftName = "Power"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.getGiftByName(giftName, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftName = @"Power"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService getGiftByName:giftName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.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 giftName = "Power" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.getGiftByName(giftName, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); Gift gift = giftService.getGiftByName(giftName); System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); System.out.println("Icon url is : " + gift.getIcon()); System.out.println("Description is : " + gift.getDescription()); System.out.println("Created on is : " + gift.getCreatedOn()); System.out.println("Tag is : " + gift.getTag());String giftName = "Power"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.GetGiftByName(giftName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift)response; App42Log.Console ("Gift Name is : " + gift.GetName ()); App42Log.Console ("CreatedOn is : " + gift.GetCreatedOn ()); App42Log.Console ("Tag is : " + gift.GetTag ()); App42Log.Console ("Icon URL is : " + gift.GetIcon ()); App42Log.Console ("Description is : " + gift.GetDescription ()); App42Log.Console ("Display name is : " + gift.GetDisplayName ()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power" result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.getGiftByName(giftName,{ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift; console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->getGiftByName($giftName); print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag());Not AvailableNot Availablevar giftName:String = "Power"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.getGiftByName(giftName,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name "+gift.getDisplayName()); trace("Get Icon Url: "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Fetch the details of gift based on tag name.
Required Parameters
tagName - Name of the tag for which you want to fetch the gifts.
String tagName = "Entertainment"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.getGiftsByTag(tagName,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Gift> gift = (ArrayList<Gift>)response; for(int i=0;i<gift.size();i++) { System.out.println("Gift Name is : " + gift.get(i).getName()); System.out.println("Display name is : " + gift.get(i).getDisplayName()); System.out.println("Icon url is : " + gift.get(i).getIcon()); System.out.println("Description is : " + gift.get(i).getDescription()); System.out.println("Created on is : " + gift.get(i).getCreatedOn()); System.out.println("Tag is : " + gift.get(i).getTag()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *giftTag = @"Entertainment"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService getGiftsByTag:giftTag completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *gifts = (NSArray*)responseObj; for (Gift *gift in gifts) { NSLog(@"GiftName = %@",gift.name); NSLog(@"DisplayName = %@",gift.displayName); NSLog(@"Description = %@",gift.description); NSLog(@"Tag = %@",gift.tag); NSLog(@"Icon url = %@",gift.icon); NSLog(@"CreatedOn = %@",gift.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 tagName = "Entertainment" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.getGiftsByTag(tagName, completionBlock: { (success, response, exception) -> Void in if (success) { let list = response as! NSArray for gift in list { NSLog("GiftName = %@",gift.name); NSLog("DisplayName = %@",gift.displayName); NSLog("Description = %@",gift.description); NSLog("Tag = %@",gift.tag); NSLog("Icon url = %@",gift.icon); NSLog("CreatedOn = %@",gift.createdOn); } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String tagName = "Entertainment"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); ArrayList<Gift> gift = giftService.getGiftsByTag(tagName); for(int i=0;i<gift.size();i++) { System.out.println("Gift Name is : " + gift.get(i).getName()); System.out.println("Display name is : " + gift.get(i).getDisplayName()); System.out.println("Icon url is : " + gift.get(i).getIcon()); System.out.println("Description is : " + gift.get(i).getDescription()); System.out.println("Created on is : " + gift.get(i).getCreatedOn()); System.out.println("Tag is : " + gift.get(i).getTag()); }String tagName = "Entertainment"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.GetGiftsByTag(tagName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Gift> giftList = (IList<Gift>)response; for (int i=0; i<giftList.Count;i++) { Gift gift = (Gift)giftList[i]; App42Log.Console ("Name : " + gift.GetName ()); App42Log.Console ("DisplayName : " + gift.GetDisplayName ()); App42Log.Console ("Icon URL : " + gift.GetIcon ()); App42Log.Console ("Tag : " + gift.GetTag ()); App42Log.Console ("Description : " + gift.GetDescription ()); App42Log.Console ("CreatedOn : " + gift.GetCreatedOn ()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var tagName = "Entertainment" result; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.getGiftsByTag(tagName,{ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift if (result instanceof Array) { for (var i = 0; i < result.length; i++) { console.log("Gift Name is : " +result[i].name); console.log("Display name is : " + result[i].displayName); console.log("Icon url is : " +result[i].icon); console.log("Description is : " + result[i].description); console.log("Created on is : " + result[i].createdOn); console.log("Tag is : " + result[i].tag); } } else { console.log("Gift Name is : " +result.name); console.log("Display name is : " + result.displayName); console.log("Icon url is : " +result.icon); console.log("Description is : " + result.description); console.log("Created on is : " + result.createdOn); console.log("Tag is : " + result.tag); } }, error: function(error) { } });Not AvailableNot AvailableNot Available$tagName = "Entertainment"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $gift = $giftService->getGiftsByTag($tagName); print_r($giftResponse[0]->toString()); foreach ($giftResponse as $gift ) { print_r("Gift Name is : " . $gift->getName()); print_r("Display name is : " . $gift->getDisplayName()); print_r("icon url is : " . $gift->getIcon()); print_r("Description is : " . $gift->getDescription()); print_r("Created on is : " . $gift->getCreatedOn()); print_r("tag is : " . $gift->getTag()); }Not AvailableNot Availablevar tagName:String = "Entertainment"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.getGiftsByTag(tagName,new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { for(var i:int = 0;i < response.length;i++) { var gift:Gift = Gift(response[i]) trace("Gift Name "+gift.getName()); trace("Display Name "+gift.getDisplayName()); trace("Get Icon Url: "+gift.getIcon()); trace("Description : "+gift.getDescription()); trace("Created On : "+gift.getCreatedOn()); trace("Tag On : "+gift.getTag()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Remove particular gift based on its name. This will also delete all the records of gift.
Required Parameters
giftName - Name of the gift which you want to delete.
String giftName = "Power"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.deleteGiftByName(giftName, 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()); } });Not AvailableNSString *giftName = @"Power"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService deleteGiftByName:giftName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *app42Response = (App42Response*)responseObj; NSLog(@"isSuccess = %d",app42Response.isResponseSuccess); NSLog(@"Response=%@",app42Response.strResponse); } 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 giftName = "Power" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let giftService = App42API.buildGiftService() as? GiftService giftService?.deleteGiftByName(giftName, completionBlock: { (success, response, exception) -> Void in if (success) { let gift = response as! Gift NSLog("isSuccess = %d",gift.isResponseSuccess); NSLog("Response=%@",gift.strResponse); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String giftName = "Power"; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); App42Response response = giftService.deleteGiftByName(giftName); System.out.println("Reponse is : " + response); System.out.println("Success is : " + response.isResponseSuccess());String giftName = "Power"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.DeleteGiftByName(giftName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response)response; App42Log.Console ("App42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var giftName = "Power"; var result ; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.deleteGiftByName(giftName,{ success: function(object) { var giftObj = JSON.parse(object); result = giftObj.app42.response.gifts.gift; console.log("Response is " + result) }, error: function(error) { } });Not AvailableNot AvailableNot Available$giftName = "Power"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); $response = $giftService->deleteGiftByName($giftName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Not AvailableNot Availablevar giftName:String= "Power"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.deleteGiftByName(giftName,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
The functions available under Gift API can throw some exceptions in abnormal conditions. For example, if a developer is creating a gift with a gift name which is already in the database, the function will throw the App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “4900” and the details as “The request parameters are invalid. Gift by the name ‘Power’ already exists”.
String giftName = "Power"; String icon = "File path from gallery /sd card"; String displayName = "Power Up"; String description = "Gift is created in App42 DataBase."; String tagName = "Entertainment"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); giftService.createGift(giftName, icon, displayName, description, tagName, new App42CallBack() { public void onSuccess(Object response) { Gift gift = (Gift)response; System.out.println("Gift Name is : " + gift.getName()); System.out.println("Display name is : " + gift.getDisplayName()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } 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(); } });Coming SoonNSString *giftName = @"Power"; NSString *iconPath = @"File path for gift icon"; NSString *displayName = @"Power Up"; NSString *description = @"Gift is created in App42 DataBase."; NSString *tag = @"Entertainment"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GiftService *giftService = [App42API buildGiftService]; [giftService createGiftWithName:giftName giftIconPath:iconPath displayName:displayName giftTag:tag description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Gift *gift = (Gift*)responseObj; NSLog(@"GiftName = %@",gift.name); } else { int appErrorCode = exception.appErrorCode; if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }];Coming SoonString giftName = "Power"; String displayName = "Power Up"; String tagName = "Entertainment"; String icon = "File path from gallery /sd card"; String description = "Gift is created in App42 DataBase."; App42API.initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.buildGiftService(); try { Gift gift = giftService.createGift(giftName, icon, displayName, description, tagName); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } 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 giftName = "Power"; String displayName = "Power Up"; String tagName = "Entertainment"; String icon = "File path from gallery /sd card"; String description = "Gift is created in App42 DataBase."; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GiftService giftService = App42API.BuildGiftService(); giftService.CreateGift(giftName, icon, displayName, description, tagName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Gift gift = (Gift) response; App42Log.Console("Response is " + gift.ToString()); } public void OnException(Exception e) { App42Exception exception = (App42Exception)e; int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } 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 giftName = "Power", icon = "File path from gallery /sd card", displayName = "Power Up", description = "Gift is created in App42 DataBase.", tagName = "Entertainment" ; App42.initialize("API_KEY","SECRET_KEY"); var giftService = new App42Gift(); giftService.createGift(giftName, icon, displayName, description, tagName,{ success: function(object) { }, error: function(error) { var giftObj = JSON.parse(object); appErrorCode = giftObj.app42Fault.appErrorCode; if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });Coming SoonComing SoonComing Soon$giftName = "Power"; $icon = "File path from gallery /sd card"; $displayName = "Power Up"; $description = "Gift is created in App42 DataBase."; $tagName = "Entertainment"; App42API::initialize("API_KEY","SECRET_KEY"); $giftService = App42API::buildGiftService(); try { $gift = $giftService->createGift($giftName, $icon, $displayName, $description, $tagName); } catch(App42Exception $exception) { $appErrorCode =$exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } else if($appErrorCode == 1401){ // handle here for Client is not authorized } else if($appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }Coming SoonComing Soonvar giftName:String = "Power"; var icon:String = "File path from gallery /sd card"; var displayName:String = "Power Up"; var description:String = "Gift is created in App42 DataBase."; var tagName:String = "Entertainment"; App42API.initialize("API_KEY","SECRET_KEY"); var giftService:GiftService = App42API.buildGiftService(); giftService.createGift(giftName, icon, displayName, description,tagName,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var gift:Gift = Gift(response); trace("Gift Name "+gift.getName()); trace("Display Name "+gift.getDisplayName()); } public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 4900) { // Handle here for Bad Request (The request parameters are invalid. Gift by the name 'Power' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming Sooncoming soon
Functions in Gift API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid
1401 - UNAUTHORIZED - Client is not authorized
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again
4900 - Bad Request - The Request parameters are invalid. Gift by the name 'Power' already exists.
4901 - NOT FOUND - Gifts does not exist.
4902 - Not Found - Gifts by the name 'Power' does not exist.
4903 - NOT FOUND - Gifts by the tag 'Entertainment'does not exist.
4904 - Not Found - Sender by the name 'Nick' does not have gift by the name 'Power'.
4905 - Bad Request - The Request parameters are invalid. Number of recipient are more than gifts you have.
4906 - Not Found - Gifts by the name 'Power' you don't have any request yet."
4907 - NOT FOUND - Can not request gift to itself.
4908 - NOT FOUND - Gift by the requestId 'requestId' for the 'John' does not exist.
4909 - NOT FOUND - Gift by the requestId 'requestId' for the 'John' does not have any gift to accept.
4910 - NOT FOUND - Gift can not be remove because this is sent by owner.