Giter VIP home page Giter VIP logo

go-cisco-webex-teams's People

Contributors

abhishekrb19 avatar jbogarin avatar mcandre avatar seanmalloy avatar tejzpr avatar xphyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-cisco-webex-teams's Issues

New tag required?

Hi,

I just wanted to check that this library is still being maintained? There appears to be 18 commits since the 0.4.0 tag and I wondered if you'd be able to create a new version with the latest commits?

Thanks.

Second NewClient() overrides initial NewClient()?

Hi, me again ;)

I'm experiencing a weird issue which I suspect is obvious, but I can't quite get my head around it...

Essentially, if I create two clients with NewClient() using two separate tokens with SetAuthToken() the second one seems to overwrite the first.

For example, this code works as expected:

	client1 := webexteams.NewClient()
	client1.SetAuthToken("first token here")
	me1, _, _ := client1.People.GetMe()
	fmt.Println(me1.DisplayName)
	
	client2 := webexteams.NewClient()
	client2.SetAuthToken("second token here")
	me2, _, _ := client2.People.GetMe()
	fmt.Println(me2.DisplayName)

But this does not, it basically prints the second clients display name twice

	client1 := webexteams.NewClient()
	client1.SetAuthToken("first token here")
	client2 := webexteams.NewClient()
	client2.SetAuthToken("second token here")

	me1, _, _ := client1.People.GetMe()
	fmt.Println(me1.DisplayName)
	me2, _, _ := client2.People.GetMe()
	fmt.Println(me2.DisplayName)

Any thoughts before I start digging into it further greatly appreciated.

Thanks.

Failed to get one on one conversation

"message":"Failed to get one on one conversation","errors":[{"description":"Failed to get one on one conversation"}

markDownMessage := &webexteams.MessageCreateRequest{
		Markdown:      "MESSAGE",
		ToPersonEmail: "MY EMAIL",
	}
	_, rep, err := Client.Messages.CreateMessage(markDownMessage)
	if err != nil {
		fmt.Println(err.Error())
	}

Whats going on here ?
If i make manually the request it works...
Can you help me?

Confirmation regarding 429 errors

Hi,

A common issue with the Webex APIs is the receipt of 429 errors. Is my understanding correct, that you would be relying on the use of Resty v2 for that capability?

If so, I'm unable to see where you're exporting access to that capability?

Any information you can provide greatly appreciated.

Thanks.

Error loading module requirements gopkg.in/resty.v1

Hi,

Just trying to use the new version and I'm getting the following error, any thoughts?

go: github.com/go-resty/[email protected]: parsing go.mod: unexpected module path "gopkg.in/resty.v1"
go: error loading module requirements

Essentially I just created a new repo, used go get to get resty v2.0.0 and go-cisco-webex-teams v0.2.0, created a basic main.go using the library and I get the error.

main.go:

package main

import (
	"github.com/go-resty/resty/v2"
	webexteams "github.com/jbogarin/go-cisco-webex-teams/sdk"
)

var Client *webexteams.Client

func main() {
	client := resty.New()
	token := "" 
	client.SetAuthToken(token)
	Client = webexteams.NewClient(client)

}

Thanks.

Resty v2 Go Modules Compatibility Error

Similar to #6 i'm seeing the below error when trying to use Go Modules to build my project. I'm using Go Lang version 1.12.9.

CGO_ENABLED=0 GO111MODULE=on go build -o prom2webex
go: finding github.com/google/go-querystring/query latest
go: github.com/go-resty/[email protected]: parsing go.mod: unexpected module path "gopkg.in/resty.v1"
go: error loading module requirements

Here is main.go ...

package main

import (
        "fmt"
        "log"

        webexteams "github.com/jbogarin/go-cisco-webex-teams/sdk"
)

// Client is Webex Teams API client
// var Client *webexteams.Client

func main() {
        // Client is Webex Teams API client
        Client := webexteams.NewClient()

        // TODO: remove hard coded roomID
        myRoomID := "myroomid"

        // POST messages - Text Message
        message := &webexteams.MessageCreateRequest{
                Text:   "This is a text message fo testing",
                RoomID: myRoomID,
        }
        newTextMessage, _, err := Client.Messages.CreateMessage(message)
        if err != nil {
                log.Fatal(err)
        }
        fmt.Println("POST:", newTextMessage.ID, newTextMessage.Text, newTextMessage.Created)

        // POST messages - Markdown Message
        //markDownMessage := &webexteams.MessageCreateRequest{
        //      Markdown: "This is a markdown message. *Italic*, **bold** and ***italic/bold***.",
        //      RoomID:   myRoomID,
        //}
        //newMarkDownMessage, _, err := Client.Messages.CreateMessage(markDownMessage)
        //if err != nil {
        //      log.Fatal(err)
        //}
        //fmt.Println("POST:", newMarkDownMessage.ID, newMarkDownMessage.Markdown, newMarkDownMessage.Created)
}

Here is go.mod ...

module path/to/my/project

go 1.12

require github.com/jbogarin/go-cisco-webex-teams v0.3.0

require github.com/go-resty/resty/v2 v2.0.0

According to the resty v2 doc the correct import path for using resty v2 with Go Modules is import "github.com/go-resty/resty/v2".

https://github.com/go-resty/resty#installation
https://github.com/go-resty/resty#usage

Can/should the code in this project we updated to import "github.com/go-resty/resty/v2" instead of "github.com/go-resty/resty"?

Bad request because of bad URL encoding for dates

Hello,

The dates used in query params don't use the webex API format: ISO8601.
So the server returns a 400 BAD REQUEST with the message: "The request could not be understood by the server due to malformed syntax.".

To reproduce:

package main

import (
	"fmt"
	"log"
	"time"

	webexteams "github.com/jbogarin/go-cisco-webex-teams/sdk"
)

// Client is Webex Teams API client
var Client *webexteams.Client

func main() {
	Client = webexteams.NewClient()

	myRoomID := "<yourRoomID>"

	messageQueryParams := &webexteams.ListMessagesQueryParams{
		RoomID: myRoomID,
		Before: time.Date(2022, time.August, 15, 0, 22, 12, 0, time.UTC),
	}

	messages, resp, err := Client.Messages.ListMessages(messageQueryParams)
	if err != nil {
		log.Fatal(err)
	}
	if resp.IsError() {
		log.Fatal(string(resp.Body()))
	}
	for id, message := range messages.Items {
		fmt.Println("GET:", id, message.ID, message.Text, message.Created)
	}
}

This PR fixes the issue: #27

Failed to create message from email

	markDownMessage := &MessageCreateRequest{
		Text: markdown,
		ToPersonEmail: "[email protected]",
	}

2021/06/17 22:54:37 {"message":"Failed to get one on one conversation","errors":[{"description":"Failed to get one on one conversation"}],"trackingId":"ROUTER_60CB6207-128A-01BB-4656-0AFDEAE34656"}

No errors given for unauthorized 401

Hi Jose,

I was just using this SDK and I noticed that when I get a 401, I don't seem to get any indication of it so I'm unable to provide any feedback. Is that something you might change?

Many thanks,
Darren.

Unable to list messages

Hi,

I'm able to send a message to a space, but cannot get listmessages (for the same space) to work:

messages &{[]} resp {"message":"Failed to get activity.","errors":[{"description":"Failed to get activity."}],"trackingId":"ROUTER_..."} err <nil>

Code is:

        Client = webexteams.NewClient()
        messageQueryParams := &webexteams.ListMessagesQueryParams{
                RoomID: room.webexRoomID,
                Max: 5,
        }
        messages, resp, err := Client.Messages.ListMessages(messageQueryParams)
        fmt.Printf("messages %v resp %v err %v\n", messages, resp, err)
        if err != nil {
                log.Fatal(err)
        }
        for id, message := range messages.Items {
                fmt.Println("GET:", id, message.ID, message.Text, message.Created)
        }

Is this due to an api change, or am I doing it wrong?

Use of the Max parameter

Hi Jose,

I think we spoke about this some time ago and I wondered if you'd managed to look into it any further. I thought I'd log it as an issue to continue the conversation.

Essentially the question was regarding the max parameter.

When using the SDK and specifying a Max of 5, it actually returns all items. You mentioned that you believed that was to do with the paging I think. The webex docs say the following:

When requesting a list of resources the max query parameter may be used to control the number of items returned per page. For example, requesting GET /people?displayName=Harold&max=2 tells the API to return only 2 items per page.

And I think you took this to mean that when you specify the max parameter, you are just saying how many you want per page, and you are then returning all pages?

The docs go on to say:

If the requested max query parameter value exceeds what a particular API endpoint allows, only the maximum number of items allowed per page for that endpoint will be returned. A rel="next" link header will be present if another page of results is available.

So I was wondering if you might just return the single page containing the max requested along with the rel="next" header using the RFC5988 standard Cisco mentions:

The Webex APIs implement the RFC5988 (Web Linking) standard for pagination. When requesting a list of resources the response may contain a Link header containing the URLs to the first, next, and previous page.

From memory, you were going to take a look at the python library to see how they handled it. And I think we discussed whether you would just pass the max parameter through or if you would abstract that away to enable an SDK user to specify a larger max size than the teams API and then use the paging internally to return the number the user requested (like the sparky sdk).

Ultimately though, what I'd like to achieve is that when I specify a max of 5, that only 5 results are returned?

Let me know what you think the best way to proceed is.

Speak soon. Thanks again,
D.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.