@modrinth/api-client 0.35.0 → 0.37.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
@@ -2635,6 +2641,12 @@ export declare namespace Labrinth {
2635
2641
  export type UpdateGroupRequest = {
2636
2642
  attribution: AttributionResolution;
2637
2643
  };
2644
+ export type DeleteGroupsRequest = {
2645
+ groups: string[];
2646
+ };
2647
+ export type DeleteAllGroupsRequest = {
2648
+ project_id: string;
2649
+ };
2638
2650
  export type AssignRequest = {
2639
2651
  sha1: string;
2640
2652
  target_group_id: number;
@@ -2674,7 +2686,7 @@ export declare namespace Labrinth {
2674
2686
  thread_message_id: string;
2675
2687
  } | {
2676
2688
  context: 'report';
2677
- report_id: string;
2689
+ report_id: string | null;
2678
2690
  });
2679
2691
  export type UploadedImageFor<C extends ImageUploadContext> = Extract<UploadedImage, {
2680
2692
  context: C;
@@ -2694,7 +2706,7 @@ export declare namespace Labrinth {
2694
2706
  thread_message_id: string;
2695
2707
  } | {
2696
2708
  context: 'report';
2697
- report_id: string;
2709
+ report_id?: string;
2698
2710
  };
2699
2711
  }
2700
2712
  }
@@ -3902,12 +3914,13 @@ export declare namespace Labrinth {
3902
3914
  }
3903
3915
  export namespace Reports {
3904
3916
  export namespace v3 {
3905
- export type ItemType = 'project' | 'version' | 'user' | 'unknown';
3917
+ export type ItemType = 'project' | 'version' | 'user' | 'shared-instance' | 'unknown';
3906
3918
  export type Report = {
3907
3919
  id: string;
3908
3920
  report_type: string;
3909
3921
  item_id: string;
3910
3922
  item_type: ItemType;
3923
+ shared_instance_version_id?: number;
3911
3924
  reporter: string;
3912
3925
  body: string;
3913
3926
  created: string;
@@ -4525,12 +4538,17 @@ declare class LabrinthAttributionInternalModule extends AbstractModule {
4525
4538
  */
4526
4539
  updateGroup(groupId: string, body: Labrinth.Attribution.Internal.UpdateGroupRequest): Promise<void>;
4527
4540
  /**
4528
- * Delete an attribution group and all files inside it.
4529
- * DELETE /_internal/attribution/group/{group_id}
4541
+ * Delete attribution groups and all files inside them.
4542
+ * DELETE /_internal/attribution/group
4530
4543
  *
4531
- * @param groupId - The base62 attribution group id (as returned from listProjectAttribution).
4544
+ * @param groupIds - The base62 attribution group ids (as returned from listProjectAttribution).
4545
+ */
4546
+ deleteGroups(groupIds: string[]): Promise<void>;
4547
+ /**
4548
+ * Delete all attribution groups and files for a project.
4549
+ * DELETE /_internal/attribution/all-groups
4532
4550
  */
4533
- deleteGroup(groupId: string): Promise<void>;
4551
+ deleteAllGroups(projectId: string): Promise<void>;
4534
4552
  /**
4535
4553
  * Reassign a file (by sha1) to another attribution group within the same project.
4536
4554
  * POST /_internal/attribution/assign
@@ -6417,6 +6435,10 @@ declare const MODULE_REGISTRY: {
6417
6435
  readonly labrinth_versions_v3: typeof LabrinthVersionsV3Module;
6418
6436
  readonly paper_versions_v3: typeof PaperVersionsV3Module;
6419
6437
  readonly purpur_versions_v2: typeof PurpurVersionsV2Module;
6438
+ readonly sharedinstances_invites_v1: typeof SharedInstancesInvitesV1Module;
6439
+ readonly sharedinstances_instances_v1: typeof SharedInstancesInstancesV1Module;
6440
+ readonly sharedinstances_moderation_v1: typeof SharedInstancesModerationV1Module;
6441
+ readonly sharedinstances_users_v1: typeof SharedInstancesUsersV1Module;
6420
6442
  };
6421
6443
 
6422
6444
  declare type ModuleConstructor = new (client: AbstractModrinthClient) => AbstractModule;
@@ -6750,6 +6772,7 @@ export declare type RequestOptions = {
6750
6772
  * API to use for this request
6751
6773
  * - 'labrinth': Main Modrinth API (resolves to labrinthBaseUrl)
6752
6774
  * - 'archon': Modrinth Hosting API (resolves to archonBaseUrl)
6775
+ * - 'sharedinstances': Shared Instances API (resolves to sharedInstancesBaseUrl)
6753
6776
  * - string: Custom base URL (e.g., 'https://custom-api.com')
6754
6777
  */
6755
6778
  api: 'labrinth' | 'archon' | string;
@@ -6928,6 +6951,121 @@ export declare class RetryFeature extends AbstractFeature {
6928
6951
  */
6929
6952
  export declare function setNodeAuthState(getAuth: () => NodeAuth | null, refreshAuth: () => Promise<void>): void;
6930
6953
 
6954
+ export declare namespace SharedInstances {
6955
+ export namespace Invites {
6956
+ export namespace v1 {
6957
+ export type UserManager = {
6958
+ id: string;
6959
+ name: string;
6960
+ type: 'user';
6961
+ avatar?: string | null;
6962
+ };
6963
+ export type ServerManager = {
6964
+ name: string;
6965
+ type: 'server';
6966
+ icon?: string | null;
6967
+ };
6968
+ export type Manager = UserManager | ServerManager;
6969
+ export type InviteUser = {
6970
+ id: string;
6971
+ name: string;
6972
+ avatar?: string | null;
6973
+ joined_at: string | null;
6974
+ };
6975
+ export type Invite = {
6976
+ instance_id: string;
6977
+ instance_name: string;
6978
+ instance_icon?: string | null;
6979
+ game_version: string;
6980
+ loader_version: string;
6981
+ managers: Manager[];
6982
+ instance_users?: InviteUser[];
6983
+ };
6984
+ }
6985
+ }
6986
+ export namespace Instances {
6987
+ export namespace v1 {
6988
+ export type Instance = {
6989
+ name: string;
6990
+ icon: string | null;
6991
+ quarantine: boolean;
6992
+ };
6993
+ export type JoinType = 'owner' | 'invite' | 'link';
6994
+ export type InstanceUser = {
6995
+ id: string;
6996
+ joined_at: string | null;
6997
+ join_type: JoinType;
6998
+ last_played: string | null;
6999
+ };
7000
+ export type InstanceUsers = {
7001
+ users: InstanceUser[];
7002
+ tokens: number;
7003
+ };
7004
+ export type FileMetadata = {
7005
+ path: string;
7006
+ hash: string;
7007
+ };
7008
+ export type ExternalFile = {
7009
+ file_name: string;
7010
+ file_type: string;
7011
+ url: string;
7012
+ file_size?: number;
7013
+ metadata?: FileMetadata[];
7014
+ };
7015
+ export type InstanceVersion = {
7016
+ version: number;
7017
+ modrinth_ids?: string[];
7018
+ ready: boolean;
7019
+ external_files: ExternalFile[];
7020
+ modpack_id: string | null;
7021
+ game_version: string;
7022
+ loader: string;
7023
+ loader_version: string;
7024
+ };
7025
+ }
7026
+ }
7027
+ export namespace Moderation {
7028
+ export namespace v1 {
7029
+ export type BlacklistUserRequest = {
7030
+ user_ids: string[];
7031
+ };
7032
+ }
7033
+ }
7034
+ export namespace Users {
7035
+ export namespace v1 {
7036
+ export type BlacklistStatus = {
7037
+ blacklisted: boolean;
7038
+ };
7039
+ }
7040
+ }
7041
+ }
7042
+
7043
+ declare class SharedInstancesInstancesV1Module extends AbstractModule {
7044
+ getModuleID(): string;
7045
+ get(instanceId: string): Promise<SharedInstances.Instances.v1.Instance>;
7046
+ getForUser(userId: string): Promise<string[]>;
7047
+ getUsers(instanceId: string): Promise<SharedInstances.Instances.v1.InstanceUsers>;
7048
+ getLatestVersion(instanceId: string): Promise<SharedInstances.Instances.v1.InstanceVersion>;
7049
+ getVersion(instanceId: string, version: number): Promise<SharedInstances.Instances.v1.InstanceVersion>;
7050
+ }
7051
+
7052
+ declare class SharedInstancesInvitesV1Module extends AbstractModule {
7053
+ getModuleID(): string;
7054
+ get(inviteId: string): Promise<SharedInstances.Invites.v1.Invite>;
7055
+ }
7056
+
7057
+ declare class SharedInstancesModerationV1Module extends AbstractModule {
7058
+ getModuleID(): string;
7059
+ blacklistUsers(request: SharedInstances.Moderation.v1.BlacklistUserRequest): Promise<void>;
7060
+ unblacklistUsers(request: SharedInstances.Moderation.v1.BlacklistUserRequest): Promise<void>;
7061
+ deleteFile(instanceId: string, version: number, fileName: string): Promise<void>;
7062
+ }
7063
+
7064
+ declare class SharedInstancesUsersV1Module extends AbstractModule {
7065
+ getModuleID(): string;
7066
+ getBlacklistStatus(userId: string): Promise<SharedInstances.Users.v1.BlacklistStatus>;
7067
+ }
7068
+
6931
7069
  export declare class SseParser {
6932
7070
  private buffer;
6933
7071
  private eventName;