{"id":"dekkonot/api-dump","name":"api-dump","scope":"dekkonot","platform":"roblox","description":"A simple and reasonable module for working with the API dump from inside Roblox.","version":"1.1.0","latest":"1.1.0","versions":["1.0.2","1.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"befaadec911676dcbd717f4e47870745040c7b27a49e20f63bd06da517847d1d","likes":0,"downloads":0,"install":"forest install dekkonot/api-dump","url":"https://forest.dev/p/roblox/dekkonot/api-dump","files":"https://api.forest.dev/ai/package/roblox/dekkonot/api-dump/files","readme":"# rbx-api-dump\r\n\r\nA simple and reasonable module for processing the Roblox API dump from inside Roblox. In addition to fulfilling a use case, this module also acted as an experimental use of Roblox's typed Luau. As a result, this module can be considered to be fully typesafe.\r\n\r\nThis module pulls directly from Roblox's CDN, so it requires two HTTP requests to be sent when it's first required. Both of these requests are simple GET requests.\r\n\r\nTo get the project you can:\r\n - Build it using [Rojo](https://github.com/Roblox/rojo) 6+ by running `rojo build -o api-dump.rbxmx`\r\n - Grab the latest version from [Releases](https://github.com/dekkonot/rbx-api-dump/releases)\r\n - Install it using [Wally](https://github.com/UpliftGames/wally) by referencing `dekkonot/api-dump`\r\n\r\n## API\r\n\r\nAs with every module, there's a set list of API. Luckily, the API for this module is rather simple.\r\n\r\nWhen you require the module, it will immediately try to send two HTTP requests to get the API dump from Roblox. If it doesn't succeed, it retries after 1 second, then after 2 seconds, then 4, and so on.\r\n\r\nTo check if the API has returned successfully, this module provides two things: a function that returns if it's ready, and a signal that fires when it's ready.\r\n\r\n### isReady\r\n\r\n```plaintext\r\nAPI.isReady(): boolean\r\n```\r\n\r\nReturns whether or not the module is ready to use.\r\n\r\n### readyEvent\r\n\r\n```plaintext\r\nAPI.readyEvent: RBXScriptSignal\r\n```\r\n\r\nA signal that fires when the module is ready to use. Because it's a signal, you can also wait for it to be ready with `:Wait()`.\r\n\r\nA good pattern to use might be:\r\n\r\n```lua\r\nif not API.isReady() then\r\n    API.readyEvent:Wait()\r\nend\r\n```\r\n\r\nAfter the module is ready, all of the other functions can be used:\r\n\r\n### getClasses\r\n\r\n```plaintext\r\nAPI.getClasses(filter: Array<string>?): Array<string>\r\n```\r\n\r\nReturns a list of ClassNames. If `filter` is provided, any classes that have tags inside `filter` will be excluded from the returned list.\r\n\r\nThus, something like this:\r\n\r\n```lua\r\nAPI.getClasses({\"Deprecated\"})\r\n```\r\n\r\nWould return a list of classes that weren't deprecated.\r\n\r\n### getEnums\r\n\r\n```plaintext\r\nAPI.getEnums(filter: Array<string>?): Array<string>\r\n```\r\n\r\nReturns a list of Enum names. If `filter` is provided, it functions identically to the `filter` in [`getClasses`](#getclasses).\r\n\r\n### getSuperclasses\r\n\r\n```plaintext\r\nAPI.getSuperclasses(class: string): Array<string>\r\n```\r\n\r\nReturns a list of superclassses for the given ClassName. The array is guaranteed to be in order of inheritance. This means that iterating through the array will list the ClassNames with `Instance` in the first position and so on, with the final Classname (`class`) in the final position.\r\n\r\n### getTags\r\n\r\n```plaintext\r\nAPI.getTags(class: string, member: string?): Array<string>\r\n```\r\n\r\nReturns a list of tags on a particular class or member. If `member` is provide, it will return the tags on `class.member`, otherwise it will return the tags on `class`. The tags on a class is subject to change from version to version, and the order of the returned list is not guaranteed.\r\n\r\n### isDeprecated\r\n\r\n```plaintext\r\nAPI.isDeprecated(class: strimg, member: string?): boolean\r\n```\r\n\r\nReturns whether a given class or member is deprecated or not. If `member` is provided, it will return whether `class.member` is deprecated, otherwise it will whether `class` is or not.\r\n\r\n### isService\r\n\r\n```plaintext\r\nAPI.isService(class: string): boolean\r\n```\r\n\r\nReturns whether the given class is a Service or not. Essentially equivalent to `not not table.find(API.getTags(class), \"Service\"))`.\r\n\r\n### getMembers\r\n\r\n```plaintext\r\nAPI.getMembers(class: string, tagFilter: Array<string>?, securityFilter: Array<string>?, memberFilter: Dictionary<Dictionary<boolean>>?): Dictionary<Member>\r\n```\r\n\r\nReturns a dictionary representing all of a given class's [members](#member).\r\n\r\nIf `tagFilter` is provided, it acts an exclusion filter for the tags on members. Thus, something like `API.getMembers(\"Instance\", {\"Deprecated\"})` would return all members of Instance that weren't tagged with `Deprecated`.\r\n\r\nIf `securityFilter` is provided, it acts identically, except that instead of filtering tags it filters the security of members. For ease of use, some common filters are provided in [filters](#filters)\r\n\r\nIf `memberFilter` is provided, it acts as a filter to exclude members based on their names. The tree should be composed of a map of superclass names to any members you would like to filter. As an example, something like `API.getMembers(\"BasePart\", {[\"FormFactorPart\"] = {\"FormFactor\"}})` would prevent `FormFactor` from being included in `BasePart`'s returned members, as `FormFactorPart` is a superclass of `BasePart`.\r\n\r\n### getProperties\r\n\r\n```plaintext\r\nAPI.getProperties(class: string, tagFilter: Array<string>?, securityFilter: Array<string>?, memberFilter: Dictionary<Dictionary<boolean>>?): Dictionary<Property>\r\n```\r\n\r\nFunctions identically to [getMembers](#getmembers) but only returns [properties](#properties).\r\n\r\n### getFunctions\r\n\r\n```plaintext\r\nAPI.getFunctions(class: string, tagFilter: Array<string>?, securityFilter: Array<string>?, memberFilter: Dictionary<Dictionary<boolean>>?): Dictionary<Function>\r\n```\r\n\r\nFunctions identically to [getMembers](#getmembers) but only returns [functions](#function) (methods).\r\n\r\n### getEvents\r\n\r\n```plaintext\r\nAPI.getEvents(class: string, tagFilter: Array<string>?, securityFilter: Array<string>?, memberFilter: Dictionary<Dictionary<boolean>>?): Dictionary<Event>\r\n```\r\n\r\nFunctions identically to [getMembers](#getmembers) but only returns [events](#event).\r\n\r\n### getCallbacks\r\n\r\n```plaintext\r\nAPI.getCallbacks(class: string, tagFilter: Array<string>?, securityFilter: Array<string>?, memberFilter: Dictionary<Dictionary<boolean>>?): Dictionary<Callback>\r\n```\r\n\r\nFunctions identically to [getMembers](#getmembers) but only returns [callbacks](#callback).\r\n\r\n## Types\r\n\r\nFor the sake of convenience, several types are defined by the module. They can be referenced by indexing the variable that stores that module (e.g. if the module was stored in `API` you would access `Member` with `API.Member`).\r\n\r\nEach type definition is provided below, along with what they represent.\r\n\r\n### Member\r\n\r\n```lua\r\ntype Member = {\r\n    MemberType: string,\r\n    Name: string,\r\n    Security: { Read: string, Write: string, } | string,\r\n\r\n    Category: string?,\r\n    Serialization: { CanLoad: boolean, CanSave: boolean, }?,\r\n    ValueType: { Category: string, Name: string, }?,\r\n\r\n    Parameters: Array<{\r\n        Name: string,\r\n        Type: {\r\n            Category: string,\r\n            Name: string,\r\n        },\r\n    }>?,\r\n    ReturnType: { Category: string, Name: string, }?,\r\n\r\n    Tags: Array<string>?,\r\n}\r\n```\r\n\r\nThe `Member` type is used to represent any member of a class, so as a result is incredibly non-specific. The `MemberType` entry of the type will let you clarify what type a member is -- it will always be one of the following: `\"Property\"`, `\"Function\"`, `\"Event\"`, or `\"Callback\"`.\r\n\r\nCertain fields are present on all Members, regardless of their MemberType. To avoid repetition, they are described here:\r\n\r\n- `MemberType` - What type of member something is -- it will always be one of: `\"Property\"`, `\"Function\"`, `\"Event\"`, or `\"Callback\"`.\r\n- `Name` - What the name of a member is.\r\n- `Security` - A table containing details on what can access a property. In the case of Properties, this field is a table that indicates what can read and write it. Otherwise, it's a string.\r\n- `Tags` - A list of tags that appear on a particular member. These tags are subject to change and this field may or not be present on any given member.\r\n\r\n### Property\r\n\r\n```lua\r\ntype Property = {\r\n    Category: string,\r\n    MemberType: \"Property\",\r\n    Name: string,\r\n    Security: { Read: string, Write: string, },\r\n    Serialization: { CanLoad: boolean, CanSave: boolean, },\r\n    ValueType: ValueType,\r\n\r\n    Tags: Array<string>?,\r\n}\r\n```\r\n\r\nThe `Property` type is used to represent Properties of a class. A quick description of each of the fields is below:\r\n\r\n- `Category` - An arbitrary category decided on by Roblox that describes what a property does.\r\n- `Serialization` - A table containing details on whether a property serializes when its Instance is saved to or loaded from a model or place.\r\n- `ValueType` - A table containing details on what data type a property is. See [ValueType](#valuetype) for more details.\r\n\r\n### Function\r\n\r\n```lua\r\ntype Function = {\r\n    MemberType: string,\r\n    Name: string,\r\n    Parameters: Array<{\r\n        Name: string,\r\n        Type: ValueType,\r\n    }>,\r\n    ReturnType: ValueType,\r\n    Security: string,\r\n\r\n    Tags: Array<string>?,\r\n}\r\n```\r\n\r\nThe `Function` type is used to represent Methods of a class. The term Method is not used to maintain parity with the API dump. A quick description of each of the fields is below:\r\n\r\n- `Parameters` - An array containing tables that contain the name of a particular argument and its value. For information on the value, see [ValueType](#valuetype).\r\n- `ReturnType` - The return type of a Function. See [ValueType](#valuetype).\r\n\r\n### Event\r\n\r\n```lua\r\ntype Event = {\r\n    MemberType: string,\r\n    Name: string,\r\n    Parameters: Array<{ Name: string, Type: ValueType, }>,\r\n    Security: string,\r\n\r\n    Tags: Array<string>?,\r\n}\r\n```\r\n\r\nThe `Event` type is used to represent Events of a class. A quick description of each of the fields is below:\r\n\r\n- `Parameters` - An array containing tables that contain the name of a particular argument and its value. For more information on the value, see [ValueType](#valuetype).\r\n\r\n### Callback\r\n\r\n```lua\r\ntype Callback = {\r\n    MemberType: string,\r\n    Name: string,\r\n    Parameters: Array<{ Name: string, Type: ValueType, }>,\r\n    ReturnType: ValueType,\r\n    Security: string,\r\n\r\n    Tags: Array<string>?,\r\n}\r\n```\r\n\r\nThe `Callback` type is used to represent Callbacks of a class. A quick description of each of the fields is below:\r\n\r\n- `Parameters` - An array containing tables that contain the name of a particular argument and its value. For information on the value, see [ValueType](#valuetype).\r\n- `ReturnType` - The expected return type of a Callback. See [ValueType](#valuetype).\r\n\r\n### ValueType\r\n\r\n```lua\r\ntype ValueType = {\r\n    Category: string,\r\n    Name: string,\r\n}\r\n```\r\n\r\nThe `ValueType` type is used to represent a type of value. Because the pattern comes up so often, it is given its own type.\r\n\r\nIf `Category` is `Enum`, then `ValueType.Name` is the type of Enum it is. Otherwise, `ValueType.Name` indicates the actual type of a value something is. Note that this won't necessarily correspond to the type as it appears in Roblox.\r\n\r\n## Filters\r\n\r\nFor the sake of convenience, multiple filters are provided under `API.filters`. They're seperated into 3 categories, each with their own respective fields. A filter can be accessed with `API.filters.`**`Category`**.**`Filter`**, where `Category` and `Filter` are filled in from below:\r\n\r\n### Security\r\n\r\nThis category contains filters that can be used for the `securityFilter` argument of various functions. They are:\r\n\r\n- `None` - Nothing is filtered.\r\n- `CoreScript` - Everything that is inaccessible to CoreScripts is filtered.\r\n- `Plugin` - Everything that is inaccessible to Plugins is filtered.\r\n- `Normal` - Everything that is inaccessible to normal scripts is filtered.\r\n\r\n### Members\r\n\r\nThis category contains filters that for class members that can be used as the `tagFilter` argument of various functions. They are:\r\n\r\n- `None` - Nothing is filtered.\r\n- `Writable` - Filters readonly and nonscriptable properties.\r\n- `Sync` - Filters things that yield or can yield.\r\n- `NotDeprecated` - Filters deprecated members.\r\n- `Normal` - Combines `Writable` and `NotDeprecated`. This is generally the 'normal' when wanting to know what members a class has, so for convenience it is provided.\r\n\r\n### Class\r\n\r\nThis category contains filters for classes that can be used as the `filter` argument of [`getClasses`](#getclasses). They are:\r\n\r\n- `None` - Nothing is filtered.\r\n- `NonService` - Services are filtered.\r\n- `NotDeprecated` - Deprecated classes are filtered.\r\n- `NotSettings` - Settings classes are deprecated.\r\n","readmeTruncated":false}