Skip to content

modfiles

YYBartT edited this page Jun 16, 2023 · 2 revisions

Modfiles

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.



Back To Top

modio_modfiles_get_list

mod.io Endpoint: Get Modfiles

This function gets all files that are published for the corresponding mod. A successful request will return an array of Modfile structs. We recommended reading the filtering documentation to return only the records you want.

ℹ️ NOTE

If the game requires mod downloads to be initiated via the API, the binary_url returned will contain a verification hash. This hash must be supplied to get the modfile, and will expire after a certain period of time. Saving and reusing the binary_url won't work in this situation given its dynamic nature.


Syntax:

modio_modfiles_get_list(_mod_id, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

GetModfiles




Back To Top

modio_modfiles_get

mod.io Endpoint: Get Modfile

This function gets a file. A successful request will return a single Modfile struct.

ℹ️ NOTE

If the game requires mod downloads to be initiated via the API, the binary_url returned will contain a verification hash. This hash must be supplied to get the modfile, and will expire after a certain period of time. Saving and reusing the binary_url won't work in this situation given its dynamic nature.


Syntax:

modio_modfiles_get(_mod_id, _file_id, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_file_id Real Unique id of the mod file.
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

Modfile




Back To Top

modio_modfiles_add

mod.io Endpoint: Add Modfile

This function uploads a file for the corresponding mod. A successful request will return the newly created Modfile struct. Ensure that the release you are uploading is stable and free from any critical issues. Files are scanned upon upload, any users who upload malicious files will have their accounts closed.

ℹ️ NOTE

This endpoint does not support input_json even if you base64-encode your file, due to the already-large file sizes of some releases and base64-encoding inflating the filesize.


Syntax:

modio_modfiles_add(_mod_id, _filedata, _optionals, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_filedata Real The binary file for the release. File must be zipped and cannot exceed 500MB in filesize.

- Filenames cannot contain any of the following characters: `\ / ? " < >
_optionals Struct - upload_id (String) Required if the filedata parameter is omitted. The UUID of a completed multipart upload session.
- version (String) Version of the file release (recommended format 1.0.0 - MAJOR.MINOR.PATCH).
- changelog (String) Changelog of this release.
- active (Boolean) Default value is true. Flag this upload as the current release, this will change the modfile field on the parent mod to the id of this file after upload.

[[NOTE: If the active parameter is true, a MODFILE_CHANGED event (modio_events_get_list) will be fired, so game clients know there is an update available for this mod.``

- filehash (String) MD5 of the submitted file. When supplied the MD5 will be compared against the uploaded files MD5. If they don't match a 422 Unprocessible Entity error will be returned.
- metadata_blob (String) Metadata stored by the game developer which may include properties such as what version of the game this file is compatible with.
- platforms (Array of String) An array containing one or more platforms this file is targeting. Valid values can be found under the targeting a platform section.
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

Modfile




Back To Top

modio_modfiles_edit

mod.io Endpoint: Edit Modfile

This function edits the details of a published file. If you want to update fields other than the changelog, version and active status, you should add a new file instead. A successful request will return updated Modfile struct.


Syntax:

modio_modfiles_edit(_mod_id, _mod_file, _optionals, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_mod_file Real Unique id of the mod_file.
_optionals Struct - version (String) Version of the file release (recommended format 1.0.0 - MAJOR.MINOR.PATCH)
- changelog (String) Changelog of this release.
- active (Boolean) Flag this upload as the current release.

> ℹ️ NOTE
>
> If the active parameter causes the parent mod's modfile parameter to change, a MODFILE_CHANGED event (modio_events_get_list) will be fired, so game clients know there is an update available for this mod.

- metadata_blob (String) Metadata stored by the game developer which may include properties such as what version of the game this file is compatible with
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

Modfile




Back To Top

modio_modfiles_delete

mod.io Endpoint: Delete Modfile

This function deletes a modfile. A successful request will return 204 No Content.

ℹ️ NOTE

A modfile can never be removed if it is the current active release for the corresponding mod regardless of user permissions. Furthermore, this ability is only available if you are authenticated as the game administrator for this game or are the original uploader of the modfile.


Syntax:

modio_modfiles_delete(_mod_id, _file_id, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_file_id Real Unique id of the mod_file.
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

N/A




Back To Top

modio_modfiles_platforms

mod.io Endpoint: Manage Platform Status

This function manages the platform status of a particular modfile. This endpoint does not set any file live, instead it allows you to approve and deny new uploads. To set a file as the live file for the approved platforms after you have reviewed them, you must call modio_modfiles_edit with the active flag enabled.

ℹ️ NOTE

This is ony applicable if the parent game has cross-platform moderation enabled. A successful request will return the updated Modfile struct.


Syntax:

modio_modfiles_platforms(_mod_id, _file_id, _optionals, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_file_id Real Unique id of the mod_file.
_optionals Struct - approved (Array) An array containing one or more platform strings that the specified modfile is approved for.
- denied (Array) An array containing one or more platform strings that the specified modfile is denied for.

> ℹ️ NOTE
>
> You cannot mark a live modfile as denied, if a modfile is live the only option to remove it is to set another existing modfile as the live modfile for that platform using modio_modfiles_edit, or add a new modfile using modio_modfiles_add.
_callback_success Function or Method The function to trigger when the request is successful.
_callback_failed Function or Method The function to trigger when the request failed.
_game_id Real OPTIONAL The ID of the game, defaults to the value set in the Game ID extension option if not provided

Returns:

Modfile