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{})
IncludeCount
is no longer a parameter of the ListWorkspacesOptionsIncludeCount
is no longer a parameter of the ListIntentsOptionsIncludeCount
is no longer a parameter of the ListExamplesOptionsIncludeCount
is no longer a parameter of the ListCounterexamplesOptionsIncludeCount
is no longer a parameter of the ListEntitiesOptionsIncludeCount
is no longer a parameter of the ListValuesOptionsIncludeCount
is no longer a parameter of the ListSynonymsOptionsIncludeCount
is no longer a parameter of the ListDialogNodesValueType
was renamed toType
in the CreateValueOptions methodValueType
was renamed toNewType
in the UpdateValueOptions methodNodeType
was renamed toType
in the CreateDialogNodeOptionsNewNodeType
was renamed toNewType
in the UpdateDialogNodeOptionsValueType
was renamed toType
in the CreateValue modelNodeType
was renamed toType
in the DialogNode modelActionType
was renamed toType
in the DialogNodeAction modelQueryType
property was added to the DialogNodeOutputGeneric modelQuery
property was added to the DialogNodeOutputGeneric modelFilter
property was added to the DialogNodeOutputGeneric modelDiscoveryVersion
property was added to the DialogNodeOutputGeneric model- LogMessage model no longer has allows additonal properties
DialogRuntimeResponseGeneric
was renamed toRuntimeResponseGeneric
- RuntimeEntity model no longer has allows additonal properties
- RuntimeIntent model no longer has allows additonal properties
ValueType
was renamed toType
in the Value model
ActionType
was renamed toType
in the DialogNodeAction model- DialogRuntimeResponseGeneric was renamed to RuntimeResponseGeneric
convertToHTMLOptions
does not require a filename parameter
ReturnFields
was renamed toReturn
in the QueryOptionsLoggingOptOut
was renamed toXWatsonLoggingOptOut
in the QueryOptionsSpellingSuggestions
was added to the QueryOptionscollectionIds
is no longer a parameter of the QueryOptionsReturnFields
was renamed toReturn
in the QueryNoticesOptionsLoggingOptOut
was renamed toXWatsonLoggingOptOut
in the FederatedQueryOptionsReturnFields
was renamed toReturn
in the FederatedQueryOptionsReturnFields
was renamed toReturn
in the FederatedQueryNoticesOptionsEnrichmentName
was renamed toEnrichment
in the Enrichment modelFieldType
was renamed toType
in the Field modelFieldName
was renamed toField
in the Field model- TestConfigurationInEnvironment() method was removed
- QueryEntities() method was removed
- QueryRelations() method was removed
DefaultModels
was renamed toDefault
in the ListModelsOptionsTranslationOutput
was renamed toTranslation
in the Translation model
Metadata
was renamed toTrainingMetadata
in the CreateClassifierOptions
FinalResults
was renamed toFinal
in the SpeakerLabelsResult modelFinalResults
was renamed toFinal
in the SpeechRecognitionResult model
DetectFaces()
method was removedClassName
was renamed toClass
in the ClassResult modelClassName
was renamed toClass
in the ModelClass model
- New Service!