ctreminiom / go-atlassian

✨ Golang Client Library for Atlassian Cloud.
https://docs.go-atlassian.io
MIT License
124 stars 34 forks source link

Wrong unix epoch in admin api requests #322

Open m1keru opened 1 week ago

m1keru commented 1 week ago

Hello, Thank you for your library it's really usefull! However, I found that Organization API is not working properly. I noticed during the debug that requests to the API go with Unix timestamp in seconds but Atlassian API wants milliseconds.

Here is the reference to their API: https://developer.atlassian.com/cloud/admin/organization/rest/api-group-events/#api-v1-orgs-orgid-events-get

from
string

The earliest date and time of the event are represented as a UNIX epoch time in milliseconds.
{"level":"debug","ts":1727100247.123214,"caller":"atlassian_log_exporter/exporter.go:116","msg":"Request HTTP: &{GET https://api.atlassian.com/admin/v1/orgs/xxxxxxxxxx/events?cursor=xxxxxxx%3D&from=1727097755 HTTP/1.1 1 1 map[Accept:[application/json] Authorization:[Bearer xxxxx] User-Agent:[curl/7.54.0]] {} 0x661320 0 [] false api.atlassian.com map[] map[] <nil> map[]   <nil> <nil> <nil> {{}} <nil> [] map[]}"}
{"level":"debug","ts":1727100247.123301,"caller":"atlassian_log_exporter/exporter.go:141","msg":"Response HTTP Code: 200"}

Is it possible to change here Unix() to UnixMilli().

https://github.com/ctreminiom/go-atlassian/blob/a8ccf40951cc5cf1d89c78fb82aa0ac221e6a391/admin/internal/organization_impl.go#L252

https://github.com/ctreminiom/go-atlassian/blob/a8ccf40951cc5cf1d89c78fb82aa0ac221e6a391/admin/internal/organization_impl.go#L257

m1keru commented 1 week ago

https://github.com/ctreminiom/go-atlassian/pull/323