Page cover image

Workshop Item Data

Like what you're seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

using HeathenEngineering.SteamworksIntegration;
public struct WorkshopItemData

A helper tool that allows you to pre-define all of the typical fields of a Steam User Generated Content item (aka a Workshop Item) for quick and easy creation or update. see the method for details.

Definition

Used with the User Generated Content interface for 1 line creation of workshop items.

Fields and Attributes

Published File Id

public PublishedFileId_t? publishedFileId

The published file ID is to be updated. This can be null and would be in the case of a create, if you are however updating an item this should be populated with the ID of the file to be updated

Note the ? at the end of the data type, this is a C# feature and indicates that this is a "Nullable" attribute e.g. Nullable<PublishedFileId_t> in this case.

App Id

public AppData appId

The consume and creating app ID of the item.

Title

public string title

The title of the item.

Description

public string description

The description of the item.

Content

public DirectoryInfo content

The folder where the content is located is used when creating and updating an item.

Preview

public FileInfo preview

The file to be used as the preview image should be a .jpg or .png file and its size must be smaller than that defined in the app's remote storage settings.

Metadata

public string metadata

The metadata associated with the file if any.

Tags

public string[] tags

The set of tags associated or to be associated with the item.

Visibility

public ERemoteStoragePublishedFileVisibility visibility

The visibility setting to apply to the file when created or updated.

Is Valid

public bool IsValid => get;

Returns true if all required fields are set and conform to Valve's basic requirements.

  • App ID is set to a valid app

  • title is not null or empty

  • title length is less than the max allowed by Valve (8000)

  • description is not null or empty

  • description length is less than the max allowed by Valve (8000)

  • metadata if populated length is less than the max allowed by Valve (5000)

  • preview is not null and file exists

  • content is not null and folder exists

  • no tag length is greater than 255

Methods

Create

public bool Create(Action<WorkshopItemDataCreateStatus> callback = null)

or

public bool Create(WorkshopItemPreviewFile[] additionalPreviews, 
                   string[] additionalYouTubeIds, 
                   WorkshopItemKeyValueTag[] additionalKeyValueTags, 
                   Action<WorkshopItemDataCreateStatus> callback = null)

Creates a workshop item with the fields defined in the structure, optionally with additional preview images, videos and key value tags.

Update

public bool Update(Action<WorkshopItemDataUpdateStatus> callback = null)

or

public bool Update(WorkshopItemPreviewFile[] additionalPreviews, 
                   string[] additionalYouTubeIds, 
                   WorkshopItemKeyValueTag[] additionalKeyValueTags, 
                   Action<WorkshopItemDataUpdateStatus> callback = null)

Assuming the publishedFileId is a valid file that the user owns this will update that file

Get

public static void Get(PublishedFileId_t file, Action<WorkshopItem> callback)

Gets the WorkshopItem for the indicated file.

Get Subscribed

public static void GetSubscribed(bool withLongDescription, 
                                 bool withMetadata, 
                                 bool withKeyValueTags, 
                                 bool withAdditionalPreviews, 
                                 uint withPlayTimeStatsInDays, 
                                 Action<List<WorkshopItem>> callback)

Gets the subscribed items with the additional arguments requested.

Last updated