diff --git a/docs/Api/ModsApi.md b/docs/Api/ModsApi.md index 11cbe87..da9856f 100644 --- a/docs/Api/ModsApi.md +++ b/docs/Api/ModsApi.md @@ -268,7 +268,7 @@ try { ## `searchMods()` ```php -searchMods($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type): \Aternos\CurseForgeApi\Model\SearchModsResponse +searchMods($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size): \Aternos\CurseForgeApi\Model\SearchModsResponse ``` Get all mods that match the search criteria. @@ -296,25 +296,27 @@ $apiInstance = new Aternos\CurseForgeApi\Api\ModsApi( ); $game_id = 56; // int | Filter by game id. $index = 56; // int | A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). -$page_size = 56; // int | The number of items to include in the response, the default/maximum value is 50. $class_id = 56; // int | Filter by section id (discoverable via Categories) $category_id = 56; // int | Filter by category id +$category_ids = 'category_ids_example'; // string | Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 $game_version = 'game_version_example'; // string | Filter by game version string +$game_versions = 'game_versions_example'; // string | Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 $search_filter = 'search_filter_example'; // string | Filter by free text search in the mod name and author -$sort_field = new \Aternos\CurseForgeApi\Model\\Aternos\CurseForgeApi\Model\ModSearchSortField(); // \Aternos\CurseForgeApi\Model\ModSearchSortField | Filter by ModsSearchSortField enumeration +$sort_field = new \Aternos\CurseForgeApi\Model\\Aternos\CurseForgeApi\Model\ModsSearchSortField(); // \Aternos\CurseForgeApi\Model\ModsSearchSortField | Filter by ModsSearchSortField enumeration $sort_order = new \Aternos\CurseForgeApi\Model\\Aternos\CurseForgeApi\Model\SortOrder(); // \Aternos\CurseForgeApi\Model\SortOrder | 'asc' if sort is in ascending order, 'desc' if sort is in descending order $mod_loader_type = new \Aternos\CurseForgeApi\Model\\Aternos\CurseForgeApi\Model\ModLoaderType(); // \Aternos\CurseForgeApi\Model\ModLoaderType | Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. +$mod_loader_types = 'mod_loader_types_example'; // string | Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 $game_version_type_id = 56; // int | Filter only mods that contain files tagged with versions of the given gameVersionTypeId $author_id = 56; // int | Filter only mods that the given authorId is a member of. -$slug = 'slug_example'; // string | Filter by slug (coupled with classId will result in a unique result). -$category_ids = 'category_ids_example'; // string | Filter by a list of category ids. this will override categoryId. Limited to 10 items. -$game_versions = 'game_versions_example'; // string | Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. -$mod_loader_types = 'mod_loader_types_example'; // string | Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. $primary_author_id = 56; // int | Filter only mods that the given primaryAuthorId is the owner of. $premium_type = new \Aternos\CurseForgeApi\Model\\Aternos\CurseForgeApi\Model\PremiumType(); // \Aternos\CurseForgeApi\Model\PremiumType | Filter only mods that are Premium or not. +$slug = 'slug_example'; // string | Filter by slug (coupled with classId will result in a unique result). +$client_compatible = True; // bool | When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). +$mods_search_enhanced_features = 56; // int | Bitwise number with values from ModsSearchEnhancedFeatures +$page_size = 56; // int | The number of items to include in the response, the default/maximum value is 50. try { - $result = $apiInstance->searchMods($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type); + $result = $apiInstance->searchMods($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size); print_r($result); } catch (Exception $e) { echo 'Exception when calling ModsApi->searchMods: ', $e->getMessage(), PHP_EOL; @@ -327,22 +329,24 @@ try { | ------------- | ------------- | ------------- | ------------- | | **game_id** | **int**| Filter by game id. | | | **index** | **int**| A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). | [optional] | -| **page_size** | **int**| The number of items to include in the response, the default/maximum value is 50. | [optional] | | **class_id** | **int**| Filter by section id (discoverable via Categories) | [optional] | | **category_id** | **int**| Filter by category id | [optional] | +| **category_ids** | **string**| Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 | [optional] | | **game_version** | **string**| Filter by game version string | [optional] | +| **game_versions** | **string**| Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 | [optional] | | **search_filter** | **string**| Filter by free text search in the mod name and author | [optional] | -| **sort_field** | [**\Aternos\CurseForgeApi\Model\ModSearchSortField**](../Model/.md)| Filter by ModsSearchSortField enumeration | [optional] | +| **sort_field** | [**\Aternos\CurseForgeApi\Model\ModsSearchSortField**](../Model/.md)| Filter by ModsSearchSortField enumeration | [optional] | | **sort_order** | [**\Aternos\CurseForgeApi\Model\SortOrder**](../Model/.md)| 'asc' if sort is in ascending order, 'desc' if sort is in descending order | [optional] | | **mod_loader_type** | [**\Aternos\CurseForgeApi\Model\ModLoaderType**](../Model/.md)| Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. | [optional] | +| **mod_loader_types** | **string**| Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 | [optional] | | **game_version_type_id** | **int**| Filter only mods that contain files tagged with versions of the given gameVersionTypeId | [optional] | | **author_id** | **int**| Filter only mods that the given authorId is a member of. | [optional] | -| **slug** | **string**| Filter by slug (coupled with classId will result in a unique result). | [optional] | -| **category_ids** | **string**| Filter by a list of category ids. this will override categoryId. Limited to 10 items. | [optional] | -| **game_versions** | **string**| Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. | [optional] | -| **mod_loader_types** | **string**| Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. | [optional] | | **primary_author_id** | **int**| Filter only mods that the given primaryAuthorId is the owner of. | [optional] | | **premium_type** | [**\Aternos\CurseForgeApi\Model\PremiumType**](../Model/.md)| Filter only mods that are Premium or not. | [optional] | +| **slug** | **string**| Filter by slug (coupled with classId will result in a unique result). | [optional] | +| **client_compatible** | **bool**| When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). | [optional] | +| **mods_search_enhanced_features** | **int**| Bitwise number with values from ModsSearchEnhancedFeatures | [optional] | +| **page_size** | **int**| The number of items to include in the response, the default/maximum value is 50. | [optional] | ### Return type diff --git a/docs/Model/ModSearchSortField.md b/docs/Model/ModsSearchSortField.md similarity index 91% rename from docs/Model/ModSearchSortField.md rename to docs/Model/ModsSearchSortField.md index 8879cd7..6ac4e05 100644 --- a/docs/Model/ModSearchSortField.md +++ b/docs/Model/ModsSearchSortField.md @@ -1,4 +1,4 @@ -# # ModSearchSortField +# # ModsSearchSortField ## Properties diff --git a/openapi.yaml b/openapi.yaml index 19dbebc..52fa70b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -245,15 +245,6 @@ paths: schema: type: integer format: int32 - - name: pageSize - in: query - description: >- - The number of items to include in the response, the default/maximum - value is 50. - required: false - schema: - type: integer - format: int32 - name: classId in: query description: Filter by section id (discoverable via Categories) @@ -268,12 +259,28 @@ paths: schema: type: integer format: int32 + - name: categoryIds + in: query + description: >- + Filter by a list of category ids - this will override categoryId + categoryIds=[1,2,3...] + The maximum allowed category ids per query is 10 + schema: + type: string - name: gameVersion in: query description: Filter by game version string required: false schema: type: string + - name: gameVersions + in: query + description: >- + Filter by a list of game version strings - this will override gameVersion + gameVersions=["1.19.1", "1.19.2", "1.20.1"...] + The maximum allowed category ids per query is 4 + schema: + type: string - name: searchFilter in: query description: Filter by free text search in the mod name and author @@ -285,7 +292,7 @@ paths: description: Filter by ModsSearchSortField enumeration required: false schema: - $ref: '#/components/schemas/ModSearchSortField' + $ref: '#/components/schemas/ModsSearchSortField' - name: sortOrder in: query description: > @@ -301,7 +308,17 @@ paths: ...). Must be coupled with gameVersion. required: false schema: + nullable: true $ref: '#/components/schemas/ModLoaderType' + - name: modLoaderTypes + in: query + description: >- + Filter by a list of mod loader types - this will override modLoaderType + modLoaderTypes=[Forge,Fabric, ...] + Max values = 5 + schema: + # Setting type to array is not possible here because CurseForge uses a non-standard representation. + type: string - name: gameVersionTypeId in: query description: >- @@ -311,56 +328,57 @@ paths: schema: type: integer format: int32 + nullable: true - name: authorId in: query - description: >- - Filter only mods that the given authorId is a member of. + description: Filter only mods that the given authorId is a member of. required: false schema: type: integer format: int32 - - name: slug + nullable: true + - name: primaryAuthorId in: query - description: >- - Filter by slug (coupled with classId will result in a unique - result). + description: Filter only mods that the given primaryAuthorId is the owner of. required: false schema: - type: string - - name: categoryIds + type: integer + format: int32 + nullable: true + - name: PremiumType in: query - description: Filter by a list of category ids. this will override categoryId. Limited to 10 items. + description: Filter only mods that are Premium or not. required: false schema: - # Setting type to array is not possible here because CurseForge uses a non-standard representation. - type: string - - name: gameVersions + $ref: '#/components/schemas/PremiumType' + - name: slug in: query - description: Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. - required: false + description: >- + Filter by slug (coupled with classId will result in a unique + result). schema: - # Setting type to array is not possible here because CurseForge uses a non-standard representation. type: string - - name: modLoaderTypes + - name: clientCompatible in: query - description: Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. - required: false + description: |- + When set to true, will filter out any mod that doesn't have a default + file that is compatible with the client. This is usually due to a bad + file structure of the file (which might cause unexpected behaviours on + the user's machine - such as overriding other mods installed). schema: - # Setting type to array is not possible here because CurseForge uses a non-standard representation. - type: string - - name: primaryAuthorId + type: boolean + - name: modsSearchEnhancedFeatures in: query - description: Filter only mods that the given primaryAuthorId is the owner of. - required: false + description: Bitwise number with values from ModsSearchEnhancedFeatures schema: type: integer - format: int32 - - name: PremiumType + format: int64 + - name: pageSize in: query - description: Filter only mods that are Premium or not. - required: false + description: The number of items to include in the response, the default/maximum value is 50. schema: - $ref: '#/components/schemas/PremiumType' + type: integer + format: int32 responses: '200': description: OK @@ -2043,7 +2061,7 @@ components: - Fabric - Quilt - NeoForge - ModSearchSortField: + ModsSearchSortField: description: | Possible enum values: * 1 = Featured diff --git a/src/Api/ModsApi.php b/src/Api/ModsApi.php index 06455c9..782ec86 100644 --- a/src/Api/ModsApi.php +++ b/src/Api/ModsApi.php @@ -1342,22 +1342,24 @@ public function getModsRequest( * * @param int $game_id Filter by game id. (required) * @param int|null $index A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). (optional) - * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param int|null $class_id Filter by section id (discoverable via Categories) (optional) * @param int|null $category_id Filter by category id (optional) + * @param string|null $category_ids Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 (optional) * @param string|null $game_version Filter by game version string (optional) + * @param string|null $game_versions Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 (optional) * @param string|null $search_filter Filter by free text search in the mod name and author (optional) - * @param \Aternos\CurseForgeApi\Model\ModSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) + * @param \Aternos\CurseForgeApi\Model\ModsSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) * @param \Aternos\CurseForgeApi\Model\SortOrder|null $sort_order 'asc' if sort is in ascending order, 'desc' if sort is in descending order (optional) * @param \Aternos\CurseForgeApi\Model\ModLoaderType|null $mod_loader_type Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. (optional) + * @param string|null $mod_loader_types Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 (optional) * @param int|null $game_version_type_id Filter only mods that contain files tagged with versions of the given gameVersionTypeId (optional) * @param int|null $author_id Filter only mods that the given authorId is a member of. (optional) - * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) - * @param string|null $category_ids Filter by a list of category ids. this will override categoryId. Limited to 10 items. (optional) - * @param string|null $game_versions Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. (optional) - * @param string|null $mod_loader_types Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. (optional) * @param int|null $primary_author_id Filter only mods that the given primaryAuthorId is the owner of. (optional) * @param \Aternos\CurseForgeApi\Model\PremiumType|null $premium_type Filter only mods that are Premium or not. (optional) + * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) + * @param bool|null $client_compatible When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). (optional) + * @param int|null $mods_search_enhanced_features Bitwise number with values from ModsSearchEnhancedFeatures (optional) + * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchMods'] to see the possible values for this operation * * @throws ApiException on non-2xx response or if the response body is not in the expected format @@ -1367,26 +1369,28 @@ public function getModsRequest( public function searchMods( int $game_id, ?int $index = null, - ?int $page_size = null, ?int $class_id = null, ?int $category_id = null, + ?string $category_ids = null, ?string $game_version = null, + ?string $game_versions = null, ?string $search_filter = null, - ?\Aternos\CurseForgeApi\Model\ModSearchSortField $sort_field = null, + ?\Aternos\CurseForgeApi\Model\ModsSearchSortField $sort_field = null, ?\Aternos\CurseForgeApi\Model\SortOrder $sort_order = null, ?\Aternos\CurseForgeApi\Model\ModLoaderType $mod_loader_type = null, + ?string $mod_loader_types = null, ?int $game_version_type_id = null, ?int $author_id = null, - ?string $slug = null, - ?string $category_ids = null, - ?string $game_versions = null, - ?string $mod_loader_types = null, ?int $primary_author_id = null, ?\Aternos\CurseForgeApi\Model\PremiumType $premium_type = null, + ?string $slug = null, + ?bool $client_compatible = null, + ?int $mods_search_enhanced_features = null, + ?int $page_size = null, string $contentType = self::contentTypes['searchMods'][0] ): \Aternos\CurseForgeApi\Model\SearchModsResponse { - list($response) = $this->searchModsWithHttpInfo($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type, $contentType); + list($response) = $this->searchModsWithHttpInfo($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size, $contentType); return $response; } @@ -1397,22 +1401,24 @@ public function searchMods( * * @param int $game_id Filter by game id. (required) * @param int|null $index A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). (optional) - * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param int|null $class_id Filter by section id (discoverable via Categories) (optional) * @param int|null $category_id Filter by category id (optional) + * @param string|null $category_ids Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 (optional) * @param string|null $game_version Filter by game version string (optional) + * @param string|null $game_versions Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 (optional) * @param string|null $search_filter Filter by free text search in the mod name and author (optional) - * @param \Aternos\CurseForgeApi\Model\ModSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) + * @param \Aternos\CurseForgeApi\Model\ModsSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) * @param \Aternos\CurseForgeApi\Model\SortOrder|null $sort_order 'asc' if sort is in ascending order, 'desc' if sort is in descending order (optional) * @param \Aternos\CurseForgeApi\Model\ModLoaderType|null $mod_loader_type Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. (optional) + * @param string|null $mod_loader_types Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 (optional) * @param int|null $game_version_type_id Filter only mods that contain files tagged with versions of the given gameVersionTypeId (optional) * @param int|null $author_id Filter only mods that the given authorId is a member of. (optional) - * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) - * @param string|null $category_ids Filter by a list of category ids. this will override categoryId. Limited to 10 items. (optional) - * @param string|null $game_versions Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. (optional) - * @param string|null $mod_loader_types Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. (optional) * @param int|null $primary_author_id Filter only mods that the given primaryAuthorId is the owner of. (optional) * @param \Aternos\CurseForgeApi\Model\PremiumType|null $premium_type Filter only mods that are Premium or not. (optional) + * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) + * @param bool|null $client_compatible When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). (optional) + * @param int|null $mods_search_enhanced_features Bitwise number with values from ModsSearchEnhancedFeatures (optional) + * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchMods'] to see the possible values for this operation * * @throws ApiException on non-2xx response or if the response body is not in the expected format @@ -1422,26 +1428,28 @@ public function searchMods( public function searchModsWithHttpInfo( int $game_id, ?int $index = null, - ?int $page_size = null, ?int $class_id = null, ?int $category_id = null, + ?string $category_ids = null, ?string $game_version = null, + ?string $game_versions = null, ?string $search_filter = null, - ?\Aternos\CurseForgeApi\Model\ModSearchSortField $sort_field = null, + ?\Aternos\CurseForgeApi\Model\ModsSearchSortField $sort_field = null, ?\Aternos\CurseForgeApi\Model\SortOrder $sort_order = null, ?\Aternos\CurseForgeApi\Model\ModLoaderType $mod_loader_type = null, + ?string $mod_loader_types = null, ?int $game_version_type_id = null, ?int $author_id = null, - ?string $slug = null, - ?string $category_ids = null, - ?string $game_versions = null, - ?string $mod_loader_types = null, ?int $primary_author_id = null, ?\Aternos\CurseForgeApi\Model\PremiumType $premium_type = null, + ?string $slug = null, + ?bool $client_compatible = null, + ?int $mods_search_enhanced_features = null, + ?int $page_size = null, string $contentType = self::contentTypes['searchMods'][0] ): array { - $request = $this->searchModsRequest($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type, $contentType); + $request = $this->searchModsRequest($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size, $contentType); try { $options = $this->createHttpClientOption(); @@ -1516,22 +1524,24 @@ public function searchModsWithHttpInfo( * * @param int $game_id Filter by game id. (required) * @param int|null $index A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). (optional) - * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param int|null $class_id Filter by section id (discoverable via Categories) (optional) * @param int|null $category_id Filter by category id (optional) + * @param string|null $category_ids Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 (optional) * @param string|null $game_version Filter by game version string (optional) + * @param string|null $game_versions Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 (optional) * @param string|null $search_filter Filter by free text search in the mod name and author (optional) - * @param \Aternos\CurseForgeApi\Model\ModSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) + * @param \Aternos\CurseForgeApi\Model\ModsSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) * @param \Aternos\CurseForgeApi\Model\SortOrder|null $sort_order 'asc' if sort is in ascending order, 'desc' if sort is in descending order (optional) * @param \Aternos\CurseForgeApi\Model\ModLoaderType|null $mod_loader_type Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. (optional) + * @param string|null $mod_loader_types Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 (optional) * @param int|null $game_version_type_id Filter only mods that contain files tagged with versions of the given gameVersionTypeId (optional) * @param int|null $author_id Filter only mods that the given authorId is a member of. (optional) - * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) - * @param string|null $category_ids Filter by a list of category ids. this will override categoryId. Limited to 10 items. (optional) - * @param string|null $game_versions Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. (optional) - * @param string|null $mod_loader_types Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. (optional) * @param int|null $primary_author_id Filter only mods that the given primaryAuthorId is the owner of. (optional) * @param \Aternos\CurseForgeApi\Model\PremiumType|null $premium_type Filter only mods that are Premium or not. (optional) + * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) + * @param bool|null $client_compatible When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). (optional) + * @param int|null $mods_search_enhanced_features Bitwise number with values from ModsSearchEnhancedFeatures (optional) + * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchMods'] to see the possible values for this operation * * @throws InvalidArgumentException @@ -1540,26 +1550,28 @@ public function searchModsWithHttpInfo( public function searchModsAsync( int $game_id, ?int $index = null, - ?int $page_size = null, ?int $class_id = null, ?int $category_id = null, + ?string $category_ids = null, ?string $game_version = null, + ?string $game_versions = null, ?string $search_filter = null, - ?\Aternos\CurseForgeApi\Model\ModSearchSortField $sort_field = null, + ?\Aternos\CurseForgeApi\Model\ModsSearchSortField $sort_field = null, ?\Aternos\CurseForgeApi\Model\SortOrder $sort_order = null, ?\Aternos\CurseForgeApi\Model\ModLoaderType $mod_loader_type = null, + ?string $mod_loader_types = null, ?int $game_version_type_id = null, ?int $author_id = null, - ?string $slug = null, - ?string $category_ids = null, - ?string $game_versions = null, - ?string $mod_loader_types = null, ?int $primary_author_id = null, ?\Aternos\CurseForgeApi\Model\PremiumType $premium_type = null, + ?string $slug = null, + ?bool $client_compatible = null, + ?int $mods_search_enhanced_features = null, + ?int $page_size = null, string $contentType = self::contentTypes['searchMods'][0] ): PromiseInterface { - return $this->searchModsAsyncWithHttpInfo($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type, $contentType) + return $this->searchModsAsyncWithHttpInfo($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -1574,22 +1586,24 @@ function ($response) { * * @param int $game_id Filter by game id. (required) * @param int|null $index A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). (optional) - * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param int|null $class_id Filter by section id (discoverable via Categories) (optional) * @param int|null $category_id Filter by category id (optional) + * @param string|null $category_ids Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 (optional) * @param string|null $game_version Filter by game version string (optional) + * @param string|null $game_versions Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 (optional) * @param string|null $search_filter Filter by free text search in the mod name and author (optional) - * @param \Aternos\CurseForgeApi\Model\ModSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) + * @param \Aternos\CurseForgeApi\Model\ModsSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) * @param \Aternos\CurseForgeApi\Model\SortOrder|null $sort_order 'asc' if sort is in ascending order, 'desc' if sort is in descending order (optional) * @param \Aternos\CurseForgeApi\Model\ModLoaderType|null $mod_loader_type Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. (optional) + * @param string|null $mod_loader_types Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 (optional) * @param int|null $game_version_type_id Filter only mods that contain files tagged with versions of the given gameVersionTypeId (optional) * @param int|null $author_id Filter only mods that the given authorId is a member of. (optional) - * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) - * @param string|null $category_ids Filter by a list of category ids. this will override categoryId. Limited to 10 items. (optional) - * @param string|null $game_versions Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. (optional) - * @param string|null $mod_loader_types Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. (optional) * @param int|null $primary_author_id Filter only mods that the given primaryAuthorId is the owner of. (optional) * @param \Aternos\CurseForgeApi\Model\PremiumType|null $premium_type Filter only mods that are Premium or not. (optional) + * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) + * @param bool|null $client_compatible When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). (optional) + * @param int|null $mods_search_enhanced_features Bitwise number with values from ModsSearchEnhancedFeatures (optional) + * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchMods'] to see the possible values for this operation * * @throws InvalidArgumentException @@ -1598,27 +1612,29 @@ function ($response) { public function searchModsAsyncWithHttpInfo( int $game_id, ?int $index = null, - ?int $page_size = null, ?int $class_id = null, ?int $category_id = null, + ?string $category_ids = null, ?string $game_version = null, + ?string $game_versions = null, ?string $search_filter = null, - ?\Aternos\CurseForgeApi\Model\ModSearchSortField $sort_field = null, + ?\Aternos\CurseForgeApi\Model\ModsSearchSortField $sort_field = null, ?\Aternos\CurseForgeApi\Model\SortOrder $sort_order = null, ?\Aternos\CurseForgeApi\Model\ModLoaderType $mod_loader_type = null, + ?string $mod_loader_types = null, ?int $game_version_type_id = null, ?int $author_id = null, - ?string $slug = null, - ?string $category_ids = null, - ?string $game_versions = null, - ?string $mod_loader_types = null, ?int $primary_author_id = null, ?\Aternos\CurseForgeApi\Model\PremiumType $premium_type = null, + ?string $slug = null, + ?bool $client_compatible = null, + ?int $mods_search_enhanced_features = null, + ?int $page_size = null, string $contentType = self::contentTypes['searchMods'][0] ): PromiseInterface { $returnType = '\Aternos\CurseForgeApi\Model\SearchModsResponse'; - $request = $this->searchModsRequest($game_id, $index, $page_size, $class_id, $category_id, $game_version, $search_filter, $sort_field, $sort_order, $mod_loader_type, $game_version_type_id, $author_id, $slug, $category_ids, $game_versions, $mod_loader_types, $primary_author_id, $premium_type, $contentType); + $request = $this->searchModsRequest($game_id, $index, $class_id, $category_id, $category_ids, $game_version, $game_versions, $search_filter, $sort_field, $sort_order, $mod_loader_type, $mod_loader_types, $game_version_type_id, $author_id, $primary_author_id, $premium_type, $slug, $client_compatible, $mods_search_enhanced_features, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1661,22 +1677,24 @@ function ($exception) { * * @param int $game_id Filter by game id. (required) * @param int|null $index A zero based index of the first item to include in the response, the limit is: (index + pageSize <= 10,000). (optional) - * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param int|null $class_id Filter by section id (discoverable via Categories) (optional) * @param int|null $category_id Filter by category id (optional) + * @param string|null $category_ids Filter by a list of category ids - this will override categoryId categoryIds=[1,2,3...] The maximum allowed category ids per query is 10 (optional) * @param string|null $game_version Filter by game version string (optional) + * @param string|null $game_versions Filter by a list of game version strings - this will override gameVersion gameVersions=[\"1.19.1\", \"1.19.2\", \"1.20.1\"...] The maximum allowed category ids per query is 4 (optional) * @param string|null $search_filter Filter by free text search in the mod name and author (optional) - * @param \Aternos\CurseForgeApi\Model\ModSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) + * @param \Aternos\CurseForgeApi\Model\ModsSearchSortField|null $sort_field Filter by ModsSearchSortField enumeration (optional) * @param \Aternos\CurseForgeApi\Model\SortOrder|null $sort_order 'asc' if sort is in ascending order, 'desc' if sort is in descending order (optional) * @param \Aternos\CurseForgeApi\Model\ModLoaderType|null $mod_loader_type Filter only mods associated to a given modloader (Forge, Fabric ...). Must be coupled with gameVersion. (optional) + * @param string|null $mod_loader_types Filter by a list of mod loader types - this will override modLoaderType modLoaderTypes=[Forge,Fabric, ...] Max values = 5 (optional) * @param int|null $game_version_type_id Filter only mods that contain files tagged with versions of the given gameVersionTypeId (optional) * @param int|null $author_id Filter only mods that the given authorId is a member of. (optional) - * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) - * @param string|null $category_ids Filter by a list of category ids. this will override categoryId. Limited to 10 items. (optional) - * @param string|null $game_versions Filter by a list of game version strings. This will override gameVersion. Limited to 4 items. (optional) - * @param string|null $mod_loader_types Filter by a list of modloader types. This will override modLoaderType. Limited to 5 items. (optional) * @param int|null $primary_author_id Filter only mods that the given primaryAuthorId is the owner of. (optional) * @param \Aternos\CurseForgeApi\Model\PremiumType|null $premium_type Filter only mods that are Premium or not. (optional) + * @param string|null $slug Filter by slug (coupled with classId will result in a unique result). (optional) + * @param bool|null $client_compatible When set to true, will filter out any mod that doesn't have a default file that is compatible with the client. This is usually due to a bad file structure of the file (which might cause unexpected behaviours on the user's machine - such as overriding other mods installed). (optional) + * @param int|null $mods_search_enhanced_features Bitwise number with values from ModsSearchEnhancedFeatures (optional) + * @param int|null $page_size The number of items to include in the response, the default/maximum value is 50. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchMods'] to see the possible values for this operation * * @throws InvalidArgumentException @@ -1685,22 +1703,24 @@ function ($exception) { public function searchModsRequest( int $game_id, ?int $index = null, - ?int $page_size = null, ?int $class_id = null, ?int $category_id = null, + ?string $category_ids = null, ?string $game_version = null, + ?string $game_versions = null, ?string $search_filter = null, - ?\Aternos\CurseForgeApi\Model\ModSearchSortField $sort_field = null, + ?\Aternos\CurseForgeApi\Model\ModsSearchSortField $sort_field = null, ?\Aternos\CurseForgeApi\Model\SortOrder $sort_order = null, ?\Aternos\CurseForgeApi\Model\ModLoaderType $mod_loader_type = null, + ?string $mod_loader_types = null, ?int $game_version_type_id = null, ?int $author_id = null, - ?string $slug = null, - ?string $category_ids = null, - ?string $game_versions = null, - ?string $mod_loader_types = null, ?int $primary_author_id = null, ?\Aternos\CurseForgeApi\Model\PremiumType $premium_type = null, + ?string $slug = null, + ?bool $client_compatible = null, + ?int $mods_search_enhanced_features = null, + ?int $page_size = null, string $contentType = self::contentTypes['searchMods'][0] ): Request { @@ -1729,6 +1749,8 @@ public function searchModsRequest( + + $resourcePath = '/v1/mods/search'; $formParams = []; @@ -1757,8 +1779,8 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $page_size, - 'pageSize', // param base name + $class_id, + 'classId', // param base name 'integer', // openApiType 'form', // style true, // explode @@ -1766,8 +1788,8 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $class_id, - 'classId', // param base name + $category_id, + 'categoryId', // param base name 'integer', // openApiType 'form', // style true, // explode @@ -1775,9 +1797,9 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $category_id, - 'categoryId', // param base name - 'integer', // openApiType + $category_ids, + 'categoryIds', // param base name + 'string', // openApiType 'form', // style true, // explode false // required @@ -1792,6 +1814,15 @@ public function searchModsRequest( false // required ) ?? []); // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $game_versions, + 'gameVersions', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $search_filter, 'searchFilter', // param base name @@ -1804,7 +1835,7 @@ public function searchModsRequest( $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $sort_field?->value, 'sortField', // param base name - 'ModSearchSortField', // openApiType + 'ModsSearchSortField', // openApiType 'form', // style true, // explode false // required @@ -1828,6 +1859,15 @@ public function searchModsRequest( false // required ) ?? []); // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $mod_loader_types, + 'modLoaderTypes', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $game_version_type_id, 'gameVersionTypeId', // param base name @@ -1847,26 +1887,26 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $slug, - 'slug', // param base name - 'string', // openApiType + $primary_author_id, + 'primaryAuthorId', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $category_ids, - 'categoryIds', // param base name - 'string', // openApiType + $premium_type?->value, + 'PremiumType', // param base name + 'PremiumType', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $game_versions, - 'gameVersions', // param base name + $slug, + 'slug', // param base name 'string', // openApiType 'form', // style true, // explode @@ -1874,17 +1914,17 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $mod_loader_types, - 'modLoaderTypes', // param base name - 'string', // openApiType + $client_compatible, + 'clientCompatible', // param base name + 'boolean', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $primary_author_id, - 'primaryAuthorId', // param base name + $mods_search_enhanced_features, + 'modsSearchEnhancedFeatures', // param base name 'integer', // openApiType 'form', // style true, // explode @@ -1892,9 +1932,9 @@ public function searchModsRequest( ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $premium_type?->value, - 'PremiumType', // param base name - 'PremiumType', // openApiType + $page_size, + 'pageSize', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required diff --git a/src/Client/CurseForgeAPIClient.php b/src/Client/CurseForgeAPIClient.php index 18656d2..9bcfe3c 100644 --- a/src/Client/CurseForgeAPIClient.php +++ b/src/Client/CurseForgeAPIClient.php @@ -233,26 +233,29 @@ public function getCategory(int $gameId, int $categoryId): ?Category */ public function searchMods(ModSearchOptions $options): PaginatedModList { - return new PaginatedModList($this, $this->mods->searchMods( - $options->getGameId(), - $options->getOffset(), - PaginatedModList::getAllowedPageSize($options->getOffset(), $options->getPageSize()), - $options->getClassId(), - null, - null, - $options->getSearchFilter(), - $options->getSortField(), - $options->getSortOrder(), - null, - $options->getGameVersionTypeId(), - $options->getAuthorId(), - $options->getSlug(), - $options->getEncodedCategoryIds(), - $options->getEncodedGameVersions(), - $options->getEncodedModLoaderTypes(), - $options->getPrimaryAuthorId(), - $options->getPremiumType(), - ), $options); + $response = $this->mods->searchMods( + game_id: $options->getGameId(), + index: $options->getOffset(), + class_id: $options->getClassId(), + category_id: null, + category_ids: $options->getEncodedCategoryIds(), + game_version: null, + game_versions: $options->getEncodedGameVersions(), + search_filter: $options->getSearchFilter(), + sort_field: $options->getSortField(), + sort_order: $options->getSortOrder(), + mod_loader_type: null, + mod_loader_types: $options->getEncodedModLoaderTypes(), + game_version_type_id: $options->getGameVersionTypeId(), + author_id: $options->getAuthorId(), + primary_author_id: $options->getPrimaryAuthorId(), + premium_type: $options->getPremiumType(), + slug: $options->getSlug(), + client_compatible: null, + mods_search_enhanced_features: null, + page_size: PaginatedModList::getAllowedPageSize($options->getOffset(), $options->getPageSize()) + ); + return new PaginatedModList($this, $response, $options); } /** diff --git a/src/Client/Options/ModSearchOptions.php b/src/Client/Options/ModSearchOptions.php index 294c5aa..99d0147 100644 --- a/src/Client/Options/ModSearchOptions.php +++ b/src/Client/Options/ModSearchOptions.php @@ -4,7 +4,7 @@ use Aternos\CurseForgeApi\Client\List\PaginatedModList; use Aternos\CurseForgeApi\Model\ModLoaderType; -use Aternos\CurseForgeApi\Model\ModSearchSortField; +use Aternos\CurseForgeApi\Model\ModsSearchSortField; use Aternos\CurseForgeApi\Model\PremiumType; use Aternos\CurseForgeApi\Model\SortOrder; @@ -16,7 +16,7 @@ class ModSearchOptions * @param int[]|null $categoryIds * @param string[]|null $gameVersions * @param string|null $searchFilter Filter by free text search in the mod name and author - * @param ModSearchSortField|null $sortField + * @param ModsSearchSortField|null $sortField * @param SortOrder|null $sortOrder * @param ModLoaderType[]|null $modLoaderTypes Filter only mods associated to a given mod loader (Forge, Fabric ...). Must be coupled with gameVersion. * @param int|null $gameVersionTypeId Filter only mods that contain files tagged with versions of the given gameVersionTypeId @@ -35,7 +35,7 @@ public function __construct( protected ?array $categoryIds = null, protected ?array $gameVersions = null, protected ?string $searchFilter = null, - protected ?ModSearchSortField $sortField = null, + protected ?ModsSearchSortField $sortField = null, protected ?SortOrder $sortOrder = null, protected ?array $modLoaderTypes = null, protected ?int $gameVersionTypeId = null, @@ -247,18 +247,18 @@ public function setSearchFilter(?string $searchFilter): static } /** - * @return ModSearchSortField|null + * @return ModsSearchSortField|null */ - public function getSortField(): ?ModSearchSortField + public function getSortField(): ?ModsSearchSortField { return $this->sortField; } /** - * @param ModSearchSortField|null $sortField + * @param ModsSearchSortField|null $sortField * @return $this */ - public function setSortField(?ModSearchSortField $sortField): static + public function setSortField(?ModsSearchSortField $sortField): static { $this->sortField = $sortField; return $this; diff --git a/src/Model/ModSearchSortField.php b/src/Model/ModsSearchSortField.php similarity index 93% rename from src/Model/ModSearchSortField.php rename to src/Model/ModsSearchSortField.php index 181cdaa..bb9645c 100644 --- a/src/Model/ModSearchSortField.php +++ b/src/Model/ModsSearchSortField.php @@ -1,6 +1,6 @@ assertNull($modSearchOptions->getSortField()); - $modSearchOptions->setSortField(ModSearchSortField::NAME); - $this->assertSame(ModSearchSortField::NAME, $modSearchOptions->getSortField()); + $modSearchOptions->setSortField(ModsSearchSortField::NAME); + $this->assertSame(ModsSearchSortField::NAME, $modSearchOptions->getSortField()); $modSearchOptions->setSortField(null); $this->assertNull($modSearchOptions->getSortField()); }