mirror of
https://github.com/ProtonMail/go-proton-api.git
synced 2025-12-23 23:57:50 -05:00
feat(BRIDGE-150): added organization endpoint route and call
This commit is contained in:
committed by
ElectroNafta
parent
d663a2ef90
commit
b4860af56d
31
organization.go
Normal file
31
organization.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package proton
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
type OrganizationResponse struct {
|
||||
Code int
|
||||
Organization organization
|
||||
}
|
||||
|
||||
type organization struct {
|
||||
Name string
|
||||
DisplayName string
|
||||
PlanName string
|
||||
MaxMembers int
|
||||
}
|
||||
|
||||
func (c *Client) GetOrganizationData(ctx context.Context) (OrganizationResponse, error) {
|
||||
var res OrganizationResponse
|
||||
|
||||
if err := c.do(ctx, func(r *resty.Request) (*resty.Response, error) {
|
||||
return r.SetResult(&res).Get("/core/v4/organizations")
|
||||
}); err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user