Documentation ¶
Overview ¶
Package hatespeech provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.
Index ¶
- Constants
- func NewPostDetectHateSpeechLanguageRequest(server string, language string, ...) (*http.Request, error)
- func NewPostDetectHateSpeechLanguageRequestWithBody(server string, language string, contentType string, body io.Reader) (*http.Request, error)
- type AnalysisRequest
- type Category
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) PostDetectHateSpeechLanguageWithBodyWithResponse(ctx context.Context, language string, contentType string, body io.Reader, ...) (*PostDetectHateSpeechLanguageResponse, error)
- func (c *ClientWithResponses) PostDetectHateSpeechLanguageWithResponse(ctx context.Context, language string, ...) (*PostDetectHateSpeechLanguageResponse, error)
- type ClientWithResponsesInterface
- type Document
- type DocumentPosition
- type Extraction
- type HateSpeechDetectDocument
- type HateSpeechDetectResponse
- type HttpRequestDoer
- type PostDetectHateSpeechLanguageJSONBody
- type PostDetectHateSpeechLanguageJSONRequestBody
- type PostDetectHateSpeechLanguageResponse
- type RequestEditorFn
- type ServiceError
Constants ¶
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func NewPostDetectHateSpeechLanguageRequest ¶
func NewPostDetectHateSpeechLanguageRequest(server string, language string, body PostDetectHateSpeechLanguageJSONRequestBody) (*http.Request, error)
NewPostDetectHateSpeechLanguageRequest calls the generic PostDetectHateSpeechLanguage builder with application/json body
func NewPostDetectHateSpeechLanguageRequestWithBody ¶
func NewPostDetectHateSpeechLanguageRequestWithBody(server string, language string, contentType string, body io.Reader) (*http.Request, error)
NewPostDetectHateSpeechLanguageRequestWithBody generates requests for PostDetectHateSpeechLanguage with any type of body
Types ¶
type AnalysisRequest ¶
type AnalysisRequest struct { // Document Document *Document `json:"document,omitempty"` }
Request
type Category ¶
type Category struct { // Score expressed as a percentage of the sum of the scores of all the candidate categories, winners and not (see the **score** property) Frequency *float32 `json:"frequency,omitempty"` // Hierarchical path Hierarchy *[]string `json:"hierarchy,omitempty"` // Category ID Id *string `json:"id,omitempty"` // Category label Label *string `json:"label,omitempty"` // Name of the software package containing the reference taxonomy Namespace *string `json:"namespace,omitempty"` // Positions of the portions of text that contributed to the selection of the category Positions *[]DocumentPosition `json:"positions,omitempty"` // Score assigned to the category to represent its relevance Score *int32 `json:"score,omitempty"` // True if the category is deemed particularly relevant Winner *bool `json:"winner,omitempty"` }
Category
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) PostDetectHateSpeechLanguage ¶
func (c *Client) PostDetectHateSpeechLanguage(ctx context.Context, language string, body PostDetectHateSpeechLanguageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // PostDetectHateSpeechLanguage request with any body PostDetectHateSpeechLanguageWithBody(ctx context.Context, language string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostDetectHateSpeechLanguage(ctx context.Context, language string, body PostDetectHateSpeechLanguageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) PostDetectHateSpeechLanguageWithBodyWithResponse ¶
func (c *ClientWithResponses) PostDetectHateSpeechLanguageWithBodyWithResponse(ctx context.Context, language string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDetectHateSpeechLanguageResponse, error)
PostDetectHateSpeechLanguageWithBodyWithResponse request with arbitrary body returning *PostDetectHateSpeechLanguageResponse
func (*ClientWithResponses) PostDetectHateSpeechLanguageWithResponse ¶
func (c *ClientWithResponses) PostDetectHateSpeechLanguageWithResponse(ctx context.Context, language string, body PostDetectHateSpeechLanguageJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDetectHateSpeechLanguageResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // PostDetectHateSpeechLanguage request with any body PostDetectHateSpeechLanguageWithBodyWithResponse(ctx context.Context, language string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDetectHateSpeechLanguageResponse, error) PostDetectHateSpeechLanguageWithResponse(ctx context.Context, language string, body PostDetectHateSpeechLanguageJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDetectHateSpeechLanguageResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Document ¶
type Document struct { // The document's text Text *string `json:"text,omitempty"` }
Document
type DocumentPosition ¶
type DocumentPosition struct { // Zero-based position of the character after the last End *int64 `json:"end,omitempty"` // Zero-based position of the first character Start *int64 `json:"start,omitempty"` }
Position
type Extraction ¶
type Extraction struct { // Extraction record fields Fields *[]struct { // Field name Name *string `json:"name,omitempty"` // Positions of parts of the text corresponding to the field value Positions *[]DocumentPosition `json:"positions,omitempty"` // Field value Value *string `json:"value,omitempty"` } `json:"fields,omitempty"` // Software package name Namespace *string `json:"namespace,omitempty"` // Extraction record template Template *string `json:"template,omitempty"` }
Extraction record
type HateSpeechDetectDocument ¶
type HateSpeechDetectDocument struct { // Hate speech categories like 'Personal Insult' or 'Discrimination and Harassment/Body Shaming'. Categories *[]Category `json:"categories,omitempty"` // Extractions of instances of abusive languages providing with the full utterance and the target (hate speech categories). Extractions *[]Extraction `json:"extractions,omitempty"` // Text language Language *string `json:"language,omitempty"` // Service version Version *string `json:"version,omitempty"` }
Information detection data
type HateSpeechDetectResponse ¶
type HateSpeechDetectResponse struct { // Information detection data Data *HateSpeechDetectDocument `json:"data,omitempty"` // Service errors Errors *[]ServiceError `json:"errors,omitempty"` // Operation completed successfully (true/false) Success *bool `json:"success,omitempty"` }
Hate speech detection resource response
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type PostDetectHateSpeechLanguageJSONBody ¶
type PostDetectHateSpeechLanguageJSONBody = AnalysisRequest
PostDetectHateSpeechLanguageJSONBody defines parameters for PostDetectHateSpeechLanguage.
type PostDetectHateSpeechLanguageJSONRequestBody ¶
type PostDetectHateSpeechLanguageJSONRequestBody = PostDetectHateSpeechLanguageJSONBody
PostDetectHateSpeechLanguageJSONRequestBody defines body for PostDetectHateSpeechLanguage for application/json ContentType.
type PostDetectHateSpeechLanguageResponse ¶
type PostDetectHateSpeechLanguageResponse struct { Body []byte HTTPResponse *http.Response JSON200 *HateSpeechDetectResponse }
func ParsePostDetectHateSpeechLanguageResponse ¶
func ParsePostDetectHateSpeechLanguageResponse(rsp *http.Response) (*PostDetectHateSpeechLanguageResponse, error)
ParsePostDetectHateSpeechLanguageResponse parses an HTTP response from a PostDetectHateSpeechLanguageWithResponse call
func (PostDetectHateSpeechLanguageResponse) Status ¶
func (r PostDetectHateSpeechLanguageResponse) Status() string
Status returns HTTPResponse.Status
func (PostDetectHateSpeechLanguageResponse) StatusCode ¶
func (r PostDetectHateSpeechLanguageResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServiceError ¶
type ServiceError struct { // Error code Code *string `json:"code,omitempty"` // Error message Message *string `json:"message,omitempty"` }
Error information