From 3ac75d8041dcda28412f257d4660d1fa83b4cd4c Mon Sep 17 00:00:00 2001 From: ElectroNafta Date: Mon, 16 Sep 2024 14:33:36 +0200 Subject: [PATCH] feat(BRIDGE-150): added organization endpoint route and call --- organization.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 organization.go diff --git a/organization.go b/organization.go new file mode 100644 index 0000000..298331d --- /dev/null +++ b/organization.go @@ -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 +}