Skip to content

Commit 9f4b437

Browse files
committed
PlayPurchase - Add /purchase/download route for fetching downloadable content with optional ownership validation
1 parent b252ea3 commit 9f4b437

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/utils/swagger.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,53 @@ const options = {
534534
200: {description: "Rating submitted."}, 403: {description: "Item not owned."}
535535
}
536536
}
537+
}, "/purchase/download": {
538+
post: {
539+
tags: ["Purchase"],
540+
summary: "Get published item download data",
541+
description: "Fetches the PlayFab published item payload for a purchased item, including content URLs that the current device can download. Accepts either x-entitytoken directly or x-playfab-session plus x-playfab-id to mint one.",
542+
parameters: [{
543+
in: "header",
544+
name: "x-entitytoken",
545+
required: false,
546+
schema: {type: "string"},
547+
description: "PlayFab EntityToken for the current player."
548+
}, {
549+
in: "header",
550+
name: "x-mc-token",
551+
required: false,
552+
schema: {type: "string"},
553+
description: "Minecraft authorization header. When provided, ownership is validated before returning download data."
554+
}, {
555+
in: "header",
556+
name: "x-playfab-session",
557+
required: false,
558+
schema: {type: "string"},
559+
description: "PlayFab SessionTicket used to mint an EntityToken when x-entitytoken is not provided."
560+
}, {
561+
in: "header",
562+
name: "x-playfab-id",
563+
required: false,
564+
schema: {type: "string"},
565+
description: "PlayFab master_player_account id for the user. Required when x-playfab-session is used without x-entitytoken."
566+
}],
567+
requestBody: {
568+
required: true, content: {
569+
"application/json": {
570+
schema: {
571+
type: "object", required: ["itemId"], properties: {
572+
itemId: {type: "string", description: "Published item identifier."},
573+
eTag: {type: "string", default: "", description: "Optional ETag sent to PlayFab for the published item lookup."}
574+
}
575+
}
576+
}
577+
}
578+
},
579+
responses: {
580+
200: {description: "Published item payload including downloadable content URLs."},
581+
403: {description: "Item not owned when ownership validation is active."}
582+
}
583+
}
537584
}, "/debug/decode-token": {
538585
post: {
539586
tags: ["Debug"],
@@ -570,3 +617,4 @@ const options = {
570617
};
571618

572619
export const swaggerSpec = swaggerJSDoc(options);
620+

0 commit comments

Comments
 (0)