forked from watson-developer-cloud/swift-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AssistantV1): Add metadata field to Context model
metadata uses a new type called MessageContextMetadata
- Loading branch information
Anthony Oliveri
committed
Dec 11, 2018
1 parent
5cefc7b
commit 13a90c1
Showing
3 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright IBM Corporation 2018 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
**/ | ||
|
||
import Foundation | ||
|
||
/** | ||
Metadata related to the message. | ||
*/ | ||
public struct MessageContextMetadata: Codable, Equatable { | ||
|
||
/** | ||
A label identifying the deployment environment, used for filtering log data. This string cannot contain carriage | ||
return, newline, or tab characters. | ||
*/ | ||
public var deployment: String? | ||
|
||
/** | ||
A string value that identifies the user who is interacting with the workspace. The client must provide a unique | ||
identifier for each individual end user who accesses the application. For Plus and Premium plans, this user ID is | ||
used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab | ||
characters. | ||
*/ | ||
public var userID: String? | ||
|
||
// Map each property name to the key that shall be used for encoding/decoding. | ||
private enum CodingKeys: String, CodingKey { | ||
case deployment = "deployment" | ||
case userID = "user_id" | ||
} | ||
|
||
/** | ||
Initialize a `MessageContextMetadata` with member variables. | ||
|
||
- parameter deployment: A label identifying the deployment environment, used for filtering log data. This string | ||
cannot contain carriage return, newline, or tab characters. | ||
- parameter userID: A string value that identifies the user who is interacting with the workspace. The client | ||
must provide a unique identifier for each individual end user who accesses the application. For Plus and Premium | ||
plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage | ||
return, newline, or tab characters. | ||
|
||
- returns: An initialized `MessageContextMetadata`. | ||
*/ | ||
public init( | ||
deployment: String? = nil, | ||
userID: String? = nil | ||
) | ||
{ | ||
self.deployment = deployment | ||
self.userID = userID | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters