aboutsummaryrefslogtreecommitdiff
path: root/src/ugc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ugc.rs')
-rw-r--r--src/ugc.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ugc.rs b/src/ugc.rs
index 82cc0fe..49e5922 100644
--- a/src/ugc.rs
+++ b/src/ugc.rs
@@ -745,6 +745,25 @@ impl<'a> QueryResults<'a> {
self.num_results_returned
}
+ /// Gets the preview URL of the published file at the specified index.
+ pub fn preview_url(&self, index: u32) -> Option<String> {
+ let mut url = [0 as libc::c_char; 4096];
+
+ let ok = unsafe {
+ sys::SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(self.ugc, self.handle, index, url.as_mut_ptr(), url.len() as u32)
+ };
+
+ if ok {
+ Some(unsafe {
+ CStr::from_ptr(url.as_ptr() as *const _)
+ .to_string_lossy()
+ .into_owned()
+ })
+ } else {
+ None
+ }
+ }
+
/// Gets a result.
///
/// Returns None if index was out of bounds.