github.com/wit-ai/wit-go/v2@v2.0.2/README.md (about)

     1  ![wit.ai](https://s3.amazonaws.com/pliutau.com/wit.png)
     2  
     3  [![GoDoc](https://godoc.org/github.com/wit-ai/wit-go?status.svg)](https://godoc.org/github.com/wit-ai/wit-go) [![Go Report Card](https://goreportcard.com/badge/github.com/wit-ai/wit-go)](https://goreportcard.com/report/github.com/wit-ai/wit-go)
     4  
     5  *This repository is community-maintained. We gladly accept pull requests. Please see the [Wit HTTP Reference](https://wit.ai/docs/http/latest) for all supported endpoints.*
     6  
     7  Go client for [wit.ai](https://wit.ai/) HTTP API.
     8  
     9  ## Install
    10  
    11  ```
    12  go get -u github.com/wit-ai/wit-go/v2
    13  ```
    14  
    15  ## Usage
    16  
    17  ```go
    18  package main
    19  
    20  import (
    21  	"os"
    22  	"fmt"
    23  
    24  	witai "github.com/wit-ai/wit-go/v2"
    25  )
    26  
    27  func main() {
    28  	client := witai.NewClient(os.Getenv("WIT_AI_TOKEN"))
    29  	// Use client.SetHTTPClient() to set custom http.Client
    30  
    31  	msg, _ := client.Parse(&witai.MessageRequest{
    32  		Query: "hello",
    33  	})
    34  	fmt.Printf("%v", msg)
    35  }
    36  ```
    37  
    38  ## Testing
    39  
    40  Both Unit / Integration tests are executed by Github Actions.
    41  
    42  ### Unit tests
    43  
    44  ```
    45  go test -race -v
    46  ```
    47  
    48  ### Integration tests
    49  
    50  Integration tests are connecting to real Wit.ai API, so you need to provide a valid token:
    51  
    52  ```
    53  export WITAI_INTEGRATION_TOKEN=your_secret_token_here
    54  go test -v -tags=integration
    55  ```
    56  
    57  
    58  ## License
    59  
    60  The license for wit-go can be found in LICENSE file in the root directory of this source tree.