Module:RobloxUrls

From nUSA Wiki Archive
Jump to navigation Jump to search

Documentation for this module may be created at Module:RobloxUrls/doc

--- Functions to create URLs to Roblox website.
-- <nowiki>

local p = {}

--- Make URL to group page.
-- @param {string} id Group ID.
-- @return {Uri} URL to group page.
function p.group(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/groups/" .. id;
    }
end

--- Make URL to user profile.
-- @param {string} id User ID.
-- @return {Uri} URL to profile page.
function p.user_from_id(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/users/" .. id .. "/profile"
    }
end

--- Make URL to user profile.
-- @param {string} username Username.
-- @return {Uri} URL to profile page.
function p.user_from_username(username)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/users/profile";
        query = {
            username = username
        }
    }
end

--- Make URL to game page.
-- @param {string} id Item ID.
-- @return {Uri} URL to game page.
function p.game_from_id(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/games/" .. id
    }
end

--- Make URL to item page.
-- @param {string} id Item ID.
-- @return {Uri} URL to item page.
function p.item_from_id(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/catalog/" .. id
    }
end

--- Make URL to library page.
-- @param {string} id Item ID.
-- @return {Uri} URL to library page.
function p.library_from_id(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/library/" .. id
    }
end

--- Make URL to bundle page.
-- @param {string} id Bundle ID.
-- @return {Uri} URL to bundle page in [[avatar shop]].
function p.bundle_from_id(id)
    return mw.uri.new {
        protocol = 'https';
        host = "www.roblox.com";
        path = "/bundles/" .. id
    }
end

return p