mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-19 05:25:19 +00:00
Commit from m3o/m3o action
This commit is contained in:
34
examples/password/README.md
Executable file
34
examples/password/README.md
Executable file
@@ -0,0 +1,34 @@
|
||||
# Password
|
||||
|
||||
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/password/api](https://m3o.com/password/api).
|
||||
|
||||
Endpoints:
|
||||
|
||||
## Generate
|
||||
|
||||
Generate a strong random password
|
||||
|
||||
|
||||
[https://m3o.com/password/api#Generate](https://m3o.com/password/api#Generate)
|
||||
|
||||
```go
|
||||
package example
|
||||
|
||||
import(
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.m3o.com/password"
|
||||
)
|
||||
|
||||
// Generate a strong random password
|
||||
func GeneratePassword() {
|
||||
passwordService := password.NewPasswordService(os.Getenv("M3O_API_TOKEN"))
|
||||
rsp, err := passwordService.Generate(&password.GenerateRequest{
|
||||
Length: 16,
|
||||
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
|
||||
}
|
||||
```
|
||||
17
examples/password/generate/generatePassword/main.go
Executable file
17
examples/password/generate/generatePassword/main.go
Executable file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.m3o.com/password"
|
||||
)
|
||||
|
||||
// Generate a strong random password
|
||||
func main() {
|
||||
passwordService := password.NewPasswordService(os.Getenv("M3O_API_TOKEN"))
|
||||
rsp, err := passwordService.Generate(&password.GenerateRequest{
|
||||
Length: 16,
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
Reference in New Issue
Block a user