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

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

    /// Add property groups to a Dropbox file. See templatesAddForUser or templatesAddForTeam to create new templates.
    ///
    /// - parameter path: A unique identifier for the file or folder.
    /// - parameter propertyGroups: The property groups which are to be added to a Dropbox file.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.AddPropertiesError` object on failure.
    @discardableResult open func propertiesAdd(path: String, propertyGroups: Array<FileProperties.PropertyGroup>) -> RpcRequest<VoidSerializer, FileProperties.AddPropertiesErrorSerializer> {
        let route = FileProperties.propertiesAdd
        let serverArgs = FileProperties.AddPropertiesArg(path: path, propertyGroups: propertyGroups)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Overwrite property groups associated with a file. This endpoint should be used instead of propertiesUpdate when
    /// property groups are being updated via a "snapshot" instead of via a "delta". In other words, this endpoint will
    /// delete all omitted fields from a property group, whereas propertiesUpdate will only delete fields that are
    /// explicitly marked for deletion.
    ///
    /// - parameter path: A unique identifier for the file or folder.
    /// - parameter propertyGroups: The property groups "snapshot" updates to force apply.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.InvalidPropertyGroupError` object on failure.
    @discardableResult open func propertiesOverwrite(path: String, propertyGroups: Array<FileProperties.PropertyGroup>) -> RpcRequest<VoidSerializer, FileProperties.InvalidPropertyGroupErrorSerializer> {
        let route = FileProperties.propertiesOverwrite
        let serverArgs = FileProperties.OverwritePropertyGroupArg(path: path, propertyGroups: propertyGroups)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Permanently removes the specified property group from the file. To remove specific property field key value
    /// pairs, see propertiesUpdate. To update a template, see templatesUpdateForUser or templatesUpdateForTeam. To
    /// remove a template, see templatesRemoveForUser or templatesRemoveForTeam.
    ///
    /// - parameter path: A unique identifier for the file or folder.
    /// - parameter propertyTemplateIds: A list of identifiers for a template created by templatesAddForUser or
    /// templatesAddForTeam.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.RemovePropertiesError` object on failure.
    @discardableResult open func propertiesRemove(path: String, propertyTemplateIds: Array<String>) -> RpcRequest<VoidSerializer, FileProperties.RemovePropertiesErrorSerializer> {
        let route = FileProperties.propertiesRemove
        let serverArgs = FileProperties.RemovePropertiesArg(path: path, propertyTemplateIds: propertyTemplateIds)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Search across property templates for particular property field values.
    ///
    /// - parameter queries: Queries to search.
    /// - parameter templateFilter: Filter results to contain only properties associated with these template IDs.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.PropertiesSearchResult`
    /// object on success or a `FileProperties.PropertiesSearchError` object on failure.
    @discardableResult open func propertiesSearch(queries: Array<FileProperties.PropertiesSearchQuery>, templateFilter: FileProperties.TemplateFilter = .filterNone) -> RpcRequest<FileProperties.PropertiesSearchResultSerializer, FileProperties.PropertiesSearchErrorSerializer> {
        let route = FileProperties.propertiesSearch
        let serverArgs = FileProperties.PropertiesSearchArg(queries: queries, templateFilter: templateFilter)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Once a cursor has been retrieved from propertiesSearch, use this to paginate through all search results.
    ///
    /// - parameter cursor: The cursor returned by your last call to propertiesSearch or propertiesSearchContinue.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.PropertiesSearchResult`
    /// object on success or a `FileProperties.PropertiesSearchContinueError` object on failure.
    @discardableResult open func propertiesSearchContinue(cursor: String) -> RpcRequest<FileProperties.PropertiesSearchResultSerializer, FileProperties.PropertiesSearchContinueErrorSerializer> {
        let route = FileProperties.propertiesSearchContinue
        let serverArgs = FileProperties.PropertiesSearchContinueArg(cursor: cursor)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Add, update or remove properties associated with the supplied file and templates. This endpoint should be used
    /// instead of propertiesOverwrite when property groups are being updated via a "delta" instead of via a "snapshot"
    /// . In other words, this endpoint will not delete any omitted fields from a property group, whereas
    /// propertiesOverwrite will delete any fields that are omitted from a property group.
    ///
    /// - parameter path: A unique identifier for the file or folder.
    /// - parameter updatePropertyGroups: The property groups "delta" updates to apply.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.UpdatePropertiesError` object on failure.
    @discardableResult open func propertiesUpdate(path: String, updatePropertyGroups: Array<FileProperties.PropertyGroupUpdate>) -> RpcRequest<VoidSerializer, FileProperties.UpdatePropertiesErrorSerializer> {
        let route = FileProperties.propertiesUpdate
        let serverArgs = FileProperties.UpdatePropertiesArg(path: path, updatePropertyGroups: updatePropertyGroups)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Add a template associated with a team. See propertiesAdd to add properties to a file or folder. Note: this
    /// endpoint will create team-owned templates.
    ///
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.AddTemplateResult` object
    /// on success or a `FileProperties.ModifyTemplateError` object on failure.
    @discardableResult open func templatesAddForTeam(name: String, description_: String, fields: Array<FileProperties.PropertyFieldTemplate>) -> RpcRequest<FileProperties.AddTemplateResultSerializer, FileProperties.ModifyTemplateErrorSerializer> {
        let route = FileProperties.templatesAddForTeam
        let serverArgs = FileProperties.AddTemplateArg(name: name, description_: description_, fields: fields)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Add a template associated with a user. See propertiesAdd to add properties to a file. This endpoint can't be
    /// called on a team member or admin's behalf.
    ///
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.AddTemplateResult` object
    /// on success or a `FileProperties.ModifyTemplateError` object on failure.
    @discardableResult open func templatesAddForUser(name: String, description_: String, fields: Array<FileProperties.PropertyFieldTemplate>) -> RpcRequest<FileProperties.AddTemplateResultSerializer, FileProperties.ModifyTemplateErrorSerializer> {
        let route = FileProperties.templatesAddForUser
        let serverArgs = FileProperties.AddTemplateArg(name: name, description_: description_, fields: fields)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Get the schema for a specified template.
    ///
    /// - parameter templateId: An identifier for template added by route  See templatesAddForUser or
    /// templatesAddForTeam.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.GetTemplateResult` object
    /// on success or a `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesGetForTeam(templateId: String) -> RpcRequest<FileProperties.GetTemplateResultSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesGetForTeam
        let serverArgs = FileProperties.GetTemplateArg(templateId: templateId)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Get the schema for a specified template. This endpoint can't be called on a team member or admin's behalf.
    ///
    /// - parameter templateId: An identifier for template added by route  See templatesAddForUser or
    /// templatesAddForTeam.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.GetTemplateResult` object
    /// on success or a `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesGetForUser(templateId: String) -> RpcRequest<FileProperties.GetTemplateResultSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesGetForUser
        let serverArgs = FileProperties.GetTemplateArg(templateId: templateId)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Get the template identifiers for a team. To get the schema of each template use templatesGetForTeam.
    ///
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.ListTemplateResult` object
    /// on success or a `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesListForTeam() -> RpcRequest<FileProperties.ListTemplateResultSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesListForTeam
        return client.request(route)
    }

    /// Get the template identifiers for a team. To get the schema of each template use templatesGetForUser. This
    /// endpoint can't be called on a team member or admin's behalf.
    ///
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.ListTemplateResult` object
    /// on success or a `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesListForUser() -> RpcRequest<FileProperties.ListTemplateResultSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesListForUser
        return client.request(route)
    }

    /// Permanently removes the specified template created from templatesAddForUser. All properties associated with the
    /// template will also be removed. This action cannot be undone.
    ///
    /// - parameter templateId: An identifier for a template created by templatesAddForUser or templatesAddForTeam.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesRemoveForTeam(templateId: String) -> RpcRequest<VoidSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesRemoveForTeam
        let serverArgs = FileProperties.RemoveTemplateArg(templateId: templateId)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Permanently removes the specified template created from templatesAddForUser. All properties associated with the
    /// template will also be removed. This action cannot be undone.
    ///
    /// - parameter templateId: An identifier for a template created by templatesAddForUser or templatesAddForTeam.
    ///
    ///  - returns: Through the response callback, the caller will receive a `Void` object on success or a
    /// `FileProperties.TemplateError` object on failure.
    @discardableResult open func templatesRemoveForUser(templateId: String) -> RpcRequest<VoidSerializer, FileProperties.TemplateErrorSerializer> {
        let route = FileProperties.templatesRemoveForUser
        let serverArgs = FileProperties.RemoveTemplateArg(templateId: templateId)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Update a template associated with a team. This route can update the template name, the template description and
    /// add optional properties to templates.
    ///
    /// - parameter templateId: An identifier for template added by  See templatesAddForUser or templatesAddForTeam.
    /// - parameter name: A display name for the template. template names can be up to 256 bytes.
    /// - parameter description_: Description for the new template. Template descriptions can be up to 1024 bytes.
    /// - parameter addFields: Property field templates to be added to the group template. There can be up to 32
    /// properties in a single template.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.UpdateTemplateResult`
    /// object on success or a `FileProperties.ModifyTemplateError` object on failure.
    @discardableResult open func templatesUpdateForTeam(templateId: String, name: String? = nil, description_: String? = nil, addFields: Array<FileProperties.PropertyFieldTemplate>? = nil) -> RpcRequest<FileProperties.UpdateTemplateResultSerializer, FileProperties.ModifyTemplateErrorSerializer> {
        let route = FileProperties.templatesUpdateForTeam
        let serverArgs = FileProperties.UpdateTemplateArg(templateId: templateId, name: name, description_: description_, addFields: addFields)
        return client.request(route, serverArgs: serverArgs)
    }

    /// Update a template associated with a user. This route can update the template name, the template description and
    /// add optional properties to templates. This endpoint can't be called on a team member or admin's behalf.
    ///
    /// - parameter templateId: An identifier for template added by  See templatesAddForUser or templatesAddForTeam.
    /// - parameter name: A display name for the template. template names can be up to 256 bytes.
    /// - parameter description_: Description for the new template. Template descriptions can be up to 1024 bytes.
    /// - parameter addFields: Property field templates to be added to the group template. There can be up to 32
    /// properties in a single template.
    ///
    ///  - returns: Through the response callback, the caller will receive a `FileProperties.UpdateTemplateResult`
    /// object on success or a `FileProperties.ModifyTemplateError` object on failure.
    @discardableResult open func templatesUpdateForUser(templateId: String, name: String? = nil, description_: String? = nil, addFields: Array<FileProperties.PropertyFieldTemplate>? = nil) -> RpcRequest<FileProperties.UpdateTemplateResultSerializer, FileProperties.ModifyTemplateErrorSerializer> {
        let route = FileProperties.templatesUpdateForUser
        let serverArgs = FileProperties.UpdateTemplateArg(templateId: templateId, name: name, description_: description_, addFields: addFields)
        return client.request(route, serverArgs: serverArgs)
    }

}
