From b9ba1434922a27311225e5af66797b1a6f603640 Mon Sep 17 00:00:00 2001 From: Vinyarion <38413862+VinyarionHyarmendacil@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:18:20 -0600 Subject: [PATCH] Economy related endpoints (#411) * Economy related endpoints `/listing/{productId}` `/user/{userId}/listings` `/tokenBundles` `/tilia/status` `/user/{userId}/tilia/tos` `/user/{userId}/balance` * Fix misnamed parameter * Fix typos * derp * Fix typo --------- Co-authored-by: jellejurre --- openapi/components/codeSamples/economy.yaml | 36 ++++++ openapi/components/parameters.yaml | 29 +++++ openapi/components/paths.yaml | 12 ++ openapi/components/paths/economy.yaml | 110 +++++++++++++++++ .../responses/economy/BalanceResponse.yaml | 5 + .../economy/ProductListingListResponse.yaml | 7 ++ .../economy/ProductListingResponse.yaml | 5 + .../economy/TiliaStatusResponse.yaml | 5 + .../responses/economy/TiliaTOSResponse.yaml | 5 + .../economy/TokenBundleListResponse.yaml | 7 ++ openapi/components/schemas/Balance.yaml | 13 ++ openapi/components/schemas/Product.yaml | 61 ++++++++++ .../components/schemas/ProductListing.yaml | 111 ++++++++++++++++++ .../schemas/ProductListingType.yaml | 5 + .../schemas/ProductListingVariant.yaml | 23 ++++ .../schemas/ProductListingVariantID.yaml | 3 + openapi/components/schemas/ProductType.yaml | 7 ++ openapi/components/schemas/TiliaStatus.yaml | 8 ++ openapi/components/schemas/TiliaTOS.yaml | 8 ++ openapi/components/schemas/TokenBundle.yaml | 28 +++++ 20 files changed, 488 insertions(+) create mode 100644 openapi/components/responses/economy/BalanceResponse.yaml create mode 100644 openapi/components/responses/economy/ProductListingListResponse.yaml create mode 100644 openapi/components/responses/economy/ProductListingResponse.yaml create mode 100644 openapi/components/responses/economy/TiliaStatusResponse.yaml create mode 100644 openapi/components/responses/economy/TiliaTOSResponse.yaml create mode 100644 openapi/components/responses/economy/TokenBundleListResponse.yaml create mode 100644 openapi/components/schemas/Balance.yaml create mode 100644 openapi/components/schemas/Product.yaml create mode 100644 openapi/components/schemas/ProductListing.yaml create mode 100644 openapi/components/schemas/ProductListingType.yaml create mode 100644 openapi/components/schemas/ProductListingVariant.yaml create mode 100644 openapi/components/schemas/ProductListingVariantID.yaml create mode 100644 openapi/components/schemas/ProductType.yaml create mode 100644 openapi/components/schemas/TiliaStatus.yaml create mode 100644 openapi/components/schemas/TiliaTOS.yaml create mode 100644 openapi/components/schemas/TokenBundle.yaml diff --git a/openapi/components/codeSamples/economy.yaml b/openapi/components/codeSamples/economy.yaml index c84cec7f..70b0d9b2 100644 --- a/openapi/components/codeSamples/economy.yaml +++ b/openapi/components/codeSamples/economy.yaml @@ -40,3 +40,39 @@ source: >- curl -X GET "https://vrchat.com/api/1/licenseGroups/{licenseGroupId}" \ -b "auth={authCookie}" +'/listing/{productId}': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/listing/{productId}" \ + -b "auth={authCookie}" +'/user/{userId}/listings': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/user/{userId}/listings?hydrate=true" \ + -b "auth={authCookie}" +'/tokenBundles': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/tokenBundles" \ + -b "auth={authCookie}" +'/tilia/status': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/tilia/status" \ + -b "auth={authCookie}" +'/user/{userId}/tilia/tos': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/user/{userId}/tilia/tos" \ + -b "auth={authCookie}" +'/user/{userId}/balance': + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/user/{userId}/balance" \ + -b "auth={authCookie}" diff --git a/openapi/components/parameters.yaml b/openapi/components/parameters.yaml index 3f7fdd7a..5c23c394 100644 --- a/openapi/components/parameters.yaml +++ b/openapi/components/parameters.yaml @@ -23,6 +23,13 @@ sort: schema: $ref: ./schemas/SortOption.yaml description: The sort order of the results. +hydrate: + name: hydrate + in: query + required: false + schema: + type: boolean + description: Populates some fields and changes types of others for certain objects. groupMemberSort: name: sort in: query @@ -90,6 +97,14 @@ groupId: type: string example: grp_00000000-0000-0000-0000-000000000000 description: Must be a valid group ID. +groupIdFilter: + name: groupId + in: query + required: false + schema: + type: string + example: grp_00000000-0000-0000-0000-000000000000 + description: Must be a valid group ID. groupRoleId: name: groupRoleId in: path @@ -337,6 +352,20 @@ licenseGroupId: schema: type: string description: Must be a valid license group ID. +productId: + name: productId + in: path + required: true + schema: + type: string + description: Must be a valid product ID. +active: + name: active + in: query + required: false + schema: + type: boolean + description: Filter for users' listings. variant: name: variant in: query diff --git a/openapi/components/paths.yaml b/openapi/components/paths.yaml index 9ffaee7a..318d2801 100644 --- a/openapi/components/paths.yaml +++ b/openapi/components/paths.yaml @@ -52,6 +52,18 @@ $ref: "./paths/economy.yaml#/paths/~1subscriptions" '/licenseGroups/{licenseGroupId}': $ref: "./paths/economy.yaml#/paths/~1licenseGroups~1{licenseGroupId}" +'/listing/{productId}': + $ref: "./paths/economy.yaml#/paths/~1listing~1{productId}" +'/user/{userId}/listings': + $ref: "./paths/economy.yaml#/paths/~1user~1{userId}~1listings" +'/tokenBundles': + $ref: "./paths/economy.yaml#/paths/~1tokenBundles" +'/tilia/status': + $ref: "./paths/economy.yaml#/paths/~1tilia~1status" +'/user/{userId}/tilia/tos': + $ref: "./paths/economy.yaml#/paths/~1user~1{userId}~1tilia~1tos" +'/user/{userId}/balance': + $ref: "./paths/economy.yaml#/paths/~1user~1{userId}~1balance" # favorites diff --git a/openapi/components/paths/economy.yaml b/openapi/components/paths/economy.yaml index 9e1825f6..ec611685 100644 --- a/openapi/components/paths/economy.yaml +++ b/openapi/components/paths/economy.yaml @@ -126,6 +126,116 @@ paths: tags: - economy description: Get a single License Group by given ID. + '/listing/{productId}': + parameters: + - $ref: ../parameters.yaml#/productId + - $ref: ../parameters.yaml#/hydrate + get: + summary: Get Product Listing + operationId: getProductListing + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1listing~1{productId}/get" + responses: + '200': + $ref: ../responses/economy/ProductListingResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: 'Gets a product listing' + '/user/{userId}/listings': + parameters: + - $ref: ../parameters.yaml#/userId + - $ref: ../parameters.yaml#/number + - $ref: ../parameters.yaml#/offset + - $ref: ../parameters.yaml#/hydrate + - $ref: ../parameters.yaml#/groupIdFilter + - $ref: ../parameters.yaml#/active + get: + summary: Get User Product Listings + operationId: getProductListings + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1user~1{userId}~1listings/get" + responses: + '200': + $ref: ../responses/economy/ProductListingListResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: Gets the product listings of a given user + '/tokenBundles': + get: + summary: List Token Bundles + operationId: getTokenBundles + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1tokenBundles/get" + responses: + '200': + $ref: ../responses/economy/TokenBundleListResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: 'Gets the list of token bundles' + '/tilia/status': + get: + summary: Get Tilia Status + operationId: getTiliaStatus + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1tilia~1status/get" + responses: + '200': + $ref: ../responses/economy/TiliaStatusResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: 'Gets the status of Tilia integration' + '/user/{userId}/tilia/tos': + parameters: + - $ref: ../parameters.yaml#/userId + get: + summary: Get Tilia TOS Agreement Status + operationId: getTiliaTos + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1user~1{userId}~1tilia~1tos/get" + responses: + '200': + $ref: ../responses/economy/TiliaTOSResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: 'Gets the status of the agreement of a user to the Tilia TOS' + '/user/{userId}/balance': + parameters: + - $ref: ../parameters.yaml#/userId + get: + summary: Get Balance + operationId: getBalance + security: + - authCookie: [] + x-codeSamples: + $ref: "../codeSamples/economy.yaml#/~1user~1{userId}~1balance/get" + responses: + '200': + $ref: ../responses/economy/BalanceResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + tags: + - economy + description: 'Gets the balance of a user' tags: $ref: ../tags.yaml components: diff --git a/openapi/components/responses/economy/BalanceResponse.yaml b/openapi/components/responses/economy/BalanceResponse.yaml new file mode 100644 index 00000000..580a5969 --- /dev/null +++ b/openapi/components/responses/economy/BalanceResponse.yaml @@ -0,0 +1,5 @@ +description: Returns a single Balance object. +content: + application/json: + schema: + $ref: ../../schemas/Balance.yaml \ No newline at end of file diff --git a/openapi/components/responses/economy/ProductListingListResponse.yaml b/openapi/components/responses/economy/ProductListingListResponse.yaml new file mode 100644 index 00000000..8fa6e836 --- /dev/null +++ b/openapi/components/responses/economy/ProductListingListResponse.yaml @@ -0,0 +1,7 @@ +description: Returns a list of ProductListing objects. +content: + application/json: + schema: + type: array + items: + $ref: ../../schemas/ProductListing.yaml \ No newline at end of file diff --git a/openapi/components/responses/economy/ProductListingResponse.yaml b/openapi/components/responses/economy/ProductListingResponse.yaml new file mode 100644 index 00000000..43e6c635 --- /dev/null +++ b/openapi/components/responses/economy/ProductListingResponse.yaml @@ -0,0 +1,5 @@ +description: Returns a single ProductListing object. +content: + application/json: + schema: + $ref: ../../schemas/ProductListing.yaml \ No newline at end of file diff --git a/openapi/components/responses/economy/TiliaStatusResponse.yaml b/openapi/components/responses/economy/TiliaStatusResponse.yaml new file mode 100644 index 00000000..b37a5767 --- /dev/null +++ b/openapi/components/responses/economy/TiliaStatusResponse.yaml @@ -0,0 +1,5 @@ +description: Returns a single TiliaStatus object. +content: + application/json: + schema: + $ref: ../../schemas/TiliaStatus.yaml \ No newline at end of file diff --git a/openapi/components/responses/economy/TiliaTOSResponse.yaml b/openapi/components/responses/economy/TiliaTOSResponse.yaml new file mode 100644 index 00000000..57ac3a42 --- /dev/null +++ b/openapi/components/responses/economy/TiliaTOSResponse.yaml @@ -0,0 +1,5 @@ +description: Returns a single TiliaTOS object. +content: + application/json: + schema: + $ref: ../../schemas/TiliaTOS.yaml \ No newline at end of file diff --git a/openapi/components/responses/economy/TokenBundleListResponse.yaml b/openapi/components/responses/economy/TokenBundleListResponse.yaml new file mode 100644 index 00000000..b7ebdcd3 --- /dev/null +++ b/openapi/components/responses/economy/TokenBundleListResponse.yaml @@ -0,0 +1,7 @@ +description: Returns a list of TokenBundle objects. +content: + application/json: + schema: + type: array + items: + $ref: ../../schemas/TokenBundle.yaml \ No newline at end of file diff --git a/openapi/components/schemas/Balance.yaml b/openapi/components/schemas/Balance.yaml new file mode 100644 index 00000000..169ed9ab --- /dev/null +++ b/openapi/components/schemas/Balance.yaml @@ -0,0 +1,13 @@ +description: '' +type: object +title: Balance +properties: + balance: + default: 0 + type: integer + noTransactions: + type: boolean + tiliaResponse: + type: boolean +required: + - balance diff --git a/openapi/components/schemas/Product.yaml b/openapi/components/schemas/Product.yaml new file mode 100644 index 00000000..f236f226 --- /dev/null +++ b/openapi/components/schemas/Product.yaml @@ -0,0 +1,61 @@ +title: Product +type: object +properties: + archived: + type: boolean + created: + type: string + format: date-time + description: + type: string + displayName: + type: string + groupAccess: + type: boolean + default: false + groupAccessRemove: + type: boolean + default: false + groupId: + $ref: ./GroupID.yaml + groupRoleId: + $ref: ./GroupRoleID.yaml + id: + $ref: ./ProductID.yaml + imageId: + $ref: ./FileID.yaml + nullable: true + parentListings: + type: array + items: + $ref: ./ProductID.yaml + productType: + $ref: ./ProductType.yaml + sellerDisplayName: + type: string + sellerId: + type: string + tags: + type: array + items: + $ref: ./Tag.yaml + updated: + type: string + format: date-time + nullable: true + useForSubscriberList: + type: boolean + default: false +required: + - archived + - created + - description + - displayName + - id + - imageId + - parentListings + - productType + - sellerDisplayName + - sellerId + - tags + - updated diff --git a/openapi/components/schemas/ProductListing.yaml b/openapi/components/schemas/ProductListing.yaml new file mode 100644 index 00000000..df39ea5e --- /dev/null +++ b/openapi/components/schemas/ProductListing.yaml @@ -0,0 +1,111 @@ +title: Listing +type: object +properties: + active: + type: boolean + archived: + type: boolean + buyerRefundable: + type: boolean + created: + type: string + format: date-time + description: + type: string + displayName: + type: string + duration: + type: integer + durationType: + type: string + groupIcon: + $ref: ./FileID.yaml + nullable: true + groupId: + $ref: ./GroupID.yaml + groupName: + type: string + hydratedProducts: + type: array + items: + $ref: ./Product.yaml + id: + $ref: ./ProductID.yaml + imageId: + $ref: ./FileID.yaml + nullable: true + instant: + type: boolean + listingType: + $ref: ./ProductListingType.yaml + listingVariants: + type: array + items: + $ref: ./ProductListingVariant.yaml + permanent: + type: boolean + priceTokens: + type: integer + productIds: + type: array + items: + $ref: ./ProductID.yaml + productType: + $ref: ./ProductType.yaml + products: + type: array + items: + type: object + description: Either a ProductID or a Product, depending on hydration + quantifiable: + type: boolean + recurrable: + type: boolean + refundable: + type: boolean + sellerDisplayName: + type: string + sellerId: + type: string + stackable: + type: boolean + storeIds: + type: array + items: + type: string + tags: + type: array + items: + $ref: ./Tag.yaml + updated: + type: string + format: date-time + nullable: true +required: + - active + - archived + - buyerRefundable + - created + - description + - displayName + - groupIcon + - groupId + - groupName + - id + - imageId + - instant + - listingType + - listingVariants + - permanent + - priceTokens + - productIds + - productType + - products + - recurrable + - refundable + - sellerDisplayName + - sellerId + - stackable + - storeIds + - tags + - updated diff --git a/openapi/components/schemas/ProductListingType.yaml b/openapi/components/schemas/ProductListingType.yaml new file mode 100644 index 00000000..b3922d0f --- /dev/null +++ b/openapi/components/schemas/ProductListingType.yaml @@ -0,0 +1,5 @@ +type: string +title: ProductListingType +default: subscription +enum: + - subscription diff --git a/openapi/components/schemas/ProductListingVariant.yaml b/openapi/components/schemas/ProductListingVariant.yaml new file mode 100644 index 00000000..a16a7856 --- /dev/null +++ b/openapi/components/schemas/ProductListingVariant.yaml @@ -0,0 +1,23 @@ +title: ProductListingVariant +type: object +properties: + effectiveFrom: + type: string + format: date-time + listingVariantId: + $ref: ./ProductListingVariantID.yaml + nullable: true + nonRefundable: + type: boolean + quantity: + type: integer + sellerVariant: + type: boolean + unitPriceTokens: + type: integer +required: + - listingVariantId + - nonRefundable + - quantity + - sellerVariant + - unitPriceTokens diff --git a/openapi/components/schemas/ProductListingVariantID.yaml b/openapi/components/schemas/ProductListingVariantID.yaml new file mode 100644 index 00000000..c19c0996 --- /dev/null +++ b/openapi/components/schemas/ProductListingVariantID.yaml @@ -0,0 +1,3 @@ +example: listvar_e8658b56-1662-436c-935a-afcf6a7d4fed +title: ProductListingVariantID +type: string diff --git a/openapi/components/schemas/ProductType.yaml b/openapi/components/schemas/ProductType.yaml new file mode 100644 index 00000000..c89171f0 --- /dev/null +++ b/openapi/components/schemas/ProductType.yaml @@ -0,0 +1,7 @@ +type: string +title: ProductType +default: udon +enum: + - listing + - role + - udon diff --git a/openapi/components/schemas/TiliaStatus.yaml b/openapi/components/schemas/TiliaStatus.yaml new file mode 100644 index 00000000..edc56d66 --- /dev/null +++ b/openapi/components/schemas/TiliaStatus.yaml @@ -0,0 +1,8 @@ +description: '' +type: object +title: TiliaStatus +properties: + economyOnline: + type: boolean +required: + - economyOnline diff --git a/openapi/components/schemas/TiliaTOS.yaml b/openapi/components/schemas/TiliaTOS.yaml new file mode 100644 index 00000000..edfc2de6 --- /dev/null +++ b/openapi/components/schemas/TiliaTOS.yaml @@ -0,0 +1,8 @@ +description: '' +type: object +title: TiliaTOS +properties: + signed_tos: + type: boolean +required: + - signed_tos diff --git a/openapi/components/schemas/TokenBundle.yaml b/openapi/components/schemas/TokenBundle.yaml new file mode 100644 index 00000000..5bbdd91c --- /dev/null +++ b/openapi/components/schemas/TokenBundle.yaml @@ -0,0 +1,28 @@ +title: TokenBundle +type: object +properties: + id: + type: string + steamItemId: + type: string + oculusSku: + type: string + amount: + type: integer + description: price of the bundle + description: + type: string + tokens: + type: integer + description: number of tokens received + imageUrl: + type: string + description: direct url to image +required: + - id + - steamItemId + - oculusSku + - amount + - description + - tokens + - imageUrl