rename
This commit is contained in:
parent
d17141ac1a
commit
ffb7d8467f
9 changed files with 58 additions and 101 deletions
12
amocrm.go
12
amocrm.go
|
@ -4,12 +4,12 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
"errors"
|
||||
"vultras.su/core/amo/api"
|
||||
"vultras.su/core/amo/companies"
|
||||
"vultras.su/core/amo/contacts"
|
||||
"vultras.su/core/amo/leads"
|
||||
"vultras.su/core/amo/users"
|
||||
"vultras.su/core/amo/events"
|
||||
"surdeus.su/core/amo/api"
|
||||
"surdeus.su/core/amo/companies"
|
||||
"surdeus.su/core/amo/contacts"
|
||||
"surdeus.su/core/amo/leads"
|
||||
"surdeus.su/core/amo/users"
|
||||
"surdeus.su/core/amo/events"
|
||||
)
|
||||
|
||||
type IAmoClient interface {
|
||||
|
|
3
btest.sh
Executable file
3
btest.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
go build -o ./exe/ ./cmd/test
|
|
@ -1,61 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"vultras.su/core/amo"
|
||||
"vultras.su/core/amo/api"
|
||||
"vultras.su/core/amo/webhooks"
|
||||
"vultras.su/core/amo/events"
|
||||
"vultras.su/core/bond"
|
||||
"vultras.su/core/bond/statuses"
|
||||
"surdeus.su/core/amo"
|
||||
"surdeus.su/core/amo/api"
|
||||
//"surdeus.su/core/amo/webhooks"
|
||||
"surdeus.su/core/amo/events"
|
||||
//"surdeus.su/core/ss"
|
||||
//"surdeus.su/core/ss/statuses"
|
||||
//"os"
|
||||
"fmt"
|
||||
"io"
|
||||
"encoding/json"
|
||||
//"io"
|
||||
//"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Context = bond.Context
|
||||
var (
|
||||
gclient *amo.Client
|
||||
)
|
||||
|
||||
var root = bond.Root(bond.Path().
|
||||
Def(
|
||||
"hook",
|
||||
bond.Func(func(c *Context){
|
||||
v := webhooks.Request{}
|
||||
c.Scan(&v)
|
||||
if c.ScanErr() != nil {
|
||||
fmt.Println("scan-err:", c.ScanErr())
|
||||
}
|
||||
bts, err := json.MarshalIndent(v, "", "\t")
|
||||
if err != nil {
|
||||
fmt.Println("marsh-error:", err)
|
||||
}
|
||||
fmt.Println("request:", string(bts))
|
||||
|
||||
c.SetStatus(statuses.OK)
|
||||
}),
|
||||
).Def(
|
||||
"auth",
|
||||
bond.Func(func(c *Context){
|
||||
fmt.Println("header:", c.R.Header)
|
||||
fmt.Println("content-type:", c.ContentType())
|
||||
bts, _ := io.ReadAll(c.R.Body)
|
||||
fmt.Println("request:", string(bts))
|
||||
c.SetStatus(statuses.OK)
|
||||
return
|
||||
v := map[string]any{}
|
||||
c.Scan(&v)
|
||||
if c.ScanErr() != nil {
|
||||
fmt.Println("scan-err:", c.ScanErr())
|
||||
}
|
||||
fmt.Println("request:", v)
|
||||
|
||||
c.SetStatus(statuses.OK)
|
||||
}),
|
||||
))
|
||||
|
||||
func main() {
|
||||
//fmt.Println(opts)
|
||||
client, err := amo.NewAmoClient("secret.json")
|
||||
|
@ -63,9 +21,8 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
client.Api.Debug = true
|
||||
gclient = client
|
||||
|
||||
company, err := client.GetCompany("80828925", "")
|
||||
company, err := client.GetCompany(80828925, "")
|
||||
if err != nil && err != api.NoContentErr {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package companies
|
||||
|
||||
import "vultras.su/core/amo/common"
|
||||
import "surdeus.su/core/amo/common"
|
||||
|
||||
type Company struct {
|
||||
Id int `json:"id"`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package contacts
|
||||
|
||||
import "vultras.su/core/amo/common"
|
||||
import "surdeus.su/core/amo/common"
|
||||
|
||||
type Contact struct {
|
||||
Id int `json:"id"`
|
||||
|
|
10
go.mod
10
go.mod
|
@ -1,14 +1,14 @@
|
|||
module vultras.su/core/amo
|
||||
module surdeus.su/core/amo
|
||||
|
||||
go 1.21.3
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.6.1
|
||||
vultras.su/core/bond v0.0.0-20240118183558-6fa4ef4cf402
|
||||
github.com/stretchr/testify v1.9.0
|
||||
surdeus.su/core/ss v0.1.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
19
go.sum
19
go.sum
|
@ -1,15 +1,12 @@
|
|||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
vultras.su/core/bond v0.0.0-20240114204709-a9c2c8810682 h1:NiT5kAwzjTO+C4/y2EyRI6N8DOl5YFLuyZEUqrYwfFE=
|
||||
vultras.su/core/bond v0.0.0-20240114204709-a9c2c8810682/go.mod h1:d8O5wwQlZrVAeoV7qIwxXabB9RuqgopP7wEyRl3++Tc=
|
||||
vultras.su/core/bond v0.0.0-20240118183558-6fa4ef4cf402 h1:XUEdQesLiMX8mK2ZQpJyfE0p+MfmgnOdM1Mt72F+FW4=
|
||||
vultras.su/core/bond v0.0.0-20240118183558-6fa4ef4cf402/go.mod h1:d8O5wwQlZrVAeoV7qIwxXabB9RuqgopP7wEyRl3++Tc=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
surdeus.su/core/ss v0.1.1 h1:CXYBVRk4fv+Z7Cu51Nw5wDs5CoaEf2VpjB7XmFqu3DQ=
|
||||
surdeus.su/core/ss v0.1.1/go.mod h1:4gPfk0OjdJ1maKHyYiZwai7jIIwpVE5vgiBF2nubdrU=
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package leads
|
||||
|
||||
import "vultras.su/core/amo/common"
|
||||
import "surdeus.su/core/amo/common"
|
||||
|
||||
type Lead struct {
|
||||
Id int `json:"id"`
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package webhooks
|
||||
|
||||
import (
|
||||
//"vultras.su/core/bond/urlenc"
|
||||
"vultras.su/core/bond/jsons"
|
||||
//"surdeus.su/core/ss/urlenc"
|
||||
"surdeus.su/core/ss/jsons"
|
||||
/*"log"
|
||||
"net/url"
|
||||
"strings"*/
|
||||
|
|
Loading…
Reference in a new issue