Here are simple steps to move from v0.11.0 to v1.0.0.
The constructor no longer accepts individual credentials like IAMApiKey, etc. We initialize authenticators from the core. The core supports various authentication mechanisms, choose the one appropriate to your instance and use case.
For example, to pass a IAM apikey:
service, serviceErr := servicev1.
NewServiceV1(&servicev1.ServiceV1Options{
URL: "{url}",
IAMApiKey: "{apikey}",
})import "github.com/IBM/go-sdk-core/core"
authenticator := &core.IamAuthenticator{
ApiKey: "{apikey}",
}
service, serviceErr := servicev1.
NewServiceV1(&servicev1.ServiceV1Options{
URL: "{url}",
Authenticator: authenticator,
})There are 5 authentication variants supplied in the SDK (shown below): You can also find detailed explanation Authentication
import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
authenticator := &core.BasicAuthenticator{
Username: "user1",
Password: "password1",
}
options := &myservicev1.MyServiceV1Options{
Authenticator: authenticator,
}
service := myservicev1.NewMyServiceV1(options)import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
authenticator := &core.BearerTokenAuthenticator{
BearerToken: token,
}
options := &myservicev1.MyServiceV1Options{
Authenticator: authenticator,
}
service := myservicev1.NewMyServiceV1(options)import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
authenticator := &core.CloudPakForDataAuthenticator{
URL: "https://my-cp4d-url"
Username: "user1",
Password: "password1",
DisableSSLVerification: true,
}
options := &myservicev1.MyServiceV1Options{
Authenticator: authenticator,
}
service := myservicev1.NewMyServiceV1(options)import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
...
authenticator := &core.IamAuthenticator{
ApiKey: "my-iam-apikey",
}
options := &myservicev1.MyServiceV1Options{
Authenticator: authenticator,
}
service := myservicev1.NewMyServiceV1(options)import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
...
options := &myservicev1.MyServiceV1Options{
Authenticator: &core.NoAuthAuthenticator{},
}
service := myservicev1.NewMyServiceV1(options)External env variables can be obtained from CREDENTIALS, Environment variables or VCAP_SERVICES
import (
"github.com/IBM/go-sdk-core/core"
"<appropriate-git-repo-url>/myservicev1"
)
...
authenticator := core.GetAuthenticatorFromEnvironment("my_service")
options := &myservicev1.MyServiceV1Options{
Authenticator: authenticator,
}
service := myservicev1.NewMyServiceV1(options)For functions which have a result, method calls will return result as the first param
response, responseErr := service.MethodCall(&servicev1.MethodCallOptions{})
result := discovery.GetListEnvironmentsResult(response)Result would be returned directly
result, response, responseErr := service.MethodCall(&servicev1.MethodCallOptions{})IncludeCountis no longer a parameter of the ListWorkspacesOptionsIncludeCountis no longer a parameter of the ListIntentsOptionsIncludeCountis no longer a parameter of the ListExamplesOptionsIncludeCountis no longer a parameter of the ListCounterexamplesOptionsIncludeCountis no longer a parameter of the ListEntitiesOptionsIncludeCountis no longer a parameter of the ListValuesOptionsIncludeCountis no longer a parameter of the ListSynonymsOptionsIncludeCountis no longer a parameter of the ListDialogNodesValueTypewas renamed toTypein the CreateValueOptions methodValueTypewas renamed toNewTypein the UpdateValueOptions methodNodeTypewas renamed toTypein the CreateDialogNodeOptionsNewNodeTypewas renamed toNewTypein the UpdateDialogNodeOptionsValueTypewas renamed toTypein the CreateValue modelNodeTypewas renamed toTypein the DialogNode modelActionTypewas renamed toTypein the DialogNodeAction modelQueryTypeproperty was added to the DialogNodeOutputGeneric modelQueryproperty was added to the DialogNodeOutputGeneric modelFilterproperty was added to the DialogNodeOutputGeneric modelDiscoveryVersionproperty was added to the DialogNodeOutputGeneric model- LogMessage model no longer has allows additonal properties
DialogRuntimeResponseGenericwas renamed toRuntimeResponseGeneric- RuntimeEntity model no longer has allows additonal properties
- RuntimeIntent model no longer has allows additonal properties
ValueTypewas renamed toTypein the Value model
ActionTypewas renamed toTypein the DialogNodeAction model- DialogRuntimeResponseGeneric was renamed to RuntimeResponseGeneric
convertToHTMLOptionsdoes not require a filename parameter
ReturnFieldswas renamed toReturnin the QueryOptionsLoggingOptOutwas renamed toXWatsonLoggingOptOutin the QueryOptionsSpellingSuggestionswas added to the QueryOptionscollectionIdsis no longer a parameter of the QueryOptionsReturnFieldswas renamed toReturnin the QueryNoticesOptionsLoggingOptOutwas renamed toXWatsonLoggingOptOutin the FederatedQueryOptionsReturnFieldswas renamed toReturnin the FederatedQueryOptionsReturnFieldswas renamed toReturnin the FederatedQueryNoticesOptionsEnrichmentNamewas renamed toEnrichmentin the Enrichment modelFieldTypewas renamed toTypein the Field modelFieldNamewas renamed toFieldin the Field model- TestConfigurationInEnvironment() method was removed
- QueryEntities() method was removed
- QueryRelations() method was removed
DefaultModelswas renamed toDefaultin the ListModelsOptionsTranslationOutputwas renamed toTranslationin the Translation model
Metadatawas renamed toTrainingMetadatain the CreateClassifierOptions
FinalResultswas renamed toFinalin the SpeakerLabelsResult modelFinalResultswas renamed toFinalin the SpeechRecognitionResult model
DetectFaces()method was removedClassNamewas renamed toClassin the ClassResult modelClassNamewas renamed toClassin the ModelClass model
- New Service!