@modrinth/api-client 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -84,6 +84,7 @@ export declare abstract class AbstractModrinthClient extends AbstractUploadClien
84
84
  readonly launchermeta: InferredClientModules['launchermeta'];
85
85
  readonly paper: InferredClientModules['paper'];
86
86
  readonly purpur: InferredClientModules['purpur'];
87
+ readonly sharedinstances: InferredClientModules['sharedinstances'];
87
88
  constructor(config: ClientConfig);
88
89
  /**
89
90
  * This creates the nested API structure (e.g., client.labrinth.projects_v2)
@@ -1881,6 +1882,11 @@ export declare interface ClientConfig {
1881
1882
  * @default 'https://archon.modrinth.com'
1882
1883
  */
1883
1884
  archonBaseUrl?: BaseUrlConfig;
1885
+ /**
1886
+ * Base URL for the Shared Instances API
1887
+ * @default 'https://shared-instances.modrinth.com'
1888
+ */
1889
+ sharedInstancesBaseUrl?: BaseUrlConfig;
1884
1890
  /**
1885
1891
  * Default request timeout in milliseconds
1886
1892
  * @default 10000
@@ -2674,7 +2680,7 @@ export declare namespace Labrinth {
2674
2680
  thread_message_id: string;
2675
2681
  } | {
2676
2682
  context: 'report';
2677
- report_id: string;
2683
+ report_id: string | null;
2678
2684
  });
2679
2685
  export type UploadedImageFor<C extends ImageUploadContext> = Extract<UploadedImage, {
2680
2686
  context: C;
@@ -2694,7 +2700,7 @@ export declare namespace Labrinth {
2694
2700
  thread_message_id: string;
2695
2701
  } | {
2696
2702
  context: 'report';
2697
- report_id: string;
2703
+ report_id?: string;
2698
2704
  };
2699
2705
  }
2700
2706
  }
@@ -3755,6 +3761,16 @@ export declare namespace Labrinth {
3755
3761
  }
3756
3762
  }
3757
3763
  export namespace Search {
3764
+ export type SearchParams = {
3765
+ query?: string;
3766
+ offset?: string | number;
3767
+ index?: string;
3768
+ limit?: string | number;
3769
+ new_filters?: string;
3770
+ facets?: string[][];
3771
+ filters?: string;
3772
+ version?: string;
3773
+ };
3758
3774
  export namespace v2 {
3759
3775
  export interface ResultSearchProject {
3760
3776
  project_id: string;
@@ -3815,7 +3831,9 @@ export declare namespace Labrinth {
3815
3831
  featured_gallery: string | null;
3816
3832
  color: number | null;
3817
3833
  loaders: string[];
3818
- project_loader_fields?: Record<string, unknown[]>;
3834
+ project_loader_fields?: Record<string, unknown[]> & {
3835
+ environment?: Projects.v3.Environment[];
3836
+ };
3819
3837
  minecraft_server?: Projects.v3.MinecraftServer | null;
3820
3838
  minecraft_java_server?: Projects.v3.MinecraftJavaServer | null;
3821
3839
  minecraft_bedrock_server?: Projects.v3.MinecraftBedrockServer | null;
@@ -3890,12 +3908,13 @@ export declare namespace Labrinth {
3890
3908
  }
3891
3909
  export namespace Reports {
3892
3910
  export namespace v3 {
3893
- export type ItemType = 'project' | 'version' | 'user' | 'unknown';
3911
+ export type ItemType = 'project' | 'version' | 'user' | 'shared-instance' | 'unknown';
3894
3912
  export type Report = {
3895
3913
  id: string;
3896
3914
  report_type: string;
3897
3915
  item_id: string;
3898
3916
  item_type: ItemType;
3917
+ shared_instance_version_id?: number;
3899
3918
  reporter: string;
3900
3919
  body: string;
3901
3920
  created: string;
@@ -5404,6 +5423,15 @@ declare class LabrinthProjectsV3Module extends AbstractModule {
5404
5423
  * ```
5405
5424
  */
5406
5425
  getMultiple(ids: string[]): Promise<Labrinth.Projects.v3.Project[]>;
5426
+ /**
5427
+ * Search projects (v3)
5428
+ *
5429
+ * @param params - Search parameters
5430
+ * @returns Promise resolving to v3 search results
5431
+ */
5432
+ search(params: Labrinth.Search.SearchParams, options?: {
5433
+ headers?: Record<string, string>;
5434
+ }): Promise<Labrinth.Search.v3.SearchResults>;
5407
5435
  /**
5408
5436
  * Edit a project (v3)
5409
5437
  *
@@ -6396,6 +6424,10 @@ declare const MODULE_REGISTRY: {
6396
6424
  readonly labrinth_versions_v3: typeof LabrinthVersionsV3Module;
6397
6425
  readonly paper_versions_v3: typeof PaperVersionsV3Module;
6398
6426
  readonly purpur_versions_v2: typeof PurpurVersionsV2Module;
6427
+ readonly sharedinstances_invites_v1: typeof SharedInstancesInvitesV1Module;
6428
+ readonly sharedinstances_instances_v1: typeof SharedInstancesInstancesV1Module;
6429
+ readonly sharedinstances_moderation_v1: typeof SharedInstancesModerationV1Module;
6430
+ readonly sharedinstances_users_v1: typeof SharedInstancesUsersV1Module;
6399
6431
  };
6400
6432
 
6401
6433
  declare type ModuleConstructor = new (client: AbstractModrinthClient) => AbstractModule;
@@ -6729,6 +6761,7 @@ export declare type RequestOptions = {
6729
6761
  * API to use for this request
6730
6762
  * - 'labrinth': Main Modrinth API (resolves to labrinthBaseUrl)
6731
6763
  * - 'archon': Modrinth Hosting API (resolves to archonBaseUrl)
6764
+ * - 'sharedinstances': Shared Instances API (resolves to sharedInstancesBaseUrl)
6732
6765
  * - string: Custom base URL (e.g., 'https://custom-api.com')
6733
6766
  */
6734
6767
  api: 'labrinth' | 'archon' | string;
@@ -6907,6 +6940,121 @@ export declare class RetryFeature extends AbstractFeature {
6907
6940
  */
6908
6941
  export declare function setNodeAuthState(getAuth: () => NodeAuth | null, refreshAuth: () => Promise<void>): void;
6909
6942
 
6943
+ export declare namespace SharedInstances {
6944
+ export namespace Invites {
6945
+ export namespace v1 {
6946
+ export type UserManager = {
6947
+ id: string;
6948
+ name: string;
6949
+ type: 'user';
6950
+ avatar?: string | null;
6951
+ };
6952
+ export type ServerManager = {
6953
+ name: string;
6954
+ type: 'server';
6955
+ icon?: string | null;
6956
+ };
6957
+ export type Manager = UserManager | ServerManager;
6958
+ export type InviteUser = {
6959
+ id: string;
6960
+ name: string;
6961
+ avatar?: string | null;
6962
+ joined_at: string | null;
6963
+ };
6964
+ export type Invite = {
6965
+ instance_id: string;
6966
+ instance_name: string;
6967
+ instance_icon?: string | null;
6968
+ game_version: string;
6969
+ loader_version: string;
6970
+ managers: Manager[];
6971
+ instance_users?: InviteUser[];
6972
+ };
6973
+ }
6974
+ }
6975
+ export namespace Instances {
6976
+ export namespace v1 {
6977
+ export type Instance = {
6978
+ name: string;
6979
+ icon: string | null;
6980
+ quarantine: boolean;
6981
+ };
6982
+ export type JoinType = 'owner' | 'invite' | 'link';
6983
+ export type InstanceUser = {
6984
+ id: string;
6985
+ joined_at: string | null;
6986
+ join_type: JoinType;
6987
+ last_played: string | null;
6988
+ };
6989
+ export type InstanceUsers = {
6990
+ users: InstanceUser[];
6991
+ tokens: number;
6992
+ };
6993
+ export type FileMetadata = {
6994
+ path: string;
6995
+ hash: string;
6996
+ };
6997
+ export type ExternalFile = {
6998
+ file_name: string;
6999
+ file_type: string;
7000
+ url: string;
7001
+ file_size?: number;
7002
+ metadata?: FileMetadata[];
7003
+ };
7004
+ export type InstanceVersion = {
7005
+ version: number;
7006
+ modrinth_ids?: string[];
7007
+ ready: boolean;
7008
+ external_files: ExternalFile[];
7009
+ modpack_id: string | null;
7010
+ game_version: string;
7011
+ loader: string;
7012
+ loader_version: string;
7013
+ };
7014
+ }
7015
+ }
7016
+ export namespace Moderation {
7017
+ export namespace v1 {
7018
+ export type BlacklistUserRequest = {
7019
+ user_ids: string[];
7020
+ };
7021
+ }
7022
+ }
7023
+ export namespace Users {
7024
+ export namespace v1 {
7025
+ export type BlacklistStatus = {
7026
+ blacklisted: boolean;
7027
+ };
7028
+ }
7029
+ }
7030
+ }
7031
+
7032
+ declare class SharedInstancesInstancesV1Module extends AbstractModule {
7033
+ getModuleID(): string;
7034
+ get(instanceId: string): Promise<SharedInstances.Instances.v1.Instance>;
7035
+ getForUser(userId: string): Promise<string[]>;
7036
+ getUsers(instanceId: string): Promise<SharedInstances.Instances.v1.InstanceUsers>;
7037
+ getLatestVersion(instanceId: string): Promise<SharedInstances.Instances.v1.InstanceVersion>;
7038
+ getVersion(instanceId: string, version: number): Promise<SharedInstances.Instances.v1.InstanceVersion>;
7039
+ }
7040
+
7041
+ declare class SharedInstancesInvitesV1Module extends AbstractModule {
7042
+ getModuleID(): string;
7043
+ get(inviteId: string): Promise<SharedInstances.Invites.v1.Invite>;
7044
+ }
7045
+
7046
+ declare class SharedInstancesModerationV1Module extends AbstractModule {
7047
+ getModuleID(): string;
7048
+ blacklistUsers(request: SharedInstances.Moderation.v1.BlacklistUserRequest): Promise<void>;
7049
+ unblacklistUsers(request: SharedInstances.Moderation.v1.BlacklistUserRequest): Promise<void>;
7050
+ deleteFile(instanceId: string, version: number, fileName: string): Promise<void>;
7051
+ }
7052
+
7053
+ declare class SharedInstancesUsersV1Module extends AbstractModule {
7054
+ getModuleID(): string;
7055
+ getBlacklistStatus(userId: string): Promise<SharedInstances.Users.v1.BlacklistStatus>;
7056
+ }
7057
+
6910
7058
  export declare class SseParser {
6911
7059
  private buffer;
6912
7060
  private eventName;