|
| 1 | +### .NET SDK V4 Migration guide |
| 2 | + |
| 3 | +#### Authentication |
| 4 | + |
| 5 | +##### v3.x.x |
| 6 | + |
| 7 | +Previously different `Config` objects were used for authentication. |
| 8 | + |
| 9 | +```cs |
| 10 | +void Example() |
| 11 | +{ |
| 12 | + IamConfig iamConfig = new IamConfig( |
| 13 | + apikey: "{iam-apikey}"); |
| 14 | + service = new AssistantService("{versionDate}", iamConfig); |
| 15 | + service.SetEndpoint("{service-endpoint}"); |
| 16 | +} |
| 17 | +``` |
| 18 | + |
| 19 | +Or constructors accepted `TokenOptions` or `username` and `password`. |
| 20 | + |
| 21 | +```cs |
| 22 | +void Example() |
| 23 | +{ |
| 24 | + service = new AssistantService("{tokenOptions}", "{versionDate}"); |
| 25 | + service2 = new DiscoveryService("{username}", "{password}", "{versionDate}"); |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +##### v4.x.x |
| 30 | + |
| 31 | +Now we use an `Authenticator` to authenticate the service. Available authentication schemes include `IamAuthenticator`, `BasicAuthenticator`, `CloudPakForDataAuthenticator` and `BearerTokenAuthenticator` |
| 32 | + |
| 33 | +###### IamAuthenticator |
| 34 | + |
| 35 | +```cs |
| 36 | +void Example() |
| 37 | +{ |
| 38 | + IamAuthenticator authenticator = new IamAuthenticator( |
| 39 | + apikey: "{apikey}"); |
| 40 | + var service = new AssistantService("{versionDate}", authenticator); |
| 41 | + service.SetServiceUrl("{serviceUrl}"); |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +##### BasicAuthenticator |
| 46 | + |
| 47 | +```cs |
| 48 | +void Example() |
| 49 | +{ |
| 50 | + BasicAuthenticator authenticator = new BasicAuthenticator( |
| 51 | + username: "{username}", |
| 52 | + password: "{password}"); |
| 53 | + var service = new AssistantService("{versionDate}", authenticator); |
| 54 | + service.SetServiceUrl("{serviceUrl}"); |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +###### BearerTokenAuthenticator |
| 59 | + |
| 60 | +```cs |
| 61 | +void Example() |
| 62 | +{ |
| 63 | + BearerTokenAuthenticator authenticator = new BearerTokenAuthenticator( |
| 64 | + bearerToken: "{bearerToken}"); |
| 65 | + var service = new AssistantService("{versionDate}", authenticator); |
| 66 | + service.SetServiceUrl("{serviceUrl}"); |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +###### CloudPakForDataAuthenticator |
| 71 | + |
| 72 | +```cs |
| 73 | +void Example() |
| 74 | +{ |
| 75 | + CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator( |
| 76 | + url: "https://{cp4d_cluster_host}{:port}", |
| 77 | + username: "{username}", |
| 78 | + password: "{password}"); |
| 79 | + var service = new AssistantService("{version-date}", authenticator); |
| 80 | + service.SetServiceUrl("{serviceUrl}"); |
| 81 | + var results = service.Message("{workspace-id}", "{message-request}"); |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +Constructors that did not take an `Authenticator` were removed. |
| 86 | + |
| 87 | +#### Supplying credentials |
| 88 | + |
| 89 | +You can supply credentials to your service using external `ibm-credentials.env` files. |
| 90 | + |
| 91 | +```cs |
| 92 | +AssistantService service = new AssistantService("{version-date}"); |
| 93 | +var listWorkspacesResult = service.ListWorkspaces(); |
| 94 | +``` |
| 95 | + |
| 96 | +##### v3.x.x |
| 97 | + |
| 98 | +Previously we would look for these files first in the system `home` directory, followed by the current project directory. |
| 99 | + |
| 100 | +##### v4.x.x |
| 101 | +Now in order to allow developers to have different configurations for each project we look first in the current project directory, followed by the home directory. |
| 102 | + |
| 103 | +#### Setting the service url |
| 104 | + |
| 105 | +##### v3.x.x |
| 106 | + |
| 107 | +Previously we set the service url via SetEndpoint() method. |
| 108 | + |
| 109 | +```cs |
| 110 | +void Example() |
| 111 | +{ |
| 112 | + IamConfig iamConfig = new IamConfig( |
| 113 | + apikey: "{iam-apikey}"); |
| 114 | + service = new AssistantService("{versionDate}", iamConfig); |
| 115 | + service.SetEndpoint("{service-endpoint}"); |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +##### v4.x.x |
| 120 | + |
| 121 | +Now we set the service url via the SetServiceUrl() method. |
| 122 | + |
| 123 | +```cs |
| 124 | +void Example() |
| 125 | +{ |
| 126 | + IamAuthenticator authenticator = new IamAuthenticator( |
| 127 | + apikey: "{apikey}"); |
| 128 | + var service = new AssistantService("{versionDate}", authenticator); |
| 129 | + service.SetServiceUrl("{serviceUrl}"); |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +#### Service changes |
| 134 | + |
| 135 | +##### Assistant v1 |
| 136 | + |
| 137 | +* `includeCount` is no longer a parameter of the `ListWorkspaces()` method |
| 138 | +* `includeCount` is no longer a parameter of the `ListIntents()` method |
| 139 | +* `includeCount` is no longer a parameter of the `ListExamples()` method |
| 140 | +* `includeCount` is no longer a parameter of the `ListCounterexamples()` method |
| 141 | +* `includeCount` is no longer a parameter of the `ListEntities()` method |
| 142 | +* `includeCount` is no longer a parameter of the `ListValues()` method |
| 143 | +* `includeCount` is no longer a parameter of the `ListSynonyms()` method |
| 144 | +* `includeCount` is no longer a parameter of the `ListDialogNodes()` method |
| 145 | +* `valueType` was renamed to `type` in the `CreateValue()` method |
| 146 | +* `newValueType` was renamed to `newType` in the `UpdateValue()` method |
| 147 | +* `nodeType` was renamed to `type` in the `CreateDialogNode()` method |
| 148 | +* `nodeType` was renamed to `type` in the `CreateDialogNode()` method |
| 149 | +* `newNodeType` was renamed to `newType` in the `UpdateDialogNode()` method |
| 150 | +* `ValueTypeEnumValue` was renamed to `TypeEnumValue` in the `CreateValue` model |
| 151 | +* `ValueType` was renamed to `Type` in the `CreateValue` model |
| 152 | +* `NodeTypeEnumValue` was renamed to `TypeEnumValue` in the `DialogNode` model |
| 153 | +* `NodeType` was renamed to `Type` in the `DialogNode` model |
| 154 | +* `ActionTypeEnumValue` was renamed to `TypeEnumValue` in the `DialogNodeAction` model |
| 155 | +* `ActionType` was renamed to `Type` in the `DialogNodeAction` model |
| 156 | +* `SEARCH_SKILL` constant was added to the `DialogNodeOutputGeneric` model |
| 157 | +* `QueryTypeEnumValue` constants were added to the `DialogNodeOutputGeneric` model |
| 158 | +* `QueryType` property was added to the `DialogNodeOutputGeneric` model |
| 159 | +* `Query` property was added to the `DialogNodeOutputGeneric` model |
| 160 | +* `Filter` property was added to the `DialogNodeOutputGeneric` model |
| 161 | +* `DiscoveryVersion` property was added to the `DialogNodeOutputGeneric` model |
| 162 | +* `Output` property type was converted from `Dictionary<string, object>` to `DialogSuggestionOutput` in the `DialogSuggestion` model |
| 163 | +* `LogMessage` model no longer has `additionalProperties` |
| 164 | +* `DialogRuntimeResponseGeneric` was renamed to `RuntimeResponseGeneric` |
| 165 | +* `RuntimeEntity` model no longer has `additionalProperties` |
| 166 | +* `RuntimeIntent` model no longer has `additionalProperties` |
| 167 | +* `ValueTypeEnumValue` was renamed to `TypeEnumValue` in the `Value` model |
| 168 | +* `ValueType` was renamed to `Type` in the `Value` model |
| 169 | + |
| 170 | +##### Assistant v2 |
| 171 | + |
| 172 | +* `ActionTypeEnumValue` was renamed to `TypeEnumValue` in the `DialogNodeAction` model |
| 173 | +* `ActionType` was renamed to `Type` in the `DialogNodeAction` model |
| 174 | +* `DialogRuntimeResponseGeneric` was renamed to `RuntimeResponseGeneric` |
| 175 | + |
| 176 | +##### Compare Comply v1 |
| 177 | + |
| 178 | +* `ConvertToHtml()` method does not require a `filename` parameter |
| 179 | + |
| 180 | +##### Discovery v1 |
| 181 | + |
| 182 | +* `returnFields` was renamed to `_return` in the `Query()` method |
| 183 | +* `loggingOptOut` was renamed to `xWatsonLoggingOptOut` in the `Query()` method |
| 184 | +* `spellingSuggestions` was added to the `Query()` method |
| 185 | +* `collectionIds` is no longer a parameter of the `Query()` method |
| 186 | +* `returnFields` was renamed to `_return` in the `QueryNotices()` method |
| 187 | +* `loggingOptOut` was renamed to `xWatsonLoggingOptOut` in the `FederatedQuery()` method |
| 188 | +* `collectionIds` is now required in the `FederatedQuery()` method |
| 189 | +* `collectionIds` changed position in the `FederatedQuery()` method |
| 190 | +* `returnFields` was renamed to `_return` in the `FederatedQuery()` method |
| 191 | +* `returnFields` was renamed to `_return` in the `FederatedQueryNotices()` method |
| 192 | +* `EnrichmentName` was renamed to `_Enrichment` in the `Enrichment` model |
| 193 | +* `FieldTypeEnumValue` was renamed to `TypeEnumValue` in the `Field` model |
| 194 | +* `FieldType` was renamed to `Type` in the `Field` model |
| 195 | +* `FieldName` was renamed to `_Field` in the `Field` model |
| 196 | +* `TestConfigurationInEnvironment()` method was removed |
| 197 | +* `QueryEntities()` method was removed |
| 198 | +* `QueryRelations()` method was removed |
| 199 | + |
| 200 | +##### Language Translator v3 |
| 201 | + |
| 202 | +* `defaultModels` was renamed to `_default` in the `ListModels()` method |
| 203 | +* `TranslationOutput` was renamed to `_Translation` in the `Translation` model |
| 204 | + |
| 205 | +##### Natural Language Classifier v1 |
| 206 | + |
| 207 | +* `metadata` was renamed to `trainingMetadata` in the `CreateClassifier()` method |
| 208 | + |
| 209 | +##### Speech to Text v1 |
| 210 | + |
| 211 | +* `processingMetrics` is no longer a parameter of the `Recognize()` method |
| 212 | +* `processingMetricsInterval` is no longer a parameter of the `Recognize()` method |
| 213 | +* `strict` is no longer a parameter of the `TrainLanguageModel()` method |
| 214 | +* `strict` is no longer a parameter of the `TrainAcousticModel()` method |
| 215 | +* `FinalResults` was renamed to `Final` in the `SpeakerLabelsResult` model |
| 216 | +* `FinalResults` was renamed to `Final` in the `SpeechRecognitionResult` model |
| 217 | + |
| 218 | +##### Visual Recognition v3 |
| 219 | + |
| 220 | +* `DetectFaces()` method was removed |
| 221 | +* `ClassName` was renamed to `_Class` in the `ClassResult` model |
| 222 | +* `ClassName` was renamed to `_Class` in the `ModelClass` model |
| 223 | + |
| 224 | +##### Visual Recognition v4 |
| 225 | + |
| 226 | +* New service! |
0 commit comments