///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///
/// Auto-generated by Stone, do not modify.
///

/// Routes for the file_requests namespace
open class FileRequestsRoutes {
    public let client: DropboxTransportClient
    init(client: DropboxTransportClient) {
        self.client = client
    }

    /// Creates a file request for this user.
    ///
    /// - parameter title: The title of the file request. Must not be empty.
    /// - parameter destination: The path of the folder in the Dropbox where uploaded files will be sent. For apps with
    /// the app folder permission, this will be relative to the app folder.
    /// - parameter deadline: The deadline for the file request. Deadlines can only be set by Professional and Business
    /// accounts.
    /// - parameter open: Whether or not the file request should be open. If the file request is closed, it will not
    /// accept any file submissions, but it can be opened later.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileRequests.FileRequest` object on
    /// success or a `FileRequests.CreateFileRequestError` object on failure.
    @discardableResult open func create(title: String, destination: String, deadline: FileRequests.FileRequestDeadline? = nil, open: Bool = true) -> RpcRequest<FileRequests.FileRequestSerializer, FileRequests.CreateFileRequestErrorSerializer> {
        let route = FileRequests.create
        let serverArgs = FileRequests.CreateFileRequestArgs(title: title, destination: destination, deadline: deadline, open: open)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Returns the specified file request.
    ///
    /// - parameter id: The ID of the file request to retrieve.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileRequests.FileRequest` object on
    /// success or a `FileRequests.GetFileRequestError` object on failure.
    @discardableResult open func get(id: String) -> RpcRequest<FileRequests.FileRequestSerializer, FileRequests.GetFileRequestErrorSerializer> {
        let route = FileRequests.get
        let serverArgs = FileRequests.GetFileRequestArgs(id: id)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Returns a list of file requests owned by this user. For apps with the app folder permission, this will only
    /// return file requests with destinations in the app folder.
    ///
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileRequests.ListFileRequestsResult`
    /// object on success or a `FileRequests.ListFileRequestsError` object on failure.
    @discardableResult open func list_() -> RpcRequest<FileRequests.ListFileRequestsResultSerializer, FileRequests.ListFileRequestsErrorSerializer> {
        let route = FileRequests.list_
        return client.request(route)
    }

    /// Update a file request.
    ///
    /// - parameter id: The ID of the file request to update.
    /// - parameter title: The new title of the file request. Must not be empty.
    /// - parameter destination: The new path of the folder in the Dropbox where uploaded files will be sent. For apps
    /// with the app folder permission, this will be relative to the app folder.
    /// - parameter deadline: The new deadline for the file request. Deadlines can only be set by Professional and
    /// Business accounts.
    /// - parameter open: Whether to set this file request as open or closed.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileRequests.FileRequest` object on
    /// success or a `FileRequests.UpdateFileRequestError` object on failure.
    @discardableResult open func update(id: String, title: String? = nil, destination: String? = nil, deadline: FileRequests.UpdateFileRequestDeadline = .noUpdate, open: Bool? = nil) -> RpcRequest<FileRequests.FileRequestSerializer, FileRequests.UpdateFileRequestErrorSerializer> {
        let route = FileRequests.update
        let serverArgs = FileRequests.UpdateFileRequestArgs(id: id, title: title, destination: destination, deadline: deadline, open: open)
        return client.request(route, serverArgs: serverArgs)
    }

}
