File tree 2 files changed +14
-11
lines changed
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 1
1
# Modrinth.py
2
2
Interact with Modrinth's Labrinth API through Python.
3
3
4
- ## API Version
5
-
6
- Service | Version
7
- ----------------------|----------
8
- Modrinth.py version | v0.1.3
9
- Labrinth API version | v2.4.4
10
-
11
- * Modrinth.py works on the latest Labrinth version!*
12
-
13
4
## To-do
14
5
- [x] Search for projects
15
6
- [x] (Un)follow projects
@@ -26,7 +17,7 @@ Interact with Modrinth's Labrinth API through Python.
26
17
- [ ] Upload files to version
27
18
- [ ] Get a version from ` sha1 ` or ` sha512 `
28
19
- [ ] Delete a file from its hash (DELETE requests to ` /version_file ` )
29
- - [ ] Get latest project(s) version(s)
20
+ - [x ] Get latest project(s) version(s)
30
21
- [ ] Get project version from hash
31
22
- [x] Read user(s) data
32
23
- [ ] Delete and modify user data
Original file line number Diff line number Diff line change @@ -150,6 +150,12 @@ def unfollow(self, user: Users.AuthenticatedUser):
150
150
headers = {'Authorization' : user .token }
151
151
requests .delete (url , headers = headers )
152
152
153
+ def getLatestVersion (self ):
154
+ '''
155
+ Gets the latest version for the current project.
156
+ '''
157
+ return Versions .getLatestVersion (self )
158
+
153
159
def getVersion (self , version ):
154
160
'''
155
161
Shorthand for Versions.ModrinthVersion with no project argument.
@@ -160,7 +166,7 @@ def getAllVersions(self):
160
166
'''
161
167
Get Versions.getVersions() for all versions found for the project.
162
168
'''
163
- return Versions .getVersions (self .versions )
169
+ return Versions .getVersions (self , self .versions )
164
170
165
171
def getProjects (ids : list ) -> list :
166
172
'''
@@ -317,3 +323,9 @@ def getVersions(project: Projects.ModrinthProject, ids: list) -> list:
317
323
Get a list of versions, given a list of IDs.
318
324
'''
319
325
return [Versions .ModrinthVersion (project , id ) for id in ids ]
326
+
327
+ def getLatestVersion (project : Projects .ModrinthProject ) -> ModrinthVersion :
328
+ '''
329
+ Gets the latest version, given a project.
330
+ '''
331
+ return project .getAllVersions ()[- 1 ]
You can’t perform that action at this time.
0 commit comments