question

Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq asked

Complete Cloud Code developer document

Hi,

I wanted to know where I can find the developer document of Cloud Code because there's no Intellisense while writing code. So I want to see what built-in functions are already there and how can I access them using which type of object.

There should be an API document or Intellisense if there isn't one. Gamesparks already providing this in their Cloud code.

apisCloudScriptdocumentation
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image
Citrus Yan answered

Sorry, currently there is no public documentation specifying the Cloud Script environment (built-in functions, variables, etc. ) and Intellisense for writing Cloud Script code. However, you can refer to the CloudScript.d.ts file when writing your Cloud Script code, it’s a Cloud Script typing file which defines the PlayFab environment for you. For instance, if you want to use SetProfileLanguage API in Cloud Script but you don’t know whether it’s a built-in function, you can search for it in this file. You will find that the SetProfileLanguage API is defined in the file: SetProfileLanguage(request: PlayFabPro..., this is defined in the IPlayFabEntiyAPI scope, which can be accessed by the entity object. Therefore, you can call this API by typing entity.SetProfileLanguage({<parameters>}) in Cloud Script (parameters are listed in the SetProfileLanguageRequest interface).

9 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

@Citrus Yan Hmm... Well it is very important to have an API document don't you think? And what can you tell me about introducing it? Are you guys planning to launch these two things?

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

Now I want to do multiple tasks using cloud code and I can do them on client side but I want to shift them on cloud. Giving the condition that there is no document then it means I have to issue a support ticket each time and then wait for the response which is pretty slow to me

You guys should definitely launch document and intellisense

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Muhammad Roshaan Tariq commented ·

Looks like you already did it, great!

1 Like 1 ·
Citrus Yan avatar image Citrus Yan Muhammad Roshaan Tariq commented ·

You can make feature requests about this to help us improve PlayFab here: https://community.playfab.com/spaces/24/index.html

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq Citrus Yan commented ·

@Citrus Yan Yeah I have already requested this feature here

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

How to get player profile with constraints mentioned using cloud script?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Muhammad Roshaan Tariq commented ·

Here is the sample code:

handlers.test = function (args, context){
    
    
    var profile = server.GetPlayerProfile({
        
    PlayFabId: currentPlayerId,
    
    ProfileConstraints : {
        "ShowLastLogin" : true
    }
        
    });
    
    return profile;
}

For all available Player Profile View Constraints, you call refer to the API reference here: PlayerProfileViewConstraints

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq Citrus Yan commented ·

@Citrus Yan Yes I know about the API document but I wanted to know if it's already built-in function to avoid writing the code again

Thank you for the code snippet though

0 Likes 0 ·
Show more comments
Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq answered

@Citrus Yan I want to write a cloud code function for granting items to user because it can only be accessed using server API. So, is it available already in cloud code or should I create one?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.