Skip to content

Commit

Permalink
Merge pull request Azure#12 from samvaity/text-analytics
Browse files Browse the repository at this point in the history
Text analytics update error model
  • Loading branch information
samvaity authored Dec 9, 2019
2 parents e834106 + b39b94e commit 65d8244
Show file tree
Hide file tree
Showing 18 changed files with 293 additions and 203 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package com.azure.cs.textanalytics.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.cs.textanalytics.models.Error;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
Expand All @@ -22,7 +23,7 @@ public final class DocumentError {
* Document Error.
*/
@JsonProperty(value = "error", required = true)
private Object error;
private Error error;

/**
* Get the id property: Document Id.
Expand All @@ -49,7 +50,7 @@ public DocumentError setId(String id) {
*
* @return the error value.
*/
public Object getError() {
public Error getError() {
return this.error;
}

Expand All @@ -59,7 +60,7 @@ public Object getError() {
* @param error the error value to set.
* @return the DocumentError object itself.
*/
public DocumentError setError(Object error) {
public DocumentError setError(Error error) {
this.error = error;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.azure.core.annotation.Fluent;
import com.azure.cs.textanalytics.models.TextBatchStatistics;
import com.azure.cs.textanalytics.models.DocumentError;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.azure.core.annotation.Fluent;
import com.azure.cs.textanalytics.models.TextBatchStatistics;
import com.azure.cs.textanalytics.models.DocumentError;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.azure.core.annotation.Fluent;
import com.azure.cs.textanalytics.models.TextBatchStatistics;
import com.azure.cs.textanalytics.models.DocumentError;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.azure.core.annotation.Fluent;
import com.azure.cs.textanalytics.models.TextBatchStatistics;
import com.azure.cs.textanalytics.models.DocumentError;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ public final class DetectLanguageResult extends DocumentResult {
private DetectedLanguage primaryLanguage;
private List<DetectedLanguage> detectedLanguages;

public DetectLanguageResult(String id, TextDocumentStatistics textDocumentStatistics, Object error, DetectedLanguage primaryLanguage, List<DetectedLanguage> detectedLanguages) {
super(id, textDocumentStatistics, error);
public DetectLanguageResult(String id, Error error, boolean isError) {
super(id, error, isError);
}

public DetectLanguageResult(String id, TextDocumentStatistics textDocumentStatistics,
DetectedLanguage primaryLanguage, List<DetectedLanguage> detectedLanguages) {
super(id, textDocumentStatistics);
this.primaryLanguage = primaryLanguage;
this.detectedLanguages = detectedLanguages;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,27 @@ public class DocumentResult {

private String id;
private TextDocumentStatistics textDocumentStatistics;
private Object error;
private Error error;

public DocumentResult(final String id, final TextDocumentStatistics textDocumentStatistics, final Object error) {
public boolean isError() {
return isError;
}

public void setIsError(final boolean isError) {
this.isError = isError;
}

private boolean isError;

protected DocumentResult(final String id, final Error error, final boolean isError) {
this.id = id;
this.textDocumentStatistics = textDocumentStatistics;
this.error = error;
this.isError = isError;
}

public DocumentResult(final String id, final TextDocumentStatistics textDocumentStatistics) {
this.id = id;
this.textDocumentStatistics = textDocumentStatistics;
}

public String getId() {
Expand All @@ -39,11 +54,11 @@ DocumentResult setTextDocumentStatistics(TextDocumentStatistics textDocumentStat
return this;
}

public Object getError() {
public Error getError() {
return error;
}

DocumentResult setError(Object error) {
DocumentResult setError(Error error) {
this.error = error;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.cs.textanalytics.implementation.models;
package com.azure.cs.textanalytics.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.cs.textanalytics.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* The InnerError model.
*/
@Fluent
public final class InnerError {
/*
* Error code. Possible values include: 'invalidParameterValue',
* 'invalidRequestBodyFormat', 'emptyRequest', 'missingInputRecords',
* 'invalidDocument', 'modelVersionIncorrect', 'invalidDocumentBatch',
* 'unsupportedLanguageCode', 'invalidCountryHint'
*/
@JsonProperty(value = "code", required = true)
private String code;

/*
* Error message.
*/
@JsonProperty(value = "message", required = true)
private String message;

/*
* Error target.
*/
@JsonProperty(value = "target")
private String target;

/*
* Inner error contains more specific information.
*/
@JsonProperty(value = "innererror")
private InnerError innererror;

/**
* Get the code property: Error code. Possible values include:
* 'invalidParameterValue', 'invalidRequestBodyFormat', 'emptyRequest',
* 'missingInputRecords', 'invalidDocument', 'modelVersionIncorrect',
* 'invalidDocumentBatch', 'unsupportedLanguageCode', 'invalidCountryHint'.
*
* @return the code value.
*/
public String getCode() {
return this.code;
}

/**
* Set the code property: Error code. Possible values include:
* 'invalidParameterValue', 'invalidRequestBodyFormat', 'emptyRequest',
* 'missingInputRecords', 'invalidDocument', 'modelVersionIncorrect',
* 'invalidDocumentBatch', 'unsupportedLanguageCode', 'invalidCountryHint'.
*
* @param code the code value to set.
* @return the InnerError object itself.
*/
public InnerError setCode(String code) {
this.code = code;
return this;
}

/**
* Get the message property: Error message.
*
* @return the message value.
*/
public String getMessage() {
return this.message;
}

/**
* Set the message property: Error message.
*
* @param message the message value to set.
* @return the InnerError object itself.
*/
public InnerError setMessage(String message) {
this.message = message;
return this;
}

/**
* Get the target property: Error target.
*
* @return the target value.
*/
public String getTarget() {
return this.target;
}

/**
* Set the target property: Error target.
*
* @param target the target value to set.
* @return the InnerError object itself.
*/
public InnerError setTarget(String target) {
this.target = target;
return this;
}

/**
* Get the innererror property: Inner error contains more specific
* information.
*
* @return the innererror value.
*/
public InnerError getInnererror() {
return this.innererror;
}

/**
* Set the innererror property: Inner error contains more specific
* information.
*
* @param innererror the innererror value to set.
* @return the InnerError object itself.
*/
public InnerError setInnererror(InnerError innererror) {
this.innererror = innererror;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
public final class KeyPhraseResult extends DocumentResult {
private List<String> keyPhrases;

public KeyPhraseResult(String id, TextDocumentStatistics textDocumentStatistics, DocumentError error, List<String> keyPhrases) {
super(id, textDocumentStatistics, error);
public KeyPhraseResult(String id, TextDocumentStatistics textDocumentStatistics, List<String> keyPhrases) {
super(id, textDocumentStatistics);
this.keyPhrases = keyPhrases;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
public final class LinkedEntityResult extends DocumentResult {
private List<LinkedEntity> linkedEntities;

public LinkedEntityResult(String id, TextDocumentStatistics textDocumentStatistics, DocumentError error, List<LinkedEntity> linkedEntities) {
super(id, textDocumentStatistics, error);
public LinkedEntityResult(String id, TextDocumentStatistics textDocumentStatistics,
List<LinkedEntity> linkedEntities) {
super(id, textDocumentStatistics);
this.linkedEntities = linkedEntities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
public final class NamedEntityResult extends DocumentResult {
private List<NamedEntity> namedEntities;

public NamedEntityResult(String id, TextDocumentStatistics textDocumentStatistics, DocumentError error, List<NamedEntity> namedEntities) {
super(id, textDocumentStatistics, error);
public NamedEntityResult(String id, TextDocumentStatistics textDocumentStatistics,
List<NamedEntity> namedEntities) {
super(id, textDocumentStatistics);
this.namedEntities = namedEntities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public final class TextSentimentResult extends DocumentResult {
private TextSentiment documentSentiment;
private List<TextSentiment> sentenceSentiments;

public TextSentimentResult(String id, TextDocumentStatistics textDocumentStatistics, DocumentError error, TextSentiment documentSentiment, List<TextSentiment> sentenceSentiments) {
super(id, textDocumentStatistics, error);
public TextSentimentResult(String id, TextDocumentStatistics textDocumentStatistics,
TextSentiment documentSentiment, List<TextSentiment> sentenceSentiments) {
super(id, textDocumentStatistics);
this.documentSentiment = documentSentiment;
this.sentenceSentiments = sentenceSentiments;
}
Expand Down
Loading

0 comments on commit 65d8244

Please sign in to comment.