Skip to content

Commit

Permalink
Merge branch 'feature/ugc-query-all' of github.com:ai-zen/steamworks.…
Browse files Browse the repository at this point in the history
…js into standalone-ci
  • Loading branch information
LZQCN committed Jan 21, 2024
2 parents 8ea6822 + 8b78658 commit d190ab8
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 94 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 = { git = "https://github.com/ai-zen/steamworks-rs.git", branch = "master", features = [
steamworks = { git = "https://github.com/ai-zen/steamworks-rs.git", branch = "feature/ugc-result", features = [
"serde",
] }
serde = "1"
Expand Down
21 changes: 14 additions & 7 deletions client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ export namespace workshop {
VoteScoreDesc = 5,
ForModeration = 6
}
export interface WorkshopItemAdditionalInformation {
previewUrl?: string
export interface WorkshopItemStatistic {
numSubscriptions?: bigint
numFavorites?: bigint
numFollowers?: bigint
Expand All @@ -376,6 +375,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 @@ -384,14 +386,19 @@ export namespace workshop {
numUpvotes: number
numDownvotes: number
numChildren: number
additional?: WorkshopItemAdditionalInformation
previewUrl?: string
statistics: WorkshopItemStatistic
}
export interface WorkshopPageResult {
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 WorkshopItemQueryConfig {
cachedResponseMaxAge?: number
includeMetadata?: boolean
Expand All @@ -407,7 +414,7 @@ export namespace workshop {
rankedByTrendDays?: number
}
export function getItem(item: bigint, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItem | null>
export function getItems(items: Array<bigint>, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPageResult>
export function getAllItems(page: number, queryType: UGCQueryType, itemType: UGCType, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPageResult>
export function getUserItems(page: number, accountId: number, listType: UserListType, itemType: UGCType, sortOrder: UserListOrder, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPageResult>
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>
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ai-zen/steamworks.js",
"version": "0.3.6-dev.15",
"version": "0.3.6-dev.16",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down
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 d190ab8

Please sign in to comment.