Skip to content

Commit

Permalink
chore: hard code api version
Browse files Browse the repository at this point in the history
  • Loading branch information
jirevwe committed May 8, 2024
1 parent fbec4c2 commit 3b9a682
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 9 additions & 5 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

const (
URL = "http://localhost:5005/api/v1"
projectID = "01HB8J53CSBC4ZWCJ95TCQ6S43"
projectID = "01HS1672A88250D57J8SZV4P3A"
endpointID = "01HCB4CWTVAVWWJDJEASHGXPA6"
apiKey = "CO.vMkWVbqa7mFsmeGA.MkU35AfkWF3AcUVvNOqBj94QGZ05jxzjUmH4sgMYcipAji26dnnyNJo5bQkSzUTu"
apiKey = "CO.tsmEVYn1muY1pU9t.wOB1pNEP92gnjlV7BUYz944TK9dRyYRvEzp9AR6jLy0r9Dk8WIqZ0JUhJuNq0IRm"
kUsername = "k-username"
kPassword = "k-password"
awsKey = "aws-key"
Expand Down Expand Up @@ -62,10 +62,14 @@ func createEvent(ctx context.Context, c *convoy.Client) {
}

func createEndpoint(ctx context.Context, c *convoy.Client) {
tr := true
endpoint, err := c.Endpoints.Create(ctx, &convoy.CreateEndpointRequest{
Name: "Endpoint GO SDK",
URL: "https://webhook.site/4a5f8928-73fc-40e2-921c-e037afa9ea09",
Description: "Some description",
Name: "Endpoint Go SDK",
URL: "https://webhook.site/4a5f8928-73fc-40e2-921c-e037afa9ea09",
Description: "Some description",
OwnerID: "my_owner_id",
AdvancedSignatures: &tr,
HttpTimeout: "10s",
}, nil)

if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import (
"net/http/httputil"
)

const (
DEFAULT_BASE_URL = "https://dashboard.getconvoy.io/api/v1"
)

func postJSON(ctx context.Context, c *Client, url string, body interface{}, res interface{}) error {
buf, err := json.Marshal(body)
if err != nil {
Expand Down Expand Up @@ -68,6 +64,7 @@ func deleteResource(ctx context.Context, c *Client, url string, res interface{})
func doReq(c *Client, req *http.Request, res interface{}) error {
req.Header.Add("Content-Type", "application/json;charset=utf-8")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.apiKey))
req.Header.Set("X-Convoy-Version", "0001-01-01")

resp, err := c.client.Do(req)
if err != nil {
Expand Down

0 comments on commit 3b9a682

Please sign in to comment.