Giter Site home page Giter Site logo

grilme99 / playfabforroblox Goto Github PK

View Code? Open in Web Editor NEW
50.0 5.0 10.0 1.94 MB

🕹ī¸ An automatically generated and statically typed PlayFab SDK for Roblox and Luau.

Home Page: https://brooke.fyi/posts/playfab-sdk-v3/

License: Apache License 2.0

Lua 97.63% Rust 2.34% Shell 0.02%
roblox playfab sdk luau

playfabforroblox's Introduction

🕹ī¸ PlayFab For Roblox

An automatically generated and statically typed PlayFab SDK for Roblox and Luau.

Announcement

What is PlayFab?

PlayFab is a complete backend platform for live games with managed game services, real-time analytics, and LiveOps. This SDK provides complete access to the entire PlayFab API on Roblox.

Each PlayFab service (client, server, admin, matchmaking, etc) is split into its own Wally package to help reduce the overall bundle size (see reference below). PlayFab APIs are big, so only import the packages you actually need.

Example Project

This repo comes with a production-ready implementation of the PlayFab SDK, and is available pre-built to play here. Building the example project is a bit of a process because you will need a PlayFab title and matchmaking queue setup. Follow the instructions under the example/ directory.

Luau Types

While the entire PlayFab API is reflected in this SDK, Wally is currently unable to re-export Luau types to the package thunk. Whilst this doesn't break intellisense in your editor, it does mean you can't reference PlayFab API types for use in (for example) function signatures or type aliases.

To fix this, you should use the wally-package-types tool. This is a temporary fix until Wally supports re-exporting types, and usage can be found under install_packages.sh


Contribution

Contributor Covenant

I welcome contributions to this project!

Please keep in mind that all code contributions should be made to the generator/, because the modules/ directory is overwritten every update.

License

This contribution is dual licensed under EITHER OF

at your option.

For clarity, "your" refers to Brooke Rhodes or any other licensee/user of the contribution.


Service Reference

Documentation for all PlayFab services are available on the Microsoft website (linked for each package below).

Service Wally Package Description
Admin grilme99/[email protected] APIs for managing title configurations, uploaded Game Server code executables, and user data
Authentication grilme99/[email protected] The Authentication APIs provide a convenient way to convert classic authentication responses into entity authentication models. These APIs will provide you with the entity authentication token needed for subsequent Entity API calls. Manage API keys for authenticating any entity. The game_server API is designed to create uniquely identifiable game_server entities. The game_server Entity token can be used to call Matchmaking Lobby and Pubsub for server scenarios.
Client grilme99/[email protected] APIs which provide the full range of PlayFab features available to the client - authentication, account and data management, inventory, friends, matchmaking, reporting, and platform-specific functionality
CloudScript grilme99/[email protected] API methods for executing CloudScript using an Entity Profile
Data grilme99/[email protected] Store arbitrary data associated with an entity. Objects are small (~1KB) JSON-compatible objects which are stored directly on the entity profile. Objects are made available for use in other PlayFab contexts, such as PlayStream events and CloudScript functions. Files can efficiently store data of any size or format. Both objects and files support a flexible permissions system to control read and write access by other entities.
Economy grilme99/[email protected] API methods for managing the catalog. Inventory manages in-game assets for any given entity.
Events grilme99/[email protected] Write custom PlayStream and Telemetry events for any PlayFab entity. Telemetry events can be used for analytic, reporting, or debugging. PlayStream events can do all of that and also trigger custom actions in near real-time.
Experimentation grilme99/[email protected] APIs for managing experiments.
Groups grilme99/[email protected] The Groups API is designed for any permanent or semi-permanent collections of Entities (players, or non-players). If you want to make Guilds/Clans/Corporations/etc., then you should use groups. Groups can also be used to make chatrooms, parties, or any other persistent collection of entities.
Insights grilme99/[email protected] Manage the Insights performance level and data storage retention settings.
Leaderboards grilme99/[email protected] Manage entity statistics Manage entity statistics
Localization grilme99/[email protected] The Localization APIs give you the tools needed to manage language setup in your title.
Matchmaker grilme99/[email protected] Enables the use of an external match-making service in conjunction with PlayFab hosted Game Server instances
Multiplayer grilme99/[email protected] API methods for managing multiplayer servers. API methods for managing parties. The lobby service helps players group together to play multiplayer games. It is often used as a rendezvous point for players to share connection information.
Profiles grilme99/[email protected] All PlayFab entities have profiles, which hold top-level properties about the entity. These APIs give you the tools needed to manage entity profiles. The Master Player APIs allow you to perform operations on a master player account
Server grilme99/[email protected] Provides functionality to allow external (developer-controlled) servers to interact with user inventories and data in a trusted manner, and to handle matchmaking and client connection orchestration

playfabforroblox's People

Contributors

grilme99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

playfabforroblox's Issues

Lots of code duplication

All the files I checked which end in API.ts have the same code over and over. This should be condensed in some way.

For AdminAPI.ts, for example, something like this could be used:

/// <reference path="AdminApiTypes.d.ts" />

import MakeRequest from './HTTP'
import Settings from './Settings'

const MakeRequestType = <T extends object, Q extends object>(requestPath: string) => async (request: T) => await MakeRequest<EmptyResponse>(requestPath, request, 'X-SecretKey', Settings.settings.secretKey || error('Must have Settings.settings.secretKey set to call this method')) as Q

/**
 * Abort an ongoing task instance.
 * https://docs.microsoft.com/rest/api/playfab/admin/scheduledtask/aborttaskinstance
 */
export const AbortTaskInstance = MakeRequestType<AbortTaskInstanceRequest, EmptyResponse>('/Admin/AbortTaskInstance');

/**
 * Update news item to include localized version
 * https://docs.microsoft.com/rest/api/playfab/admin/title-wide-data-management/addlocalizednews
 */
export const AddLocalizedNews = MakeRequestType<AddLocalizedNewsRequest, AddLocalizedNewsResult>('/Admin/AddLocalizedNews')

Even this would only be a basic improvement. If I had written this library, I would have transformed a literal array containing ["AbortTaskInstance", "AbortTaskInstance"] into all the functions needed, and I would have defined the Request/Result table types in a lookup table so they can be dynamically accessed the first time when generating the type to export.

PlayFabAuthentication incorrect method API calls

Particularly for the method GetEntityTokenAsync, the API request requires either an X-SecretKey, X-Authentication, or X-EntityToken header. None of those are provided in PlayFabInternal's MakeAPICall function call, making the method unusable.

Require path and module return errors

There seems to be a require path issues:

  1. When requiring playfab-client/Types module in playfab-client on line 13.
  2. When requiring PlayFabInternal module in playfab-client/Apis on line 3.

In addition, when the playfab-client/Types file is required, it throws an error for returning nil.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.