Enables access to the Repono Storage server. These methods and types are simple wrappers over the REST api.
The error states that can happen during the requests.
InvalidPassword
: An invalid password was provided. This error will also returned if no password
was provided if one was expected or a password was provided if none was expected.InvalidToken
: The token doesn't meet the criteria. Try to use another one.NotFound
: A requested object wasn't found. Maybe it was deleted?StorageLimitReached
: This upload cannot be done because this will conflict with the storage
limitations. Try to use to delete a file first or use a different container.TokenExhaused
: The token can no longer be used for this operation.HttpError
: The returned HTTP error cannot be expressed with one of the above.String
An alias for the container id. This is used to make the api more readable.
{ id : ContainerId
, created : Time.Posix
, modified : Time.Posix
, encrypted : Basics.Bool
, storageLimit : Basics.Int
, files : List FileInfo
}
Contains the information about the storage container
Contains the information of the container information request.
The variant EncryptedInfo
will be used if the container is encrypted and no password was given
during the request.
getContainer : String -> (Result Error Container -> msg) -> ContainerId -> Maybe String -> Platform.Cmd.Cmd msg
Returns the information of the container.
Expected Errors:
InvalidPassword
: Invalid password for this container. This will also return if the container is
not encrypted and a password was given.NotFound
: No container with this id foundnewContainer : String -> (Result Error ContainerInfo -> msg) -> TokenId -> Maybe String -> Platform.Cmd.Cmd msg
Create a new container which can store a specific amount of data. For this a token has to be provided that has a storage limit.
Expected Errors:
InvalidToken
: A container cannot be created. This can be the reason of one of the following:String
An alias for the file id. This is used to make the api more readable.
String
An alias for the file path. This is used to make the api more readable.
{ id : FileId
, path : FilePath
, created : Time.Posix
, modified : Time.Posix
, size : Basics.Int
, mime : String
}
Contains the information about a file inside a container
getFile : String -> (Result Error a -> msg) -> ContainerId -> FilePath -> Maybe String -> Bytes.Decode.Decoder a -> Platform.Cmd.Cmd msg
Get the binary content of a file.
Expected Errors:
InvalidPassword
: The password is wrong or not provided (if required).NotFound
: The file or container not found.getFileJson : String -> (Result Error a -> msg) -> ContainerId -> FilePath -> Maybe String -> Json.Decode.Decoder a -> Platform.Cmd.Cmd msg
Get the json content of a file.
Expected Errors:
InvalidPassword
: The password is wrong or not provided (if required).NotFound
: The file or container not found.getFileString : String -> (Result Error String -> msg) -> ContainerId -> FilePath -> Maybe String -> Platform.Cmd.Cmd msg
Get the text content of a file.
Expected Errors:
InvalidPassword
: The password is wrong or not provided (if required).NotFound
: The file or container not found.putFile : String -> (Result Error () -> msg) -> ContainerId -> FilePath -> Maybe String -> Http.Body -> Platform.Cmd.Cmd msg
Replace or upload the new content of a file.
Limitations:
Expected Errors:
InvalidPassword
: The password is wrong or not provided (if required).NotFound
: File not found.StorageLimitReached
: Replacing or adding this file will make the container larger than its
allowed to be. This code will also returned if the provided path is larger than 1024 bytes.deleteFile : String -> (Result Error () -> msg) -> ContainerId -> FilePath -> Maybe String -> Platform.Cmd.Cmd msg
Deletes a stored file.
Expected Errors:
InvalidPassword
: The password is wrong or not provided (if required).NotFound
: File not found.String
An alias for the token id. This is used to make the api more readable.
{ id : TokenId
, parent : Maybe TokenId
, childTokens : List TokenId
, childContainer : List ContainerId
, storageLimit : Maybe Basics.Int
, tokenLimit : Maybe Basics.Int
, expired : Basics.Bool
, created : Time.Posix
, used : Time.Posix
, hint : Maybe String
}
Contains the information about a token that can be used to create container.
id
: The id of this tokenparent
: The parent token idchildTokens
: The direct child tokenschildContainer
: The container that are created with this tokenstorageLimit
: The maximum storage limit for subsequent containers and tokens. If this field is
null than this token has an unlimited storage capacity and cannot be used to create containers
directly.tokenLimit
: The remaining number of tokens that can be created with this one. Only the root
token can have an unlimited number of null.expired
: States if this token is expired and can be used to create more tokens and containers.created
: The creation date of this token.used
: The last date this token was used.hint
: The hint that was provided durring creationgetToken : String -> (Result Error TokenInfo -> msg) -> TokenId -> Platform.Cmd.Cmd msg
Returns the information of the Token
Expected Errors:
NotFound
: No token with this id foundnewToken : String -> (Result Error TokenInfo -> msg) -> TokenId -> Basics.Int -> Basics.Int -> Maybe String -> Platform.Cmd.Cmd msg
Creates a new token. The new token is a child of the parent token.
Expected Errors:
NotFound
: No parent token with this id foundTokenExhaused
: The parent token cannot create a new child token. That can be the reason
of:String
An alias for the report id. This is used to make the api more readable.
{ reason : String
, files : List FilePath
}
The information of a single report that was submitted.
{ id : ReportId
, containerId : ContainerId
, created : Time.Posix
, report : Report
}
The stored meta information including the full report that was submitted.
getReports : String -> (Result Error (List ReportInfo) -> msg) -> Maybe ContainerId -> Maybe FilePath -> Platform.Cmd.Cmd msg
Search for open reports. These reports can be limited to a specific container or file that should be contained.
Expected Errors: none
postReport : String -> (Result Error ReportInfo -> msg) -> ContainerId -> Maybe String -> Report -> Platform.Cmd.Cmd msg
Creates a new report for a container. This report will be stored and will be checked by a moderator. If a report is accepted the corresponding files or container will be deleted. After a report is solved (successful or not) they will be removed from the list.
If is possible to block creation tokens because of reports.
If the container is password protected it is required to add the correct password. This password will be stored in clear text on the server until the report is resolved.
Expected Errors:
InvalidPassword
: Invalid password for the containerNotFound
: Container not found