#api-key #steam #web-api #workshop #api-wrapper #steam-api #steam-workshop

steam-workshop-api

Provides an API wrapper for the steam workshop interfaces (IPublishedFileService and ISteamRemoteStorage) with the addition of proxy and api key support

6 releases

0.3.0 Jul 5, 2023
0.2.5 Jun 7, 2021

#2269 in Web programming

MIT license

16KB
294 lines

rs-steam-workshop-api

A rust api library for the steam web workshop api

Basic Usage

use steam_workshop_api::Workshop;
let workshop = Workshop::new(None);
let fileids = vec!['121221044', '1643520526'];
let details: Vec<WorkshopItem> = match workshop.get_published_file_details(&fileids) {
    Ok(details) => details,
    Err(err) => { 
        eprintln!("Failed to get file info");
    }
};

lib.rs:

steam_workshop_api

This library provides access to the steam web apis. Uses reqwest::blocking under the hood

Getting Started

To access any web api that requires no authentication (file details) you need to create a new instance:

use steam_workshop_api::Workshop;

//Either pass in a Some(reqwest::blocking::Client) or leave None for it to be autocreated
let wsclient = Workshop::new(None);
wsclient.get_published_file_details(&["fileid1".to_string()]);

Using Authorized Methods

Authorized methods are behind the AuthedWorkshop struct, which can be generated from a Workshop instance:

use steam_workshop_api::{Workshop, AuthedWorkshop};

let wsclient = Workshop::new(None);
let authed = wsclient.login("MY_API_KEY");
authed.search_ids(...);

Using Proxied Methods

Proxied methods are identical to AuthedWorkshop, except can use a third party server to proxy (and keep the appkey private)

use steam_workshop_api::{Workshop, ProxyWorkshop};

let wsclient = Workshop::new(None);
let proxy = wsclient.proxy("https://jackz.me/l4d2/scripts/search_public.php");
proxy.search_ids(...);

Dependencies

~4–19MB
~256K SLoC