Discovery

public class Discovery

IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual filtering of results.

  • The base URL to use when contacting the service.

    Declaration

    Swift

    public var serviceURL: String?
  • Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2020-08-30.

    Declaration

    Swift

    public var version: String
  • Service identifiers

    Declaration

    Swift

    public static let defaultServiceName: String
  • The default HTTP headers for all requests to the service.

    Declaration

    Swift

    public var defaultHeaders: [String : String]
  • Undocumented

    Declaration

    Swift

    public let authenticator: Authenticator
  • Create a Discovery object.

    If an authenticator is not supplied, the initializer will retrieve credentials from the environment or a local credentials file and construct an appropriate authenticator using these credentials. The credentials file can be downloaded from your service instance on IBM Cloud as ibm-credentials.env. Make sure to add the credentials file to your project so that it can be loaded at runtime.

    If an authenticator is not supplied and credentials are not available in the environment or a local credentials file, initialization will fail by throwing an exception. In that case, try another initializer that directly passes in the credentials.

    • serviceName: String = defaultServiceName
  • Create a Discovery object.

    Declaration

    Swift

    public init(version: String, authenticator: Authenticator)

    Parameters

    version

    Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2020-08-30.

    authenticator

    The Authenticator object used to authenticate requests to the service

  • Allow network requests to a server without verification of the server certificate. IMPORTANT: This should ONLY be used if truly intended, as it is unsafe otherwise.

    Declaration

    Swift

    public func disableSSLVerification()
  • List collections.

    Lists existing collections for the specified project.

    Declaration

    Swift

    public func listCollections(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ListCollectionsResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Create a collection.

    Create a new collection in the specified project.

    Declaration

    Swift

    public func createCollection(
        projectID: String,
        name: String,
        description: String? = nil,
        language: String? = nil,
        enrichments: [CollectionEnrichment]? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    name

    The name of the collection.

    description

    A description of the collection.

    language

    The language of the collection.

    enrichments

    An array of enrichments that are applied to this collection.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Get collection.

    Get details about the specified collection.

    Declaration

    Swift

    public func getCollection(
        projectID: String,
        collectionID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Update a collection.

    Updates the specified collection’s name, description, and enrichments.

    Declaration

    Swift

    public func updateCollection(
        projectID: String,
        collectionID: String,
        name: String? = nil,
        description: String? = nil,
        enrichments: [CollectionEnrichment]? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<CollectionDetails>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    name

    The name of the collection.

    description

    A description of the collection.

    enrichments

    An array of enrichments that are applied to this collection.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete a collection.

    Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

    Declaration

    Swift

    public func deleteCollection(
        projectID: String,
        collectionID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Query a project.

    By using this method, you can construct queries. For details, see the Discovery documentation. The default query parameters are defined by the settings for this project, see the Discovery documentation for an overview of the standard default settings, and see the Projects API documentation for details about how to set custom default query settings.

    Declaration

    Swift

    public func query(
        projectID: String,
        collectionIDs: [String]? = nil,
        filter: String? = nil,
        query: String? = nil,
        naturalLanguageQuery: String? = nil,
        aggregation: String? = nil,
        count: Int? = nil,
        `return`: [String]? = nil,
        offset: Int? = nil,
        sort: String? = nil,
        highlight: Bool? = nil,
        spellingSuggestions: Bool? = nil,
        tableResults: QueryLargeTableResults? = nil,
        suggestedRefinements: QueryLargeSuggestedRefinements? = nil,
        passages: QueryLargePassages? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<QueryResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionIDs

    A comma-separated list of collection IDs to be queried against.

    filter

    A cacheable query that excludes documents that don’t mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

    query

    A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

    naturalLanguageQuery

    A natural language query that returns relevant documents by utilizing training data and natural language understanding.

    aggregation

    An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

    count

    Number of results to return.

    offset

    The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

    sort

    A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified.

    highlight

    When true, a highlight field is returned for each result which contains the fields which match the query with <em></em> tags around the matching query terms.

    spellingSuggestions

    When true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists).

    tableResults

    Configuration for table retrieval.

    suggestedRefinements

    Configuration for suggested refinements. Available with Premium plans only.

    passages

    Configuration for passage retrieval.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Get Autocomplete Suggestions.

    Returns completion query suggestions for the specified prefix.

    Declaration

    Swift

    public func getAutocompletion(
        projectID: String,
        `prefix`: String,
        collectionIDs: [String]? = nil,
        field: String? = nil,
        count: Int? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Completions>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionIDs

    Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

    field

    The field in the result documents that autocompletion suggestions are identified from.

    count

    The number of autocompletion suggestions to return.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Query collection notices.

    Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

    Declaration

    Swift

    public func queryCollectionNotices(
        projectID: String,
        collectionID: String,
        filter: String? = nil,
        query: String? = nil,
        naturalLanguageQuery: String? = nil,
        count: Int? = nil,
        offset: Int? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<QueryNoticesResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    filter

    A cacheable query that excludes documents that don’t mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

    query

    A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

    naturalLanguageQuery

    A natural language query that returns relevant documents by utilizing training data and natural language understanding.

    count

    Number of results to return. The maximum for the count and offset values together in any one query is 10000.

    offset

    The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Query project notices.

    Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

    Declaration

    Swift

    public func queryNotices(
        projectID: String,
        filter: String? = nil,
        query: String? = nil,
        naturalLanguageQuery: String? = nil,
        count: Int? = nil,
        offset: Int? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<QueryNoticesResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    filter

    A cacheable query that excludes documents that don’t mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

    query

    A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.

    naturalLanguageQuery

    A natural language query that returns relevant documents by utilizing training data and natural language understanding.

    count

    Number of results to return. The maximum for the count and offset values together in any one query is 10000.

    offset

    The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • List fields.

    Gets a list of the unique fields (and their types) stored in the the specified collections.

    Declaration

    Swift

    public func listFields(
        projectID: String,
        collectionIDs: [String]? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ListFieldsResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionIDs

    Comma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • List component settings.

    Returns default configuration settings for components.

    Declaration

    Swift

    public func getComponentSettings(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ComponentSettingsResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Add a document.

    Add a document to a collection with optional metadata. Returns immediately after the system has accepted the document for processing.

    • The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.
    • You can set the Content-Type parameter on the file part to indicate the media type of the document. If the Content-Type parameter is missing or is one of the generic media types (for example, application/octet-stream), then the service attempts to automatically detect the document’s media type.
    • The following field names are reserved and are filtered out if present after normalization: id, score, highlight, and any field with the prefix of: _, +, or -
    • Fields with empty name values after normalization are filtered out before indexing.
    • Fields that contain the following characters after normalization are filtered out before indexing: # and , If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true. Note: You can assign an ID to a document that you add by appending the ID to the endpoint (/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}). If a document already exists with the specified ID, it is replaced. Note: This operation works with a file upload collection. It cannot be used to modify a collection that crawls an external data source.

    Declaration

    Swift

    public func addDocument(
        projectID: String,
        collectionID: String,
        file: Data? = nil,
        filename: String? = nil,
        fileContentType: String? = nil,
        metadata: String? = nil,
        xWatsonDiscoveryForce: Bool? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<DocumentAccepted>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    file

    The content of the document to ingest. For maximum supported file size limits, see the documentation.

    filename

    The filename for file.

    fileContentType

    The content type of file.

    metadata

    The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

    xWatsonDiscoveryForce

    When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Update a document.

    Replace an existing document or add a document with a specified document_id. Starts ingesting a document with optional metadata. If the document is uploaded to a collection that shares its data with another collection, the X-Watson-Discovery-Force header must be set to true. Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists. Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. Note: If an uploaded document is segmented, all segments are overwritten, even if the updated version of the document has fewer segments.

    Declaration

    Swift

    public func updateDocument(
        projectID: String,
        collectionID: String,
        documentID: String,
        file: Data? = nil,
        filename: String? = nil,
        fileContentType: String? = nil,
        metadata: String? = nil,
        xWatsonDiscoveryForce: Bool? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<DocumentAccepted>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    documentID

    The ID of the document.

    file

    The content of the document to ingest. For maximum supported file size limits, see the documentation.

    filename

    The filename for file.

    fileContentType

    The content type of file.

    metadata

    The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

    xWatsonDiscoveryForce

    When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete a document.

    If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code 200) with the status set to ‘deleted’. Note: This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. Note: Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the parent_document_id of a segment result.

    Declaration

    Swift

    public func deleteDocument(
        projectID: String,
        collectionID: String,
        documentID: String,
        xWatsonDiscoveryForce: Bool? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<DeleteDocumentResponse>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    documentID

    The ID of the document.

    xWatsonDiscoveryForce

    When true, the uploaded document is added to the collection even if the data for that collection is shared with other collections.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • List training queries.

    List the training queries for the specified project.

    Declaration

    Swift

    public func listTrainingQueries(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<TrainingQuerySet>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete training queries.

    Removes all training queries for the specified project.

    Declaration

    Swift

    public func deleteTrainingQueries(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Create training query.

    Add a query to the training data for this project. The query can contain a filter and natural language query.

    Declaration

    Swift

    public func createTrainingQuery(
        projectID: String,
        naturalLanguageQuery: String,
        examples: [TrainingExample],
        filter: String? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    naturalLanguageQuery

    The natural text query for the training query.

    examples

    Array of training examples.

    filter

    The filter used on the collection before the natural_language_query is applied.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Get a training data query.

    Get details for a specific training data query, including the query string and all examples.

    Declaration

    Swift

    public func getTrainingQuery(
        projectID: String,
        queryID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    queryID

    The ID of the query used for training.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Update a training query.

    Updates an existing training query and it’s examples.

    Declaration

    Swift

    public func updateTrainingQuery(
        projectID: String,
        queryID: String,
        naturalLanguageQuery: String,
        examples: [TrainingExample],
        filter: String? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<TrainingQuery>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    queryID

    The ID of the query used for training.

    naturalLanguageQuery

    The natural text query for the training query.

    examples

    Array of training examples.

    filter

    The filter used on the collection before the natural_language_query is applied.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete a training data query.

    Removes details from a training data query, including the query string and all examples.

    Declaration

    Swift

    public func deleteTrainingQuery(
        projectID: String,
        queryID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    queryID

    The ID of the query used for training.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Analyze a Document.

    Process a document and return it for realtime use. Supports JSON files only. The document is processed according to the collection’s configuration settings but is not stored in the collection. Note: This method is supported on installed instances of Discovery only.

    Declaration

    Swift

    public func analyzeDocument(
        projectID: String,
        collectionID: String,
        file: Data? = nil,
        filename: String? = nil,
        fileContentType: String,
        metadata: String? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<AnalyzedDocument>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    collectionID

    The ID of the collection.

    file

    The content of the document to ingest. For maximum supported file size limits, see the documentation.

    filename

    The filename for file.

    fileContentType

    The content type of file.

    metadata

    The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: { "Creator": "Johnny Appleseed", "Subject": "Apples" }.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • List Enrichments.

    Lists the enrichments available to this project. The Part of Speech and Sentiment of Phrases enrichments might be listed, but are reserved for internal use only.

    Declaration

    Swift

    public func listEnrichments(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Enrichments>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Create an enrichment.

    Create an enrichment for use with the specified project.

    Declaration

    Swift

    public func createEnrichment(
        projectID: String,
        enrichment: CreateEnrichment,
        file: Data? = nil,
        fileContentType: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    enrichment

    Information about a specific enrichment.

    file

    The enrichment file to upload.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Get enrichment.

    Get details about a specific enrichment.

    Declaration

    Swift

    public func getEnrichment(
        projectID: String,
        enrichmentID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    enrichmentID

    The ID of the enrichment.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Update an enrichment.

    Updates an existing enrichment’s name and description.

    Declaration

    Swift

    public func updateEnrichment(
        projectID: String,
        enrichmentID: String,
        name: String,
        description: String? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Enrichment>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    enrichmentID

    The ID of the enrichment.

    name

    A new name for the enrichment.

    description

    A new description for the enrichment.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete an enrichment.

    Deletes an existing enrichment from the specified project. Note: Only enrichments that have been manually created can be deleted.

    Declaration

    Swift

    public func deleteEnrichment(
        projectID: String,
        enrichmentID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    enrichmentID

    The ID of the enrichment.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • List projects.

    Lists existing projects for this instance.

    Declaration

    Swift

    public func listProjects(
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ListProjectsResponse>?, WatsonError?) -> Void)

    Parameters

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Create a Project.

    Create a new project for this instance.

    Declaration

    Swift

    public func createProject(
        name: String,
        type: String,
        defaultQueryParameters: DefaultQueryParams? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)

    Parameters

    name

    The human readable name of this project.

    type

    The type of project. The content_intelligence type is a Document Retrieval for Contracts project and the other type is a Custom project. The content_mining and content_intelligence types are available with Premium plan managed deployments and installed deployments only.

    defaultQueryParameters

    Default query parameters for this project.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Get project.

    Get details on the specified project.

    Declaration

    Swift

    public func getProject(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Update a project.

    Update the specified project’s name.

    Declaration

    Swift

    public func updateProject(
        projectID: String,
        name: String? = nil,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<ProjectDetails>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    name

    The new name to give this project.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete a project.

    Deletes the specified project. Important: Deleting a project deletes everything that is part of the specified project, including all collections.

    Declaration

    Swift

    public func deleteProject(
        projectID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    projectID

    The ID of the project. This information can be found from the Integrate and Deploy page in Discovery.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error

  • Delete labeled data.

    Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security. Note: This method is only supported on IBM Cloud instances of Discovery.

    Declaration

    Swift

    public func deleteUserData(
        customerID: String,
        headers: [String: String]? = nil,
        completionHandler: @escaping (WatsonResponse<Void>?, WatsonError?) -> Void)

    Parameters

    customerID

    The customer ID for which all data is to be deleted.

    headers

    A dictionary of request headers to be sent with this request.

    completionHandler

    A function executed when the request completes with a successful result or error