Skip to content
Francisco Dias edited this page Dec 18, 2024 · 3 revisions

Tags

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_tags_game_get

mod.io Endpoint: Get Game Tag Options

This function gets all tags for the corresponding game, that can be applied to any of its mods. Hidden tag groups will only be returned if the authenticated user is a team member of the parent game with either Manager or Administrator status. A successful request will return an array of GameTagOption structs.


Syntax:

modio_tags_game_get(_callback_success, _callback_failed, _game_id)
Argument Type Description
_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:

GetGameTagOptions




Back To Top

modio_tags_game_add

mod.io Endpoint: Add Game Tag Option

This function adds tags which mods can apply to their profiles. A successful request will return a Message struct.

Tagging is a critical feature that powers the searching and filtering of mods for your game, as well as allowing you to control how mods are installed and played. For example you might enforce mods to be a particular type (map, model, script, save, effects, blueprint), which dictates how you install it. You may use tags to specify what the mod replaces (building, prop, car, boat, character). Or perhaps the tags describe the theme of the mod (fun, scenic, realism). The implementation is up to you, but the more detail you support the better filtering and searching becomes. If you need to store more advanced information, you can also use Metadata Key Value Pairs.

Note

You can also manage tags by editing your games profile on the mod.io website. This is the recommended approach.


Syntax:

modio_tags_game_add(_name, _type, _tags, _optionals, _callback_success, _callback_failed, _game_id)
Argument Type Description
_name String Name of the tag group, for example you may want to have 'Difficulty' as the name with 'Easy', 'Medium' and 'Hard' as the tag values.

> [!NOTE]
>
> If the tag name already exists, its parameters will be overwritten and new tags will be added to the group (an edit). There is a separate function to delete tags: modio_tags_game_delete.
_type String Determines whether you allow users to only select one tag (dropdown) or multiple tags (checkbox):

"dropdown" = Mods can select only one tag from this group, dropdown menu shown on site profile.
"checkboxes" = Mods can select multiple tags from this group, checkboxes shown on site profile.
_tags String Tags that mod creators can choose to apply to their mods. Every tag to apply requires a separate field with tags[] as the key (eg. tags[]=Easy, tags[]=Medium, tags[]=Hard).
_optionals Struct - hidden (Boolean) This group of tags should not be shown to users. Useful for games to tag special functionality, to filter on and use behind the scenes. You can also use Metadata Key Value Pairs for more arbitrary data.
- locked (Boolean) This group of tags can only be edited by game admins. Useful for games to tag special functionality, which users can see and filter on. Can be combined with hidden if you want the tags group locked and hidden.
_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:

Message




Back To Top

modio_tags_game_delete

mod.io Endpoint: Delete Game Tag Option


This function deletes an entire group of tags or individual tags.


Syntax:

modio_tags_game_delete(_name, _tags, _callback_success, _callback_failed, _game_id)
Argument Type Description
_name String Name of the tag group that you want to delete tags from.
_tags String Tags to delete from the game and all mod profiles. Every tag to delete requires a separate field with tags[] as the key (eg. tags[]=tag1, tags[]=tag2).

> [!NOTE]
>
> An empty value will delete the entire group.
_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_tags_mod_get

mod.io Endpoint: Get Mod Tags


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

Filters:

  • date_added (Real) Unix timestamp of date tag was added.
  • tag (String) string representation of the tag. You can check the eligible tags on the parent game object to determine all possible values for this field.

Syntax:

modio_tags_mod_get(_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:

GetModTags




Back To Top

modio_tags_mod_add

mod.io Endpoint: Add Mod Tags


This function adds tags to a mod's profile. You can only add tags allowed by the parent game, which are listed in the tag_option column in the Game. A successful request will return a Message struct.


Syntax:

modio_tags_mod_add(_mod_id, _tags, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_tags String Tags to apply to the mod. Every tag to apply requires a separate field with tags[] as the key (eg. tags[]=tag1, tags[]=tag2). Only the tags pre-defined by the parent game can be applied. To determine what tags are eligible, see the tags values within tag_options column on the parent Game.
_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:

Message




Back To Top

modio_tags_mod_delete

mod.io Endpoint: Delete Mod Tags


This function deletes tags from a mod's profile.


Syntax:

modio_tags_mod_delete(_mod_id, _tags, _callback_success, _callback_failed, _game_id)
Argument Type Description
_mod_id Real Unique id of the mod.
_tags String Tags to delete from the mod's profile. Every tag to delete requires a separate field with tags[] as the key (eg. tags[]=tag1, tags[]=tag2).
_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