diff --git a/services/cognitiveservices/v2.0/textanalytics/client.go b/services/cognitiveservices/v2.0/textanalytics/client.go index 428572bd337e..b4a4838016fe 100644 --- a/services/cognitiveservices/v2.0/textanalytics/client.go +++ b/services/cognitiveservices/v2.0/textanalytics/client.go @@ -113,7 +113,6 @@ func (client BaseClient) DetectLanguageSender(req *http.Request) (*http.Response func (client BaseClient) DetectLanguageResponder(resp *http.Response) (result LanguageBatchResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -185,7 +184,6 @@ func (client BaseClient) EntitiesSender(req *http.Request) (*http.Response, erro func (client BaseClient) EntitiesResponder(resp *http.Response) (result EntitiesBatchResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -257,7 +255,6 @@ func (client BaseClient) KeyPhrasesSender(req *http.Request) (*http.Response, er func (client BaseClient) KeyPhrasesResponder(resp *http.Response) (result KeyPhraseBatchResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -329,7 +326,6 @@ func (client BaseClient) SentimentSender(req *http.Request) (*http.Response, err func (client BaseClient) SentimentResponder(resp *http.Response) (result SentimentBatchResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/cognitiveservices/v2.0/textanalytics/models.go b/services/cognitiveservices/v2.0/textanalytics/models.go index 14445ddadea2..af082a1e3cd2 100644 --- a/services/cognitiveservices/v2.0/textanalytics/models.go +++ b/services/cognitiveservices/v2.0/textanalytics/models.go @@ -48,6 +48,12 @@ type EntitiesBatchResult struct { Errors *[]ErrorRecord `json:"errors,omitempty"` } +// MarshalJSON is the custom marshaler for EntitiesBatchResult. +func (ebr EntitiesBatchResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // EntitiesBatchResultItem ... type EntitiesBatchResultItem struct { // ID - READ-ONLY; Unique document identifier. @@ -56,6 +62,12 @@ type EntitiesBatchResultItem struct { Entities *[]EntityRecord `json:"entities,omitempty"` } +// MarshalJSON is the custom marshaler for EntitiesBatchResultItem. +func (ebri EntitiesBatchResultItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // EntityRecord ... type EntityRecord struct { // Name - Entity formal name. @@ -72,6 +84,24 @@ type EntityRecord struct { BingID *string `json:"bingId,omitempty"` } +// MarshalJSON is the custom marshaler for EntityRecord. +func (er EntityRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.Name != nil { + objectMap["name"] = er.Name + } + if er.WikipediaLanguage != nil { + objectMap["wikipediaLanguage"] = er.WikipediaLanguage + } + if er.WikipediaID != nil { + objectMap["wikipediaId"] = er.WikipediaID + } + if er.BingID != nil { + objectMap["bingId"] = er.BingID + } + return json.Marshal(objectMap) +} + // ErrorRecord ... type ErrorRecord struct { // ID - Input document unique identifier the error refers to. @@ -111,6 +141,12 @@ type KeyPhraseBatchResult struct { Errors *[]ErrorRecord `json:"errors,omitempty"` } +// MarshalJSON is the custom marshaler for KeyPhraseBatchResult. +func (kpbr KeyPhraseBatchResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // KeyPhraseBatchResultItem ... type KeyPhraseBatchResultItem struct { // KeyPhrases - READ-ONLY; A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. @@ -119,6 +155,12 @@ type KeyPhraseBatchResultItem struct { ID *string `json:"id,omitempty"` } +// MarshalJSON is the custom marshaler for KeyPhraseBatchResultItem. +func (kpbri KeyPhraseBatchResultItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // LanguageBatchResult ... type LanguageBatchResult struct { autorest.Response `json:"-"` @@ -128,6 +170,12 @@ type LanguageBatchResult struct { Errors *[]ErrorRecord `json:"errors,omitempty"` } +// MarshalJSON is the custom marshaler for LanguageBatchResult. +func (lbr LanguageBatchResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // LanguageBatchResultItem ... type LanguageBatchResultItem struct { // ID - READ-ONLY; Unique document identifier. @@ -136,6 +184,12 @@ type LanguageBatchResultItem struct { DetectedLanguages *[]DetectedLanguage `json:"detectedLanguages,omitempty"` } +// MarshalJSON is the custom marshaler for LanguageBatchResultItem. +func (lbri LanguageBatchResultItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // MatchRecord ... type MatchRecord struct { // Text - Entity text as appears in the request. @@ -169,6 +223,12 @@ type SentimentBatchResult struct { Errors *[]ErrorRecord `json:"errors,omitempty"` } +// MarshalJSON is the custom marshaler for SentimentBatchResult. +func (sbr SentimentBatchResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // SentimentBatchResultItem ... type SentimentBatchResultItem struct { // Score - READ-ONLY; A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text. @@ -176,3 +236,9 @@ type SentimentBatchResultItem struct { // ID - READ-ONLY; Unique document identifier. ID *string `json:"id,omitempty"` } + +// MarshalJSON is the custom marshaler for SentimentBatchResultItem. +func (sbri SentimentBatchResultItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/cognitiveservices/v2.0/textanalytics/version.go b/services/cognitiveservices/v2.0/textanalytics/version.go index d34ef15ce252..f81ed0c9940a 100644 --- a/services/cognitiveservices/v2.0/textanalytics/version.go +++ b/services/cognitiveservices/v2.0/textanalytics/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " textanalytics/v2.0" + return "Azure-SDK-For-Go/" + Version() + " textanalytics/v2.0" } // Version returns the semantic version (see http://semver.org) of the client.