Skip to content

Commit

Permalink
Merge pull request #143 from ai-zen/main
Browse files Browse the repository at this point in the history
Update SDK to 1.58a and Add more method to the workshop mod.
  • Loading branch information
ceifa authored Jun 3, 2024
2 parents 0d1d418 + f4c1244 commit 780717b
Show file tree
Hide file tree
Showing 12 changed files with 598 additions and 81 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ napi = { version = "2.13.1", features = ["tokio_rt", "napi6", "serde-json"] }
napi-derive = "2.13.0"
lazy_static = "1"
tokio = { version = "1", features = ["sync", "time"] }
steamworks = { version="0.11.0", features = [ "serde", ] }
steamworks = { version = "0.11.0", features = ["serde"] }
serde = "1"
serde_json = "1"

Expand Down
102 changes: 99 additions & 3 deletions client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,78 @@ export namespace workshop {
* @returns an array of subscribed workshop item ids
*/
export function getSubscribedItems(): Array<bigint>
export const enum UGCQueryType {
RankedByVote = 0,
RankedByPublicationDate = 1,
AcceptedForGameRankedByAcceptanceDate = 2,
RankedByTrend = 3,
FavoritedByFriendsRankedByPublicationDate = 4,
CreatedByFriendsRankedByPublicationDate = 5,
RankedByNumTimesReported = 6,
CreatedByFollowedUsersRankedByPublicationDate = 7,
NotYetRated = 8,
RankedByTotalVotesAsc = 9,
RankedByVotesUp = 10,
RankedByTextSearch = 11,
RankedByTotalUniqueSubscriptions = 12,
RankedByPlaytimeTrend = 13,
RankedByTotalPlaytime = 14,
RankedByAveragePlaytimeTrend = 15,
RankedByLifetimeAveragePlaytime = 16,
RankedByPlaytimeSessionsTrend = 17,
RankedByLifetimePlaytimeSessions = 18,
RankedByLastUpdatedDate = 19
}
export const enum UGCType {
Items = 0,
ItemsMtx = 1,
ItemsReadyToUse = 2,
Collections = 3,
Artwork = 4,
Videos = 5,
Screenshots = 6,
AllGuides = 7,
WebGuides = 8,
IntegratedGuides = 9,
UsableInGame = 10,
ControllerBindings = 11,
GameManagedItems = 12,
All = 13
}
export const enum UserListType {
Published = 0,
VotedOn = 1,
VotedUp = 2,
VotedDown = 3,
Favorited = 4,
Subscribed = 5,
UsedOrPlayed = 6,
Followed = 7
}
export const enum UserListOrder {
CreationOrderAsc = 0,
CreationOrderDesc = 1,
TitleAsc = 2,
LastUpdatedDesc = 3,
SubscriptionDateDesc = 4,
VoteScoreDesc = 5,
ForModeration = 6
}
export interface WorkshopItemStatistic {
numSubscriptions?: bigint
numFavorites?: bigint
numFollowers?: bigint
numUniqueSubscriptions?: bigint
numUniqueFavorites?: bigint
numUniqueFollowers?: bigint
numUniqueWebsiteViews?: bigint
reportScore?: bigint
numSecondsPlayed?: bigint
numPlaytimeSessions?: bigint
numComments?: bigint
numSecondsPlayedDuringTimePeriod?: bigint
numPlaytimeSessionsDuringTimePeriod?: bigint
}
export interface WorkshopItem {
publishedFileId: bigint
creatorAppId?: number
Expand All @@ -308,6 +380,9 @@ export namespace workshop {
timeCreated: number
/** Time updated in unix epoch seconds format */
timeUpdated: number
/** Time when the user added the published item to their list (not always applicable), provided in Unix epoch format (time since Jan 1st, 1970). */
timeAddedToUserList: number
visibility: UgcItemVisibility
banned: boolean
acceptedForUse: boolean
tags: Array<string>
Expand All @@ -317,13 +392,34 @@ export namespace workshop {
numDownvotes: number
numChildren: number
previewUrl?: string
statistics: WorkshopItemStatistic
}
export interface WorkshopPaginatedResult {
items: Array<WorkshopItem | undefined | null>
returnedResults: number
totalResults: number
wasCached: boolean
}
export interface WorkshopItemsResult {
items: Array<WorkshopItem | undefined | null>
wasCached: boolean
}
export interface WorkshopItemQuery {
export interface WorkshopItemQueryConfig {
cachedResponseMaxAge?: number
includeMetadata?: boolean
includeLongDescription?: boolean
includeAdditionalPreviews?: boolean
onlyIds?: boolean
onlyTotal?: boolean
language?: string
matchAnyTag?: boolean
requiredTags?: Array<string>
excludedTags?: Array<string>
searchText?: string
rankedByTrendDays?: number
}
export function getItem(item: bigint, query?: WorkshopItemQuery | undefined | null): Promise<WorkshopItem | null>
export function getItems(items: Array<bigint>, query?: WorkshopItemQuery | undefined | null): Promise<Array<WorkshopItem | undefined | null>>
export function getItem(item: bigint, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItem | null>
export function getItems(items: Array<bigint>, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItemsResult>
export function getAllItems(page: number, queryType: UGCQueryType, itemType: UGCType, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
export function getUserItems(page: number, accountId: number, listType: UserListType, itemType: UGCType, sortOrder: UserListOrder, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
}
Binary file modified sdk/redistributable_bin/linux32/libsteam_api.so
Binary file not shown.
Binary file modified sdk/redistributable_bin/linux64/libsteam_api.so
Binary file not shown.
Binary file modified sdk/redistributable_bin/osx/libsteam_api.dylib
Binary file not shown.
Binary file modified sdk/redistributable_bin/steam_api.dll
Binary file not shown.
Binary file modified sdk/redistributable_bin/steam_api.lib
Binary file not shown.
Binary file modified sdk/redistributable_bin/win64/steam_api64.dll
Binary file not shown.
Binary file modified sdk/redistributable_bin/win64/steam_api64.lib
Binary file not shown.
17 changes: 15 additions & 2 deletions src/api/workshop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub mod workshop {
pub needs_to_accept_agreement: bool,
}

#[derive(Debug)]
#[napi]
pub enum UgcItemVisibility {
Public,
Expand All @@ -24,9 +25,20 @@ pub mod workshop {
Unlisted,
}

impl From<UgcItemVisibility> for steamworks::PublishedFileVisibility {
fn from(visibility: UgcItemVisibility) -> Self {
impl From<steamworks::PublishedFileVisibility> for UgcItemVisibility {
fn from(visibility: steamworks::PublishedFileVisibility) -> Self {
match visibility {
steamworks::PublishedFileVisibility::Public => UgcItemVisibility::Public,
steamworks::PublishedFileVisibility::FriendsOnly => UgcItemVisibility::FriendsOnly,
steamworks::PublishedFileVisibility::Private => UgcItemVisibility::Private,
steamworks::PublishedFileVisibility::Unlisted => UgcItemVisibility::Unlisted,
}
}
}

impl Into<steamworks::PublishedFileVisibility> for UgcItemVisibility {
fn into(self) -> steamworks::PublishedFileVisibility {
match self {
UgcItemVisibility::Public => steamworks::PublishedFileVisibility::Public,
UgcItemVisibility::FriendsOnly => steamworks::PublishedFileVisibility::FriendsOnly,
UgcItemVisibility::Private => steamworks::PublishedFileVisibility::Private,
Expand Down Expand Up @@ -96,6 +108,7 @@ pub mod workshop {
pub total: BigInt,
}

#[derive(Debug)]
#[napi]
pub enum UpdateStatus {
Invalid,
Expand Down
Loading

0 comments on commit 780717b

Please sign in to comment.