Method | HTTP request | Description |
---|---|---|
CreateGroup | Post /v1/groups | Create group |
DeleteGroup | Delete /v1/groups/{groupId} | Deletes group |
GetGroup | Get /v1/groups/{groupId} | Retrieve group |
GetGroups | Get /v1/groups | List groups |
UpdateGroup | Put /v1/groups/{groupId} | Update a group |
Group CreateGroup(ctx).Group(group).Execute()
Create group
package main
import (
"context"
"fmt"
"os"
authress "github.com/authress/authress-sdk.go"
)
func main() {
group := *authress.NewGroup("Name_example", []authress.User{*authress.NewUser("oauth|userId")}, []authress.User{*authress.NewUser("oauth|userId")}) // Group |
url, _ := url.Parse("https://authress.company.com")
authressClient := authress.NewAuthressClient(authress.AuthressSettings{
AuthressApiUrl: url,
})
resp, r, err := apiClient.Groups.CreateGroup(context.Background()).Group(group).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Groups.CreateGroup``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateGroup`: Group
fmt.Fprintf(os.Stdout, "Response from `Groups.CreateGroup`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiCreateGroupRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
group | Group |
- Content-Type: application/json
- Accept: application/links+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteGroup(ctx, groupId).Execute()
Deletes group
package main
import (
"context"
"fmt"
"os"
authress "github.com/authress/authress-sdk.go"
)
func main() {
groupId := TODO // GroupId | The identifier of the group.
url, _ := url.Parse("https://authress.company.com")
authressClient := authress.NewAuthressClient(authress.AuthressSettings{
AuthressApiUrl: url,
})
r, err := apiClient.Groups.DeleteGroup(context.Background(), groupId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Groups.DeleteGroup``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
groupId | GroupId | The identifier of the group. |
Other parameters are passed through a pointer to a apiDeleteGroupRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Group GetGroup(ctx, groupId).Execute()
Retrieve group
package main
import (
"context"
"fmt"
"os"
authress "github.com/authress/authress-sdk.go"
)
func main() {
groupId := TODO // GroupId | The identifier of the group.
url, _ := url.Parse("https://authress.company.com")
authressClient := authress.NewAuthressClient(authress.AuthressSettings{
AuthressApiUrl: url,
})
resp, r, err := apiClient.Groups.GetGroup(context.Background(), groupId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Groups.GetGroup``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetGroup`: Group
fmt.Fprintf(os.Stdout, "Response from `Groups.GetGroup`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
groupId | GroupId | The identifier of the group. |
Other parameters are passed through a pointer to a apiGetGroupRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/links+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GroupCollection GetGroups(ctx).Limit(limit).Cursor(cursor).Filter(filter).Execute()
List groups
package main
import (
"context"
"fmt"
"os"
authress "github.com/authress/authress-sdk.go"
)
func main() {
limit := int32(56) // int32 | Max number of results to return (optional) (default to 20)
cursor := "cursor_example" // string | Continuation cursor for paging (optional)
filter := "filter_example" // string | Filter to search groups by. This is a case insensitive search through every text field. (optional)
url, _ := url.Parse("https://authress.company.com")
authressClient := authress.NewAuthressClient(authress.AuthressSettings{
AuthressApiUrl: url,
})
resp, r, err := apiClient.Groups.GetGroups(context.Background()).Limit(limit).Cursor(cursor).Filter(filter).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Groups.GetGroups``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetGroups`: GroupCollection
fmt.Fprintf(os.Stdout, "Response from `Groups.GetGroups`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiGetGroupsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
limit | int32 | Max number of results to return | [default to 20] |
cursor | string | Continuation cursor for paging | |
filter | string | Filter to search groups by. This is a case insensitive search through every text field. |
- Content-Type: Not defined
- Accept: application/links+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Group UpdateGroup(ctx, groupId).Group(group).IfUnmodifiedSince(ifUnmodifiedSince).Execute()
Update a group
package main
import (
"context"
"fmt"
"os"
"time"
authress "github.com/authress/authress-sdk.go"
)
func main() {
groupId := TODO // GroupId | The identifier of the group.
group := *authress.NewGroup("Name_example", []authress.User{*authress.NewUser("oauth|userId")}, []authress.User{*authress.NewUser("oauth|userId")}) // Group |
ifUnmodifiedSince := time.Now() // time.Time | The expected last time the group was modified. (optional)
url, _ := url.Parse("https://authress.company.com")
authressClient := authress.NewAuthressClient(authress.AuthressSettings{
AuthressApiUrl: url,
})
resp, r, err := apiClient.Groups.UpdateGroup(context.Background(), groupId).Group(group).IfUnmodifiedSince(ifUnmodifiedSince).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Groups.UpdateGroup``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateGroup`: Group
fmt.Fprintf(os.Stdout, "Response from `Groups.UpdateGroup`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
groupId | GroupId | The identifier of the group. |
Other parameters are passed through a pointer to a apiUpdateGroupRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
group | Group | | ifUnmodifiedSince | time.Time | The expected last time the group was modified. |
- Content-Type: application/json
- Accept: application/links+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]