minecraft_versions 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +72 -0
  4. data/README.md +98 -0
  5. data/Rakefile +10 -0
  6. data/bin/bundle +109 -0
  7. data/bin/byebug +27 -0
  8. data/bin/coderay +27 -0
  9. data/bin/htmldiff +27 -0
  10. data/bin/ldiff +27 -0
  11. data/bin/pry +27 -0
  12. data/bin/racc +27 -0
  13. data/bin/rake +27 -0
  14. data/bin/rspec +27 -0
  15. data/bin/rubocop +27 -0
  16. data/bin/ruby-parse +27 -0
  17. data/bin/ruby-rewrite +27 -0
  18. data/docs/DefaultApi.md +132 -0
  19. data/docs/Download.md +22 -0
  20. data/docs/Version.md +26 -0
  21. data/docs/VersionManifest.md +20 -0
  22. data/docs/VersionManifestLatest.md +20 -0
  23. data/docs/VersionPackageInfo.md +40 -0
  24. data/docs/VersionPackageInfoAssetIndex.md +26 -0
  25. data/docs/VersionPackageInfoDownloads.md +24 -0
  26. data/docs/VersionPackageInfoJavaVersion.md +20 -0
  27. data/git_push.sh +57 -0
  28. data/lib/minecraft_versions/api/default_api.rb +142 -0
  29. data/lib/minecraft_versions/api_client.rb +391 -0
  30. data/lib/minecraft_versions/api_error.rb +56 -0
  31. data/lib/minecraft_versions/configuration.rb +293 -0
  32. data/lib/minecraft_versions/models/download.rb +230 -0
  33. data/lib/minecraft_versions/models/version.rb +248 -0
  34. data/lib/minecraft_versions/models/version_manifest.rb +223 -0
  35. data/lib/minecraft_versions/models/version_manifest_latest.rb +221 -0
  36. data/lib/minecraft_versions/models/version_package_info.rb +311 -0
  37. data/lib/minecraft_versions/models/version_package_info_asset_index.rb +248 -0
  38. data/lib/minecraft_versions/models/version_package_info_downloads.rb +239 -0
  39. data/lib/minecraft_versions/models/version_package_info_java_version.rb +221 -0
  40. data/lib/minecraft_versions/version.rb +13 -0
  41. data/lib/minecraft_versions.rb +46 -0
  42. data/minecraft_versions.gemspec +37 -0
  43. data/spec/api/default_api_spec.rb +55 -0
  44. data/spec/models/download_spec.rb +46 -0
  45. data/spec/models/version_manifest_latest_spec.rb +40 -0
  46. data/spec/models/version_manifest_spec.rb +40 -0
  47. data/spec/models/version_package_info_asset_index_spec.rb +58 -0
  48. data/spec/models/version_package_info_downloads_spec.rb +52 -0
  49. data/spec/models/version_package_info_java_version_spec.rb +40 -0
  50. data/spec/models/version_package_info_spec.rb +100 -0
  51. data/spec/models/version_spec.rb +58 -0
  52. data/spec/spec_helper.rb +109 -0
  53. metadata +144 -0
@@ -0,0 +1,132 @@
1
+ # MinecraftVersionsClient::DefaultApi
2
+
3
+ All URIs are relative to *https://launchermeta.mojang.com*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**get_minecraft_version_manifest**](DefaultApi.md#get_minecraft_version_manifest) | **GET** /mc/game/version_manifest.json | Get Minecraft version manifest |
8
+ | [**get_minecraft_version_package_info**](DefaultApi.md#get_minecraft_version_package_info) | **GET** /v1/packages/{packageId}/{versionId}.json | Get Minecraft version package info |
9
+
10
+
11
+ ## get_minecraft_version_manifest
12
+
13
+ > <VersionManifest> get_minecraft_version_manifest
14
+
15
+ Get Minecraft version manifest
16
+
17
+ ### Examples
18
+
19
+ ```ruby
20
+ require 'time'
21
+ require 'minecraft_versions'
22
+
23
+ api_instance = MinecraftVersionsClient::DefaultApi.new
24
+
25
+ begin
26
+ # Get Minecraft version manifest
27
+ result = api_instance.get_minecraft_version_manifest
28
+ p result
29
+ rescue MinecraftVersionsClient::ApiError => e
30
+ puts "Error when calling DefaultApi->get_minecraft_version_manifest: #{e}"
31
+ end
32
+ ```
33
+
34
+ #### Using the get_minecraft_version_manifest_with_http_info variant
35
+
36
+ This returns an Array which contains the response data, status code and headers.
37
+
38
+ > <Array(<VersionManifest>, Integer, Hash)> get_minecraft_version_manifest_with_http_info
39
+
40
+ ```ruby
41
+ begin
42
+ # Get Minecraft version manifest
43
+ data, status_code, headers = api_instance.get_minecraft_version_manifest_with_http_info
44
+ p status_code # => 2xx
45
+ p headers # => { ... }
46
+ p data # => <VersionManifest>
47
+ rescue MinecraftVersionsClient::ApiError => e
48
+ puts "Error when calling DefaultApi->get_minecraft_version_manifest_with_http_info: #{e}"
49
+ end
50
+ ```
51
+
52
+ ### Parameters
53
+
54
+ This endpoint does not need any parameter.
55
+
56
+ ### Return type
57
+
58
+ [**VersionManifest**](VersionManifest.md)
59
+
60
+ ### Authorization
61
+
62
+ No authorization required
63
+
64
+ ### HTTP request headers
65
+
66
+ - **Content-Type**: Not defined
67
+ - **Accept**: application/json
68
+
69
+
70
+ ## get_minecraft_version_package_info
71
+
72
+ > <VersionPackageInfo> get_minecraft_version_package_info(package_id, version_id)
73
+
74
+ Get Minecraft version package info
75
+
76
+ ### Examples
77
+
78
+ ```ruby
79
+ require 'time'
80
+ require 'minecraft_versions'
81
+
82
+ api_instance = MinecraftVersionsClient::DefaultApi.new
83
+ package_id = '177e49d3233cb6eac42f0495c0a48e719870c2ae' # String |
84
+ version_id = '1.21' # String |
85
+
86
+ begin
87
+ # Get Minecraft version package info
88
+ result = api_instance.get_minecraft_version_package_info(package_id, version_id)
89
+ p result
90
+ rescue MinecraftVersionsClient::ApiError => e
91
+ puts "Error when calling DefaultApi->get_minecraft_version_package_info: #{e}"
92
+ end
93
+ ```
94
+
95
+ #### Using the get_minecraft_version_package_info_with_http_info variant
96
+
97
+ This returns an Array which contains the response data, status code and headers.
98
+
99
+ > <Array(<VersionPackageInfo>, Integer, Hash)> get_minecraft_version_package_info_with_http_info(package_id, version_id)
100
+
101
+ ```ruby
102
+ begin
103
+ # Get Minecraft version package info
104
+ data, status_code, headers = api_instance.get_minecraft_version_package_info_with_http_info(package_id, version_id)
105
+ p status_code # => 2xx
106
+ p headers # => { ... }
107
+ p data # => <VersionPackageInfo>
108
+ rescue MinecraftVersionsClient::ApiError => e
109
+ puts "Error when calling DefaultApi->get_minecraft_version_package_info_with_http_info: #{e}"
110
+ end
111
+ ```
112
+
113
+ ### Parameters
114
+
115
+ | Name | Type | Description | Notes |
116
+ | ---- | ---- | ----------- | ----- |
117
+ | **package_id** | **String** | | |
118
+ | **version_id** | **String** | | |
119
+
120
+ ### Return type
121
+
122
+ [**VersionPackageInfo**](VersionPackageInfo.md)
123
+
124
+ ### Authorization
125
+
126
+ No authorization required
127
+
128
+ ### HTTP request headers
129
+
130
+ - **Content-Type**: Not defined
131
+ - **Accept**: application/json
132
+
data/docs/Download.md ADDED
@@ -0,0 +1,22 @@
1
+ # MinecraftVersionsClient::Download
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **sha1** | **String** | | [optional] |
8
+ | **size** | **Integer** | | [optional] |
9
+ | **url** | **String** | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'minecraft_versions'
15
+
16
+ instance = MinecraftVersionsClient::Download.new(
17
+ sha1: null,
18
+ size: null,
19
+ url: null
20
+ )
21
+ ```
22
+
data/docs/Version.md ADDED
@@ -0,0 +1,26 @@
1
+ # MinecraftVersionsClient::Version
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+ | **type** | **String** | | [optional] |
9
+ | **url** | **String** | | [optional] |
10
+ | **time** | **Time** | | [optional] |
11
+ | **release_time** | **Time** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'minecraft_versions'
17
+
18
+ instance = MinecraftVersionsClient::Version.new(
19
+ id: 24w14potato,
20
+ type: snapshot,
21
+ url: https://piston-meta.mojang.com/v1/packages/21df7f4ba484a6437ab5e9dca0b4dfb5dcefc802/24w14potato.json,
22
+ time: 2024-04-01T11:14:41Z,
23
+ release_time: 2024-04-01T11:07:19Z
24
+ )
25
+ ```
26
+
@@ -0,0 +1,20 @@
1
+ # MinecraftVersionsClient::VersionManifest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **latest** | [**VersionManifestLatest**](VersionManifestLatest.md) | | [optional] |
8
+ | **versions** | [**Array&lt;Version&gt;**](Version.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'minecraft_versions'
14
+
15
+ instance = MinecraftVersionsClient::VersionManifest.new(
16
+ latest: null,
17
+ versions: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # MinecraftVersionsClient::VersionManifestLatest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **release** | **String** | | [optional] |
8
+ | **snapshot** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'minecraft_versions'
14
+
15
+ instance = MinecraftVersionsClient::VersionManifestLatest.new(
16
+ release: 1.21,
17
+ snapshot: 24w14potato
18
+ )
19
+ ```
20
+
@@ -0,0 +1,40 @@
1
+ # MinecraftVersionsClient::VersionPackageInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **version** | **String** | | [optional] |
8
+ | **asset_index** | [**VersionPackageInfoAssetIndex**](VersionPackageInfoAssetIndex.md) | | [optional] |
9
+ | **assets** | **String** | | [optional] |
10
+ | **compliance_level** | **Integer** | | [optional] |
11
+ | **downloads** | [**VersionPackageInfoDownloads**](VersionPackageInfoDownloads.md) | | [optional] |
12
+ | **id** | **String** | | [optional] |
13
+ | **java_version** | [**VersionPackageInfoJavaVersion**](VersionPackageInfoJavaVersion.md) | | [optional] |
14
+ | **main_class** | **String** | | [optional] |
15
+ | **minimum_launcher_version** | **Integer** | | [optional] |
16
+ | **time** | **Time** | | [optional] |
17
+ | **release_time** | **Time** | | [optional] |
18
+ | **type** | **String** | | [optional] |
19
+
20
+ ## Example
21
+
22
+ ```ruby
23
+ require 'minecraft_versions'
24
+
25
+ instance = MinecraftVersionsClient::VersionPackageInfo.new(
26
+ version: null,
27
+ asset_index: null,
28
+ assets: null,
29
+ compliance_level: null,
30
+ downloads: null,
31
+ id: null,
32
+ java_version: null,
33
+ main_class: net.minecraft.client.main.Main,
34
+ minimum_launcher_version: 21,
35
+ time: 2024-04-01T11:14:41Z,
36
+ release_time: 2024-04-01T11:07:19Z,
37
+ type: snapshot
38
+ )
39
+ ```
40
+
@@ -0,0 +1,26 @@
1
+ # MinecraftVersionsClient::VersionPackageInfoAssetIndex
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+ | **sha1** | **String** | | [optional] |
9
+ | **size** | **Integer** | | [optional] |
10
+ | **total_size** | **Integer** | | [optional] |
11
+ | **url** | **String** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'minecraft_versions'
17
+
18
+ instance = MinecraftVersionsClient::VersionPackageInfoAssetIndex.new(
19
+ id: null,
20
+ sha1: null,
21
+ size: null,
22
+ total_size: null,
23
+ url: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,24 @@
1
+ # MinecraftVersionsClient::VersionPackageInfoDownloads
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **client** | [**Download**](Download.md) | | [optional] |
8
+ | **client_mappings** | [**Download**](Download.md) | | [optional] |
9
+ | **server** | [**Download**](Download.md) | | [optional] |
10
+ | **server_mappings** | [**Download**](Download.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'minecraft_versions'
16
+
17
+ instance = MinecraftVersionsClient::VersionPackageInfoDownloads.new(
18
+ client: null,
19
+ client_mappings: null,
20
+ server: null,
21
+ server_mappings: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,20 @@
1
+ # MinecraftVersionsClient::VersionPackageInfoJavaVersion
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **component** | **String** | | [optional] |
8
+ | **major_version** | **Integer** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'minecraft_versions'
14
+
15
+ instance = MinecraftVersionsClient::VersionPackageInfoJavaVersion.new(
16
+ component: null,
17
+ major_version: null
18
+ )
19
+ ```
20
+
data/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="oapicf"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="minecraft-versions"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
@@ -0,0 +1,142 @@
1
+ =begin
2
+ #SDK for Minecraft versions info
3
+
4
+ The version of the OpenAPI document: 0.10.0
5
+ Contact: blah+oapicf@cliffano.com
6
+ Generated by: https://openapi-generator.tech
7
+ Generator version: 7.6.0
8
+
9
+ =end
10
+
11
+ require 'cgi'
12
+
13
+ module MinecraftVersionsClient
14
+ class DefaultApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+ # Get Minecraft version manifest
21
+ # @param [Hash] opts the optional parameters
22
+ # @return [VersionManifest]
23
+ def get_minecraft_version_manifest(opts = {})
24
+ data, _status_code, _headers = get_minecraft_version_manifest_with_http_info(opts)
25
+ data
26
+ end
27
+
28
+ # Get Minecraft version manifest
29
+ # @param [Hash] opts the optional parameters
30
+ # @return [Array<(VersionManifest, Integer, Hash)>] VersionManifest data, response status code and response headers
31
+ def get_minecraft_version_manifest_with_http_info(opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_minecraft_version_manifest ...'
34
+ end
35
+ # resource path
36
+ local_var_path = '/mc/game/version_manifest.json'
37
+
38
+ # query parameters
39
+ query_params = opts[:query_params] || {}
40
+
41
+ # header parameters
42
+ header_params = opts[:header_params] || {}
43
+ # HTTP header 'Accept' (if needed)
44
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
45
+
46
+ # form parameters
47
+ form_params = opts[:form_params] || {}
48
+
49
+ # http body (model)
50
+ post_body = opts[:debug_body]
51
+
52
+ # return_type
53
+ return_type = opts[:debug_return_type] || 'VersionManifest'
54
+
55
+ # auth_names
56
+ auth_names = opts[:debug_auth_names] || []
57
+
58
+ new_options = opts.merge(
59
+ :operation => :"DefaultApi.get_minecraft_version_manifest",
60
+ :header_params => header_params,
61
+ :query_params => query_params,
62
+ :form_params => form_params,
63
+ :body => post_body,
64
+ :auth_names => auth_names,
65
+ :return_type => return_type
66
+ )
67
+
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug "API called: DefaultApi#get_minecraft_version_manifest\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
+ end
72
+ return data, status_code, headers
73
+ end
74
+
75
+ # Get Minecraft version package info
76
+ # @param package_id [String]
77
+ # @param version_id [String]
78
+ # @param [Hash] opts the optional parameters
79
+ # @return [VersionPackageInfo]
80
+ def get_minecraft_version_package_info(package_id, version_id, opts = {})
81
+ data, _status_code, _headers = get_minecraft_version_package_info_with_http_info(package_id, version_id, opts)
82
+ data
83
+ end
84
+
85
+ # Get Minecraft version package info
86
+ # @param package_id [String]
87
+ # @param version_id [String]
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [Array<(VersionPackageInfo, Integer, Hash)>] VersionPackageInfo data, response status code and response headers
90
+ def get_minecraft_version_package_info_with_http_info(package_id, version_id, opts = {})
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_minecraft_version_package_info ...'
93
+ end
94
+ # verify the required parameter 'package_id' is set
95
+ if @api_client.config.client_side_validation && package_id.nil?
96
+ fail ArgumentError, "Missing the required parameter 'package_id' when calling DefaultApi.get_minecraft_version_package_info"
97
+ end
98
+ # verify the required parameter 'version_id' is set
99
+ if @api_client.config.client_side_validation && version_id.nil?
100
+ fail ArgumentError, "Missing the required parameter 'version_id' when calling DefaultApi.get_minecraft_version_package_info"
101
+ end
102
+ # resource path
103
+ local_var_path = '/v1/packages/{packageId}/{versionId}.json'.sub('{' + 'packageId' + '}', CGI.escape(package_id.to_s)).sub('{' + 'versionId' + '}', CGI.escape(version_id.to_s))
104
+
105
+ # query parameters
106
+ query_params = opts[:query_params] || {}
107
+
108
+ # header parameters
109
+ header_params = opts[:header_params] || {}
110
+ # HTTP header 'Accept' (if needed)
111
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
112
+
113
+ # form parameters
114
+ form_params = opts[:form_params] || {}
115
+
116
+ # http body (model)
117
+ post_body = opts[:debug_body]
118
+
119
+ # return_type
120
+ return_type = opts[:debug_return_type] || 'VersionPackageInfo'
121
+
122
+ # auth_names
123
+ auth_names = opts[:debug_auth_names] || []
124
+
125
+ new_options = opts.merge(
126
+ :operation => :"DefaultApi.get_minecraft_version_package_info",
127
+ :header_params => header_params,
128
+ :query_params => query_params,
129
+ :form_params => form_params,
130
+ :body => post_body,
131
+ :auth_names => auth_names,
132
+ :return_type => return_type
133
+ )
134
+
135
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
136
+ if @api_client.config.debugging
137
+ @api_client.config.logger.debug "API called: DefaultApi#get_minecraft_version_package_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
138
+ end
139
+ return data, status_code, headers
140
+ end
141
+ end
142
+ end