Skip to content

Commit

Permalink
feat(DiscoveryV1): Add web crawlers to the list of possible sources
Browse files Browse the repository at this point in the history
Also allow Sharepoint version to be specified
  • Loading branch information
Anthony Oliveri committed Jan 17, 2019
1 parent 915ce68 commit 5a4a62e
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Source/DiscoveryV1/Discovery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,7 @@ public class Discovery {
- `box` indicates the credentials are used to connect an instance of Enterprise Box.
- `salesforce` indicates the credentials are used to connect to Salesforce.
- `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the credentials are used to perform a web crawl.
- parameter credentialDetails: Object containing details of the stored credentials.
Obtain credentials for your source from the administrator of the source.
- parameter headers: A dictionary of request headers to be sent with this request.
Expand Down Expand Up @@ -3794,6 +3795,7 @@ public class Discovery {
- `box` indicates the credentials are used to connect an instance of Enterprise Box.
- `salesforce` indicates the credentials are used to connect to Salesforce.
- `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the credentials are used to perform a web crawl.
- parameter credentialDetails: Object containing details of the stored credentials.
Obtain credentials for your source from the administrator of the source.
- parameter headers: A dictionary of request headers to be sent with this request.
Expand Down
81 changes: 71 additions & 10 deletions Source/DiscoveryV1/Models/CredentialDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,35 @@ public struct CredentialDetails: Codable, Equatable {
the **source_type**. The following combinations are possible:
- `"source_type": "box"` - valid `credential_type`s: `oauth2`
- `"source_type": "salesforce"` - valid `credential_type`s: `username_password`
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml`.
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml` with **source_version** of `online`, or
`ntml_v1` with **source_version** of `2016`
- `"source_type": "web_crawl"` - valid `credential_type`s: `noauth` or `basic`.
*/
public enum CredentialType: String {
case oauth2 = "oauth2"
case saml = "saml"
case usernamePassword = "username_password"
case noauth = "noauth"
case basic = "basic"
case ntmlV1 = "ntml_v1"
}

/**
The type of Sharepoint repository to connect to. Only valid, and required, with a **source_type** of `sharepoint`.
*/
public enum SourceVersion: String {
case online = "online"
case sp2016 = "2016"
}

/**
The authentication method for this credentials definition. The **credential_type** specified must be supported by
the **source_type**. The following combinations are possible:
- `"source_type": "box"` - valid `credential_type`s: `oauth2`
- `"source_type": "salesforce"` - valid `credential_type`s: `username_password`
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml`.
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml` with **source_version** of `online`, or
`ntml_v1` with **source_version** of `2016`
- `"source_type": "web_crawl"` - valid `credential_type`s: `noauth` or `basic`.
*/
public var credentialType: String?

Expand All @@ -58,13 +73,13 @@ public struct CredentialDetails: Codable, Equatable {

/**
The **url** of the source that these credentials connect to. Only valid, and required, with a **credential_type**
of `username_password`.
of `username_password`, `noauth`, and `basic`.
*/
public var url: String?

/**
The **username** of the source that these credentials connect to. Only valid, and required, with a
**credential_type** of `saml` and `username_password`.
**credential_type** of `saml`, `username_password`, `basic`, or `ntml_v1`.
*/
public var username: String?

Expand Down Expand Up @@ -110,13 +125,36 @@ public struct CredentialDetails: Codable, Equatable {

/**
The **password** of the source that these credentials connect to. Only valid, and required, with
**credential_type**s of `saml` and `username_password`.
**credential_type**s of `saml`, `username_password`, `basic`, or `ntml_v1`.
**Note:** When used with a **source_type** of `salesforce`, the password consists of the Salesforce password and a
valid Salesforce security token concatenated. This value is never returned and is only used when creating or
modifying **credentials**.
*/
public var password: String?

/**
The ID of the **gateway** to be connected through (when connecting to intranet sites). Only valid with a
**credential_type** of `noauth`, `basic`, or `ntml_v1`. Gateways are created using the
`/v1/environments/{environment_id}/gateways` methods.
*/
public var gatewayID: String?

/**
The type of Sharepoint repository to connect to. Only valid, and required, with a **source_type** of `sharepoint`.
*/
public var sourceVersion: String?

/**
SharePoint OnPrem WebApplication URL. Only valid, and required, with a **source_version** of `2016`.
*/
public var webApplicationURL: String?

/**
The domain used to log in to your OnPrem SharePoint account. Only valid, and required, with a **source_version** of
`2016`.
*/
public var domain: String?

// Map each property name to the key that shall be used for encoding/decoding.
private enum CodingKeys: String, CodingKey {
case credentialType = "credential_type"
Expand All @@ -131,6 +169,10 @@ public struct CredentialDetails: Codable, Equatable {
case privateKey = "private_key"
case passphrase = "passphrase"
case password = "password"
case gatewayID = "gateway_id"
case sourceVersion = "source_version"
case webApplicationURL = "web_application_url"
case domain = "domain"
}

/**
Expand All @@ -140,15 +182,17 @@ public struct CredentialDetails: Codable, Equatable {
specified must be supported by the **source_type**. The following combinations are possible:
- `"source_type": "box"` - valid `credential_type`s: `oauth2`
- `"source_type": "salesforce"` - valid `credential_type`s: `username_password`
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml`.
- `"source_type": "sharepoint"` - valid `credential_type`s: `saml` with **source_version** of `online`, or
`ntml_v1` with **source_version** of `2016`
- `"source_type": "web_crawl"` - valid `credential_type`s: `noauth` or `basic`.
- parameter clientID: The **client_id** of the source that these credentials connect to. Only valid, and
required, with a **credential_type** of `oauth2`.
- parameter enterpriseID: The **enterprise_id** of the Box site that these credentials connect to. Only valid,
and required, with a **source_type** of `box`.
- parameter url: The **url** of the source that these credentials connect to. Only valid, and required, with a
**credential_type** of `username_password`.
**credential_type** of `username_password`, `noauth`, and `basic`.
- parameter username: The **username** of the source that these credentials connect to. Only valid, and
required, with a **credential_type** of `saml` and `username_password`.
required, with a **credential_type** of `saml`, `username_password`, `basic`, or `ntml_v1`.
- parameter organizationURL: The **organization_url** of the source that these credentials connect to. Only
valid, and required, with a **credential_type** of `saml`.
- parameter siteCollectionPath: The **site_collection.path** of the source that these credentials connect to.
Expand All @@ -166,10 +210,19 @@ public struct CredentialDetails: Codable, Equatable {
required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or
modifying **credentials**.
- parameter password: The **password** of the source that these credentials connect to. Only valid, and
required, with **credential_type**s of `saml` and `username_password`.
required, with **credential_type**s of `saml`, `username_password`, `basic`, or `ntml_v1`.
**Note:** When used with a **source_type** of `salesforce`, the password consists of the Salesforce password and
a valid Salesforce security token concatenated. This value is never returned and is only used when creating or
modifying **credentials**.
- parameter gatewayID: The ID of the **gateway** to be connected through (when connecting to intranet sites).
Only valid with a **credential_type** of `noauth`, `basic`, or `ntml_v1`. Gateways are created using the
`/v1/environments/{environment_id}/gateways` methods.
- parameter sourceVersion: The type of Sharepoint repository to connect to. Only valid, and required, with a
**source_type** of `sharepoint`.
- parameter webApplicationURL: SharePoint OnPrem WebApplication URL. Only valid, and required, with a
**source_version** of `2016`.
- parameter domain: The domain used to log in to your OnPrem SharePoint account. Only valid, and required, with
a **source_version** of `2016`.
- returns: An initialized `CredentialDetails`.
*/
Expand All @@ -185,7 +238,11 @@ public struct CredentialDetails: Codable, Equatable {
publicKeyID: String? = nil,
privateKey: String? = nil,
passphrase: String? = nil,
password: String? = nil
password: String? = nil,
gatewayID: String? = nil,
sourceVersion: String? = nil,
webApplicationURL: String? = nil,
domain: String? = nil
)
{
self.credentialType = credentialType
Expand All @@ -200,6 +257,10 @@ public struct CredentialDetails: Codable, Equatable {
self.privateKey = privateKey
self.passphrase = passphrase
self.password = password
self.gatewayID = gatewayID
self.sourceVersion = sourceVersion
self.webApplicationURL = webApplicationURL
self.domain = domain
}

}
4 changes: 4 additions & 0 deletions Source/DiscoveryV1/Models/Credentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public struct Credentials: Codable, Equatable {
- `box` indicates the credentials are used to connect an instance of Enterprise Box.
- `salesforce` indicates the credentials are used to connect to Salesforce.
- `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the credentials are used to perform a web crawl.
*/
public enum SourceType: String {
case box = "box"
case salesforce = "salesforce"
case sharepoint = "sharepoint"
case webCrawl = "web_crawl"
}

/**
Expand All @@ -43,6 +45,7 @@ public struct Credentials: Codable, Equatable {
- `box` indicates the credentials are used to connect an instance of Enterprise Box.
- `salesforce` indicates the credentials are used to connect to Salesforce.
- `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the credentials are used to perform a web crawl.
*/
public var sourceType: String?

Expand All @@ -67,6 +70,7 @@ public struct Credentials: Codable, Equatable {
- `box` indicates the credentials are used to connect an instance of Enterprise Box.
- `salesforce` indicates the credentials are used to connect to Salesforce.
- `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the credentials are used to perform a web crawl.
- parameter credentialDetails: Object containing details of the stored credentials.
Obtain credentials for your source from the administrator of the source.
Expand Down
4 changes: 4 additions & 0 deletions Source/DiscoveryV1/Models/Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ public struct Source: Codable, Equatable {
- `box` indicates the configuration is to connect an instance of Enterprise Box.
- `salesforce` indicates the configuration is to connect to Salesforce.
- `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the configuration is to perform a web page crawl.
*/
public enum TypeEnum: String {
case box = "box"
case salesforce = "salesforce"
case sharepoint = "sharepoint"
case webCrawl = "web_crawl"
}

/**
The type of source to connect to.
- `box` indicates the configuration is to connect an instance of Enterprise Box.
- `salesforce` indicates the configuration is to connect to Salesforce.
- `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the configuration is to perform a web page crawl.
*/
public var type: String?

Expand Down Expand Up @@ -73,6 +76,7 @@ public struct Source: Codable, Equatable {
- `box` indicates the configuration is to connect an instance of Enterprise Box.
- `salesforce` indicates the configuration is to connect to Salesforce.
- `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online.
- `web_crawl` indicates the configuration is to perform a web page crawl.
- parameter credentialID: The **credential_id** of the credentials to use to connect to the source. Credentials
are defined using the **credentials** method. The **source_type** of the credentials used must match the **type**
field specified in this object.
Expand Down
13 changes: 12 additions & 1 deletion Source/DiscoveryV1/Models/SourceOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ public struct SourceOptions: Codable, Equatable {
*/
public var siteCollections: [SourceOptionsSiteColl]?

/**
Array of Web page URLs to begin crawling the web from. Only valid and required when the **type** field of the
**source** object is set to `web_crawl`.
*/
public var urls: [SourceOptionsWebCrawl]?

// Map each property name to the key that shall be used for encoding/decoding.
private enum CodingKeys: String, CodingKey {
case folders = "folders"
case objects = "objects"
case siteCollections = "site_collections"
case urls = "urls"
}

/**
Expand All @@ -56,18 +63,22 @@ public struct SourceOptions: Codable, Equatable {
- parameter siteCollections: Array of Microsoft SharePointoint Online site collections to crawl from the
SharePoint source. Only valid and required when the **type** field of the **source** object is set to
`sharepoint`.
- parameter urls: Array of Web page URLs to begin crawling the web from. Only valid and required when the
**type** field of the **source** object is set to `web_crawl`.
- returns: An initialized `SourceOptions`.
*/
public init(
folders: [SourceOptionsFolder]? = nil,
objects: [SourceOptionsObject]? = nil,
siteCollections: [SourceOptionsSiteColl]? = nil
siteCollections: [SourceOptionsSiteColl]? = nil,
urls: [SourceOptionsWebCrawl]? = nil
)
{
self.folders = folders
self.objects = objects
self.siteCollections = siteCollections
self.urls = urls
}

}
Loading

0 comments on commit 5a4a62e

Please sign in to comment.