forked from tonyofrancis/Fetch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0364aa3
commit 95e5d3d
Showing
23 changed files
with
395 additions
and
210 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...fileserver/src/main/java/com/tonyodev/fetch2fileserver/AbstractFetchFileServerDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
fetch2fileserver/src/main/java/com/tonyodev/fetch2fileserver/FetchFileServerAuthenticator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
fetch2fileserver/src/main/java/com/tonyodev/fetch2fileserver/FetchFileServerDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
fetch2fileserver/src/main/java/com/tonyodev/fetch2fileserver/FetchFileServerExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.tonyodev.fetch2fileserver | ||
|
||
import com.tonyodev.fetch2.Func | ||
|
||
/** Checks if a File Resource is managed by this instance. | ||
* @param fileResourceId file resource id | ||
* @param callback callback the result will be returned on. True if the file resource | ||
* is being managed. False otherwise. | ||
* */ | ||
fun FetchFileServer.containsFileResource(fileResourceId: Long, callback: (Boolean) -> Unit) { | ||
containsFileResource(fileResourceId, object : Func<Boolean> { | ||
override fun call(t: Boolean) { | ||
callback(t) | ||
} | ||
}) | ||
} | ||
|
||
/** Gets a list of all File Resources managed by this File Server instance. | ||
* @param callback callback the result is returned on. | ||
* */ | ||
fun FetchFileServer.getFileResources(callback: (List<FileResource>) -> Unit) { | ||
getFileResources(object : Func<List<FileResource>> { | ||
override fun call(t: List<FileResource>) { | ||
callback(t) | ||
} | ||
}) | ||
} | ||
|
||
/** Gets the Catalog(All File Resources) managed by this File Server instances | ||
* as JSON. The FileResources `file` field is excluded. | ||
* @param callback callback the result will be returned on. | ||
* */ | ||
fun FetchFileServer.getCatalog(callback: (String) -> Unit) { | ||
getCatalog(object : Func<String> { | ||
override fun call(t: String) { | ||
callback(t) | ||
} | ||
}) | ||
} | ||
|
||
/** Queries the File Server instance for a managed file resource if it exist. | ||
* @param fileResourceId file resource id | ||
* @param callback callback the result will be returned on. Result maybe null. | ||
* */ | ||
fun FetchFileServer.getFileResource(fileResourceId: Long, callback: (FileResource?) -> Unit) { | ||
getFileResource(fileResourceId, object : Func<FileResource?> { | ||
override fun call(t: FileResource?) { | ||
callback(t) | ||
} | ||
}) | ||
} |
Oops, something went wrong.