Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • Feature Requests /
avatar image

John Peterson suggested an idea · Oct 16, 2017 at 09:44 PM · apisCloudScript

Enhance results from GrantItemsToUser().

Dear PlayFab Community,

I would like to propose an enhancement to the Server API's GrantItemsToUserResult object (the return value from GrantItemsToUser()). The function is very rich in its capabilities to recursively evaluate Bundles/Containers and ResultTables. However, that "hierarchical" information is not propagated back to the caller. All we get are the final ItemResults.

Here is the documentation.

Here is the definition (TypeScript) for the result object:

    /** https://api.playfab.com/Documentation/Server/datatype/PlayFab.Server.Models/PlayFab.Server.Models.GrantItemsToUserResult */
    interface GrantItemsToUserResult {
        /** Array of items granted to users. */
        ItemGrantResults?: GrantedItemInstance[],
    }

And the GrantedItemInstance:

    /** 
     * Result of granting an item to a user
     * https://api.playfab.com/Documentation/Server/datatype/PlayFab.Server.Models/PlayFab.Server.Models.GrantedItemInstance
     */
    interface GrantedItemInstance {
        /** Unique PlayFab assigned ID of the user on whom the operation will be performed. */
        PlayFabId?: string,
        /** Unique PlayFab assigned ID for a specific character owned by a user */
        CharacterId?: string,
        /** Result of this operation. */
        Result: boolean,
        /** Unique identifier for the inventory item, as defined in the catalog. */
        ItemId?: string,
        /** Unique item identifier for this specific instance of the item. */
        ItemInstanceId?: string,
        /** Class name for the inventory item, as defined in the catalog. */
        ItemClass?: string,
        /** Timestamp for when this instance was purchased. */
        PurchaseDate?: string,
        /** Timestamp for when this instance will expire. */
        Expiration?: string,
        /** Total number of remaining uses, if this is a consumable item. */
        RemainingUses?: number,
        /** The number of uses that were added or removed to this item in this call. */
        UsesIncrementedBy?: number,
        /** 
         * Game specific comment associated with this instance when it was added to the
         * user inventory.
         */
        Annotation?: string,
        /** Catalog version for the inventory item, when this instance was created. */
        CatalogVersion?: string,
        /** 
         * Unique identifier for the parent inventory item, as defined in the catalog, for
         * object which were added from a bundle or container.
         */
        BundleParent?: string,
        /** CatalogItem.DisplayName at the time this item was purchased. */
        DisplayName?: string,
        /** Currency type for the cost of the catalog item. */
        UnitCurrency?: string,
        /** Cost of the catalog item in the given currency. */
        UnitPrice: number,
        /** Array of unique items that were awarded when this catalog item was purchased. */
        BundleContents?: string[],
        /** A set of custom key-value pairs on the inventory item. */
        CustomData?: { [key: string]: string },
    }

Ideally, we would get some additional information in the GrantItemsToUserResult object: an array of intermediate objects (by ID) and their counts. Maybe something like:

interface IGrantedWorkingObjectType: "Bundle" | "Container" | "ResultTable";
interface IGrantedWorkingObject {
   Id: string,
   Type: IGrantedWorkingObjectType,
   Count: number
}

Then the GrantItemsToUserResult object could be extended:

    /** https://api.playfab.com/Documentation/Server/datatype/PlayFab.Server.Models/PlayFab.Server.Models.GrantItemsToUserResult */
    interface GrantItemsToUserResult {
        /** Array of items granted to users. */
        ItemGrantResults?: GrantedItemInstance[],
        WorkingObjects?: IGrantedWorkingObject[]
    }

You get the idea.

Having the GrantItemsToUser() provide this information would allow us access to some of the objects that were used to evaluate the resultant ItemInstances and perform any necessary operations that might have come from the working objects that were used in the evaluation.

Otherwise, the GrantItemsToUser() is incredibly opaque. Since we have limits on the number of APIs we can invoke in a single CloudScript call, access to this information is potentially very important.

Additionally, the GrantedItemInstance.BundleParent property appears to be an *internal* ID value, and not something that we can easily reference with the Server API. The documentation shows that it's a user-friendly value, but when I look at the value, it's more like "BundleParent":"C4544EEC77A6897E".

Thank you for your consideration!

thub.nodes.view.add-new-comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 comment

· Add your reply
avatar image

John Peterson commented · Oct 17, 2017 at 02:00 PM

Coupon and other intermediate items that can help to generate the GrantedItemInstances should also be included in this "working objects" aspect.

thub.nodes.view.add-new-comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Your Opinion Counts

    We would love to know what you need. Submit your ideas and upvote others to help us prioritize.

    Sign in to post a new idea

    Follow

    Follow This Idea

    1 Person is following this .

    avatar image

    Related Ideas

    Add VC Recharge Rate to client and server APIs

    Cloud Script environment variables and Admin API to update them

    Validate Receipt on Cloudscript

    Playstream events should show input parameters/arguments

    Define Automation Rules programmatically

    Add ability to configure CloudScript repository

    allow PurchaseItem from server api OR allow GetStoreItems from server api OR add parameter to client.PurchaseItem to copy customdata

    server.EvaluateRandomResultTableRequest() to accept multiple TableIds.

    Client Jobs (crons)

    Return all ResultTables with GetRandomResultTables().

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges