mirror of
https://github.com/rodneyosodo/memfault-go.git
synced 2026-06-23 04:00:08 +00:00
Add example for users
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
This commit is contained in:
+21
-12
@@ -20,7 +20,7 @@ func main() {
|
||||
}
|
||||
d, _ := time.ParseDuration("30s")
|
||||
conf := mem.Config{
|
||||
ApiURL: "https://api.memfault.com",
|
||||
APIURL: "https://api.memfault.com",
|
||||
Credentials: creds,
|
||||
MaxIdleConns: 10,
|
||||
IdleConnTimeout: d,
|
||||
@@ -30,30 +30,39 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(response1)
|
||||
// Prints out the user email address
|
||||
fmt.Println(response1.Email)
|
||||
|
||||
response2, err := memfault.GenerateUserApiKey()
|
||||
response2, err := memfault.GenerateUserAPIKey()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(response2)
|
||||
// Prints out the apikey for the logged in user
|
||||
fmt.Println(response2.Data.APIKey)
|
||||
|
||||
response3, err := memfault.GetUserApiKey()
|
||||
response3, err := memfault.GetUserAPIKey()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(response3)
|
||||
// Prints out the apikey for the logged in user
|
||||
fmt.Println(response3.Data.APIKey)
|
||||
|
||||
response4, err := memfault.DeleteUserApiKey()
|
||||
response4, err := memfault.DeleteUserAPIKey()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
// print out the response `DELETED`
|
||||
fmt.Println(response4)
|
||||
|
||||
response5, err := memfault.GetOrganizationSlug(false)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(response5)
|
||||
// response5, err := memfault.getOrganizationSlug(false)
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
// fmt.Println(fmt.Sprint(response5))
|
||||
|
||||
// response5, err := memfault.getOrganizationSlug(true)
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
// fmt.Println(fmt.Sprint(response5))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user