Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
feat(examples/e2e): Add getContent
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Aug 12, 2022
1 parent 92f0cde commit f157215
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/e2e/src/main/kotlin/dev/s7a/example/gofile/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.s7a.gofile.GofileClient
import dev.s7a.gofile.GofileFolderOption
import dev.s7a.gofile.GofileTier
import dev.s7a.gofile.uploadFile
import java.util.Calendar
import kotlin.io.path.createTempFile
import kotlin.io.path.writeText

Expand All @@ -23,11 +24,15 @@ suspend fun main() {
val createFolder = client.createFolder(uploadFile.parentFolder, "new-folder", token).getOrThrow()
println("createFolder: $createFolder")
client.setFolderOption(createFolder.id, GofileFolderOption.Description("description"), token).getOrThrow()
client.setFolderOption(createFolder.id, GofileFolderOption.Expire(1660106197), token).getOrThrow()
client.setFolderOption(createFolder.id, GofileFolderOption.Expire(Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, 1) }.toInstant().epochSecond), token).getOrThrow()
client.setFolderOption(createFolder.id, GofileFolderOption.Password("password"), token).getOrThrow()
client.setFolderOption(createFolder.id, GofileFolderOption.Tags("t", "a", "g", "s"), token).getOrThrow()
if (accountDetails.tier == GofileTier.Donor) {
client.copyContent(uploadFile.fileId, createFolder.id, token).getOrThrow()
val getContentFile = client.getContent(uploadFile.fileId, token).getOrThrow()
println("getContentFile: $getContentFile")
val getContentFolder = client.getContent(createFolder.id, token).getOrThrow()
println("getContentFolder: $getContentFolder")
}
val deleteContent = client.deleteContent(uploadFile.fileId, token).getOrThrow()
println("deleteContent: $deleteContent")
Expand Down

0 comments on commit f157215

Please sign in to comment.