ReceiveUserItemFrom
Retrieves and transfers the gift item from the specified player, who must have previously called giveUserItemTo.
Service | Operation |
---|---|
userItems | RECEIVE_USER_ITEM_FROM |
Method Parameters
Parameter | Description |
---|---|
profileId | The profile ID of the user who is giving the item. |
itemId | The ID uniquely identifying the user item to be transferred. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string profileId = "a-user-profileId";
string itemId = "aaa-bbb-ccc-ddd";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.UserItemsService.ReceiveUserItemFrom(profileId, itemId, successCallback, failureCallback);
const char *profileId = "a-user-profileId";
const char *itemId = "aaa-bbb-ccc-ddd";
_bc->getUserItemsService()->receiveUserItemFrom(profileId, itemId, this);
NSString *profileId = @"a-user-profileId";
NSString *itemId = @"aaa-bbb-ccc-ddd";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc userItemsService] receiveUserItemFrom:profileId
itemId:itemId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String profileId = "a-user-profileId";
String itemId = "aaa-bbb-ccc-ddd";
this; // implements IServerCallback
_bc.getUserItemsService().receiveUserItemFrom(profileId, itemId, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var profileId = "a-user-profileId";
var itemId = "aaa-bbb-ccc-ddd";
_bc.userItems.receiveUserItemFrom(profileId, itemId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var profileId = "a-user-profileId";
var itemId = "aaa-bbb-ccc-ddd";
ServerResponse result = await _bc.userItemsService.receiveUserItemFrom(profileId:profileId, itemId:itemId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var profileId = "a-user-profileId";
var itemId = "aaa-bbb-ccc-ddd";
var userItemsProxy = bridge.getUserItemsServiceProxy();
var postResult = userItemsProxy.receiveUserItemFrom(profileId, itemId);
if (postResult.status == 200) {
// Success!
}
{
"service": "userItems",
"operation": "RECEIVE_USER_ITEM_FROM",
"data": {
"profileId": "a-user-profileId",
"itemId": "aaa-bbb-ccc-ddd"
}
}
JSON Response
{
"data": {
"item": {
"itemId": "692ac167-ed6a-4539-9513-c7149d7166c2",
"defId": "boost_rapidfire",
"quantity": 1,
"usesLeft": null,
"coolDownStart": -1,
"recoveryStart": -1,
"itemData": {},
"giftedTo": null,
"giftedFrom": null,
"blockId": null,
"createdAt": 1566852144140,
"updatedAt": 1566852144140,
"version": 1,
"maxUses": null,
"coolDownUntil": -1,
"recoveryUntil": -1,
"itemDef": {}
}
},
"status": 200
}