1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge pull request #3 from fimtitzgerald/param_uname

Made username a config parameter instead of ENV
This commit is contained in:
Tim Fitzgerald 2018-07-23 18:51:18 -07:00 committed by GitHub
commit fa4b6384a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -7,16 +7,16 @@ import (
"log"
"net/http"
"os"
"github.com/senorprogrammer/wtf/wtf"
)
type Resource struct {
//Headers http.Header
Response interface{}
Raw string
}
var a = os.Getenv("ZENDESK_API")
var username = os.Getenv("ZENDESK_USERNAME")
var subdomain = os.Getenv("ZENDESK_SUBDOMAIN")
var baseURL = fmt.Sprintf("https://%v.zendesk.com/api/v2", subdomain)
@ -48,6 +48,7 @@ func api(key string, meth string, path string, params string) (*Resource, error)
req.Header.Add("Content-Type", "application/json")
username := wtf.Config.UString("wtf.mods.zendesk.username")
apiUser := fmt.Sprintf("%v/token", username)
req.SetBasicAuth(apiUser, key)

View File

@ -2,7 +2,6 @@ package zendesk
import (
"encoding/json"
//"fmt"
"log"
)
@ -50,8 +49,6 @@ type Ticket struct {
Fields interface{} `json:"fields"`
}
//var a = os.Getenv("ZENDESK_API")
func listTickets(pag ...string) (*TicketArray, error) {
TicketStruct := &TicketArray{}

View File

@ -41,8 +41,6 @@ func (widget *Widget) textContent(items []Ticket) string {
str := ""
for _, data := range items {
//str = items[i]
//str = fmt.Sprintf(data.Id)
str = str + widget.format(data)
}