list memberships for end users (#537)

This commit is contained in:
Michael Quigley 2024-12-10 13:28:29 -05:00
parent 5582ac0ea5
commit 3aff9950c8
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
25 changed files with 1636 additions and 0 deletions

View File

@ -22,6 +22,7 @@ func newOrgAccountOverviewCommand() *orgAccountOverviewCommand {
cmd := &cobra.Command{
Use: "account-overview <organizationToken> <accountEmail>",
Aliases: []string{"overview"},
Short: "Retrieve account overview for organization account (requires admin)",
Args: cobra.ExactArgs(2),
}
command := &orgAccountOverviewCommand{cmd: cmd}

View File

@ -77,6 +77,7 @@ func Run(inCfg *config.Config) error {
api.MetadataGetEnvironmentDetailHandler = newEnvironmentDetailHandler()
api.MetadataGetFrontendDetailHandler = newGetFrontendDetailHandler()
api.MetadataGetShareDetailHandler = newShareDetailHandler()
api.MetadataListMembershipsHandler = newListMembershipsHandler()
api.MetadataOrgAccountOverviewHandler = newOrgAccountOverviewHandler()
api.MetadataOverviewHandler = newOverviewHandler()
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)

View File

@ -0,0 +1,35 @@
package controller
import (
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/rest_server_zrok/operations/metadata"
"github.com/sirupsen/logrus"
)
type listMembershipsHandler struct{}
func newListMembershipsHandler() *listMembershipsHandler {
return &listMembershipsHandler{}
}
func (h *listMembershipsHandler) Handle(_ metadata.ListMembershipsParams, principal *rest_model_zrok.Principal) middleware.Responder {
trx, err := str.Begin()
if err != nil {
logrus.Errorf("error startin transaction: %v", err)
return metadata.NewListMembershipsInternalServerError()
}
defer func() { _ = trx.Rollback() }()
oms, err := str.FindOrganizationsForAccount(int(principal.ID), trx)
if err != nil {
logrus.Errorf("error finding organizations for account '%v': %v", principal.Email, err)
return metadata.NewListMembershipsInternalServerError()
}
var out []*metadata.ListMembershipsOKBodyMembershipsItems0
for _, om := range oms {
out = append(out, &metadata.ListMembershipsOKBodyMembershipsItems0{Token: om.Token, Description: om.Description, Admin: om.Admin})
}
return metadata.NewListMembershipsOK().WithPayload(&metadata.ListMembershipsOKBody{Memberships: out})
}

View File

@ -47,6 +47,31 @@ func (str *Store) FindOrganizationByToken(token string, trx *sqlx.Tx) (*Organiza
return org, nil
}
type OrganizationMembership struct {
Token string
Description string
Admin bool
}
func (str *Store) FindOrganizationsForAccount(acctId int, trx *sqlx.Tx) ([]*OrganizationMembership, error) {
sql := "select organizations.token, organizations.description, organization_members.admin from organizations, organization_members " +
"where organization_members.account_id = $1 and organization_members.organization_id = organizations.id and not organizations.deleted"
rows, err := trx.Queryx(sql, acctId)
if err != nil {
return nil, errors.Wrap(err, "error querying organization memberships")
}
var oms []*OrganizationMembership
for rows.Next() {
om := &OrganizationMembership{}
if err := rows.StructScan(&om); err != nil {
return nil, errors.Wrap(err, "error scanning organization membership")
}
oms = append(oms, om)
}
return oms, nil
}
func (str *Store) DeleteOrganization(id int, trx *sqlx.Tx) error {
stmt, err := trx.Prepare("update organizations set updated_at = current_timestamp, deleted = true where id = $1")
if err != nil {

View File

@ -0,0 +1,128 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewListMembershipsParams creates a new ListMembershipsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewListMembershipsParams() *ListMembershipsParams {
return &ListMembershipsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListMembershipsParamsWithTimeout creates a new ListMembershipsParams object
// with the ability to set a timeout on a request.
func NewListMembershipsParamsWithTimeout(timeout time.Duration) *ListMembershipsParams {
return &ListMembershipsParams{
timeout: timeout,
}
}
// NewListMembershipsParamsWithContext creates a new ListMembershipsParams object
// with the ability to set a context for a request.
func NewListMembershipsParamsWithContext(ctx context.Context) *ListMembershipsParams {
return &ListMembershipsParams{
Context: ctx,
}
}
// NewListMembershipsParamsWithHTTPClient creates a new ListMembershipsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListMembershipsParamsWithHTTPClient(client *http.Client) *ListMembershipsParams {
return &ListMembershipsParams{
HTTPClient: client,
}
}
/*
ListMembershipsParams contains all the parameters to send to the API endpoint
for the list memberships operation.
Typically these are written to a http.Request.
*/
type ListMembershipsParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list memberships params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListMembershipsParams) WithDefaults() *ListMembershipsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list memberships params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListMembershipsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list memberships params
func (o *ListMembershipsParams) WithTimeout(timeout time.Duration) *ListMembershipsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list memberships params
func (o *ListMembershipsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list memberships params
func (o *ListMembershipsParams) WithContext(ctx context.Context) *ListMembershipsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list memberships params
func (o *ListMembershipsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list memberships params
func (o *ListMembershipsParams) WithHTTPClient(client *http.Client) *ListMembershipsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list memberships params
func (o *ListMembershipsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *ListMembershipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,318 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"io"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ListMembershipsReader is a Reader for the ListMemberships structure.
type ListMembershipsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListMembershipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListMembershipsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewListMembershipsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /memberships] listMemberships", response, response.Code())
}
}
// NewListMembershipsOK creates a ListMembershipsOK with default headers values
func NewListMembershipsOK() *ListMembershipsOK {
return &ListMembershipsOK{}
}
/*
ListMembershipsOK describes a response with status code 200, with default header values.
ok
*/
type ListMembershipsOK struct {
Payload *ListMembershipsOKBody
}
// IsSuccess returns true when this list memberships o k response has a 2xx status code
func (o *ListMembershipsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list memberships o k response has a 3xx status code
func (o *ListMembershipsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list memberships o k response has a 4xx status code
func (o *ListMembershipsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list memberships o k response has a 5xx status code
func (o *ListMembershipsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list memberships o k response a status code equal to that given
func (o *ListMembershipsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list memberships o k response
func (o *ListMembershipsOK) Code() int {
return 200
}
func (o *ListMembershipsOK) Error() string {
return fmt.Sprintf("[GET /memberships][%d] listMembershipsOK %+v", 200, o.Payload)
}
func (o *ListMembershipsOK) String() string {
return fmt.Sprintf("[GET /memberships][%d] listMembershipsOK %+v", 200, o.Payload)
}
func (o *ListMembershipsOK) GetPayload() *ListMembershipsOKBody {
return o.Payload
}
func (o *ListMembershipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(ListMembershipsOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListMembershipsInternalServerError creates a ListMembershipsInternalServerError with default headers values
func NewListMembershipsInternalServerError() *ListMembershipsInternalServerError {
return &ListMembershipsInternalServerError{}
}
/*
ListMembershipsInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type ListMembershipsInternalServerError struct {
}
// IsSuccess returns true when this list memberships internal server error response has a 2xx status code
func (o *ListMembershipsInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list memberships internal server error response has a 3xx status code
func (o *ListMembershipsInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this list memberships internal server error response has a 4xx status code
func (o *ListMembershipsInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this list memberships internal server error response has a 5xx status code
func (o *ListMembershipsInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this list memberships internal server error response a status code equal to that given
func (o *ListMembershipsInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the list memberships internal server error response
func (o *ListMembershipsInternalServerError) Code() int {
return 500
}
func (o *ListMembershipsInternalServerError) Error() string {
return fmt.Sprintf("[GET /memberships][%d] listMembershipsInternalServerError ", 500)
}
func (o *ListMembershipsInternalServerError) String() string {
return fmt.Sprintf("[GET /memberships][%d] listMembershipsInternalServerError ", 500)
}
func (o *ListMembershipsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
/*
ListMembershipsOKBody list memberships o k body
swagger:model ListMembershipsOKBody
*/
type ListMembershipsOKBody struct {
// memberships
Memberships []*ListMembershipsOKBodyMembershipsItems0 `json:"memberships"`
}
// Validate validates this list memberships o k body
func (o *ListMembershipsOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateMemberships(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListMembershipsOKBody) validateMemberships(formats strfmt.Registry) error {
if swag.IsZero(o.Memberships) { // not required
return nil
}
for i := 0; i < len(o.Memberships); i++ {
if swag.IsZero(o.Memberships[i]) { // not required
continue
}
if o.Memberships[i] != nil {
if err := o.Memberships[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this list memberships o k body based on the context it is used
func (o *ListMembershipsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateMemberships(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListMembershipsOKBody) contextValidateMemberships(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.Memberships); i++ {
if o.Memberships[i] != nil {
if swag.IsZero(o.Memberships[i]) { // not required
return nil
}
if err := o.Memberships[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ListMembershipsOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListMembershipsOKBody) UnmarshalBinary(b []byte) error {
var res ListMembershipsOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ListMembershipsOKBodyMembershipsItems0 list memberships o k body memberships items0
swagger:model ListMembershipsOKBodyMembershipsItems0
*/
type ListMembershipsOKBodyMembershipsItems0 struct {
// admin
Admin bool `json:"admin,omitempty"`
// description
Description string `json:"description,omitempty"`
// token
Token string `json:"token,omitempty"`
}
// Validate validates this list memberships o k body memberships items0
func (o *ListMembershipsOKBodyMembershipsItems0) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this list memberships o k body memberships items0 based on context it is used
func (o *ListMembershipsOKBodyMembershipsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ListMembershipsOKBodyMembershipsItems0) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListMembershipsOKBodyMembershipsItems0) UnmarshalBinary(b []byte) error {
var res ListMembershipsOKBodyMembershipsItems0
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -46,6 +46,8 @@ type ClientService interface {
GetShareMetrics(params *GetShareMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetShareMetricsOK, error)
ListMemberships(params *ListMembershipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListMembershipsOK, error)
OrgAccountOverview(params *OrgAccountOverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgAccountOverviewOK, error)
Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error)
@ -366,6 +368,45 @@ func (a *Client) GetShareMetrics(params *GetShareMetricsParams, authInfo runtime
panic(msg)
}
/*
ListMemberships list memberships API
*/
func (a *Client) ListMemberships(params *ListMembershipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListMembershipsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListMembershipsParams()
}
op := &runtime.ClientOperation{
ID: "listMemberships",
Method: "GET",
PathPattern: "/memberships",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListMembershipsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*ListMembershipsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for listMemberships: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
OrgAccountOverview org account overview API
*/

View File

@ -711,6 +711,47 @@ func init() {
}
}
},
"/memberships": {
"get": {
"security": [
{
"key": []
}
],
"tags": [
"metadata"
],
"operationId": "listMemberships",
"responses": {
"200": {
"description": "ok",
"schema": {
"properties": {
"memberships": {
"type": "array",
"items": {
"properties": {
"admin": {
"type": "boolean"
},
"description": {
"type": "string"
},
"token": {
"type": "string"
}
}
}
}
}
}
},
"500": {
"description": "internal server error"
}
}
}
},
"/metrics/account": {
"get": {
"security": [
@ -2871,6 +2912,37 @@ func init() {
}
}
},
"/memberships": {
"get": {
"security": [
{
"key": []
}
],
"tags": [
"metadata"
],
"operationId": "listMemberships",
"responses": {
"200": {
"description": "ok",
"schema": {
"properties": {
"memberships": {
"type": "array",
"items": {
"$ref": "#/definitions/MembershipsItems0"
}
}
}
}
},
"500": {
"description": "internal server error"
}
}
}
},
"/metrics/account": {
"get": {
"security": [
@ -3680,6 +3752,19 @@ func init() {
}
}
},
"MembershipsItems0": {
"properties": {
"admin": {
"type": "boolean"
},
"description": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"OrganizationsItems0": {
"properties": {
"description": {

View File

@ -0,0 +1,225 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"context"
"net/http"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// ListMembershipsHandlerFunc turns a function with the right signature into a list memberships handler
type ListMembershipsHandlerFunc func(ListMembershipsParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ListMembershipsHandlerFunc) Handle(params ListMembershipsParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// ListMembershipsHandler interface for that can handle valid list memberships params
type ListMembershipsHandler interface {
Handle(ListMembershipsParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewListMemberships creates a new http.Handler for the list memberships operation
func NewListMemberships(ctx *middleware.Context, handler ListMembershipsHandler) *ListMemberships {
return &ListMemberships{Context: ctx, Handler: handler}
}
/*
ListMemberships swagger:route GET /memberships metadata listMemberships
ListMemberships list memberships API
*/
type ListMemberships struct {
Context *middleware.Context
Handler ListMembershipsHandler
}
func (o *ListMemberships) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewListMembershipsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *rest_model_zrok.Principal
if uprinc != nil {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
// ListMembershipsOKBody list memberships o k body
//
// swagger:model ListMembershipsOKBody
type ListMembershipsOKBody struct {
// memberships
Memberships []*ListMembershipsOKBodyMembershipsItems0 `json:"memberships"`
}
// Validate validates this list memberships o k body
func (o *ListMembershipsOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateMemberships(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListMembershipsOKBody) validateMemberships(formats strfmt.Registry) error {
if swag.IsZero(o.Memberships) { // not required
return nil
}
for i := 0; i < len(o.Memberships); i++ {
if swag.IsZero(o.Memberships[i]) { // not required
continue
}
if o.Memberships[i] != nil {
if err := o.Memberships[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this list memberships o k body based on the context it is used
func (o *ListMembershipsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateMemberships(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListMembershipsOKBody) contextValidateMemberships(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.Memberships); i++ {
if o.Memberships[i] != nil {
if swag.IsZero(o.Memberships[i]) { // not required
return nil
}
if err := o.Memberships[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listMembershipsOK" + "." + "memberships" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ListMembershipsOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListMembershipsOKBody) UnmarshalBinary(b []byte) error {
var res ListMembershipsOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
// ListMembershipsOKBodyMembershipsItems0 list memberships o k body memberships items0
//
// swagger:model ListMembershipsOKBodyMembershipsItems0
type ListMembershipsOKBodyMembershipsItems0 struct {
// admin
Admin bool `json:"admin,omitempty"`
// description
Description string `json:"description,omitempty"`
// token
Token string `json:"token,omitempty"`
}
// Validate validates this list memberships o k body memberships items0
func (o *ListMembershipsOKBodyMembershipsItems0) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this list memberships o k body memberships items0 based on context it is used
func (o *ListMembershipsOKBodyMembershipsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ListMembershipsOKBodyMembershipsItems0) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListMembershipsOKBodyMembershipsItems0) UnmarshalBinary(b []byte) error {
var res ListMembershipsOKBodyMembershipsItems0
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -0,0 +1,46 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewListMembershipsParams creates a new ListMembershipsParams object
//
// There are no default values defined in the spec.
func NewListMembershipsParams() ListMembershipsParams {
return ListMembershipsParams{}
}
// ListMembershipsParams contains all the bound params for the list memberships operation
// typically these are obtained from a http.Request
//
// swagger:parameters listMemberships
type ListMembershipsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewListMembershipsParams() beforehand.
func (o *ListMembershipsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,82 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
)
// ListMembershipsOKCode is the HTTP code returned for type ListMembershipsOK
const ListMembershipsOKCode int = 200
/*
ListMembershipsOK ok
swagger:response listMembershipsOK
*/
type ListMembershipsOK struct {
/*
In: Body
*/
Payload *ListMembershipsOKBody `json:"body,omitempty"`
}
// NewListMembershipsOK creates ListMembershipsOK with default headers values
func NewListMembershipsOK() *ListMembershipsOK {
return &ListMembershipsOK{}
}
// WithPayload adds the payload to the list memberships o k response
func (o *ListMembershipsOK) WithPayload(payload *ListMembershipsOKBody) *ListMembershipsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list memberships o k response
func (o *ListMembershipsOK) SetPayload(payload *ListMembershipsOKBody) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ListMembershipsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// ListMembershipsInternalServerErrorCode is the HTTP code returned for type ListMembershipsInternalServerError
const ListMembershipsInternalServerErrorCode int = 500
/*
ListMembershipsInternalServerError internal server error
swagger:response listMembershipsInternalServerError
*/
type ListMembershipsInternalServerError struct {
}
// NewListMembershipsInternalServerError creates ListMembershipsInternalServerError with default headers values
func NewListMembershipsInternalServerError() *ListMembershipsInternalServerError {
return &ListMembershipsInternalServerError{}
}
// WriteResponse to the client
func (o *ListMembershipsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(500)
}

View File

@ -0,0 +1,87 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
)
// ListMembershipsURL generates an URL for the list memberships operation
type ListMembershipsURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ListMembershipsURL) WithBasePath(bp string) *ListMembershipsURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ListMembershipsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *ListMembershipsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/memberships"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *ListMembershipsURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *ListMembershipsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *ListMembershipsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on ListMembershipsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on ListMembershipsURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *ListMembershipsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@ -118,6 +118,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
AdminListFrontendsHandler: admin.ListFrontendsHandlerFunc(func(params admin.ListFrontendsParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.ListFrontends has not yet been implemented")
}),
MetadataListMembershipsHandler: metadata.ListMembershipsHandlerFunc(func(params metadata.ListMembershipsParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation metadata.ListMemberships has not yet been implemented")
}),
AdminListOrganizationMembersHandler: admin.ListOrganizationMembersHandlerFunc(func(params admin.ListOrganizationMembersParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.ListOrganizationMembers has not yet been implemented")
}),
@ -265,6 +268,8 @@ type ZrokAPI struct {
AdminInviteTokenGenerateHandler admin.InviteTokenGenerateHandler
// AdminListFrontendsHandler sets the operation handler for the list frontends operation
AdminListFrontendsHandler admin.ListFrontendsHandler
// MetadataListMembershipsHandler sets the operation handler for the list memberships operation
MetadataListMembershipsHandler metadata.ListMembershipsHandler
// AdminListOrganizationMembersHandler sets the operation handler for the list organization members operation
AdminListOrganizationMembersHandler admin.ListOrganizationMembersHandler
// AdminListOrganizationsHandler sets the operation handler for the list organizations operation
@ -449,6 +454,9 @@ func (o *ZrokAPI) Validate() error {
if o.AdminListFrontendsHandler == nil {
unregistered = append(unregistered, "admin.ListFrontendsHandler")
}
if o.MetadataListMembershipsHandler == nil {
unregistered = append(unregistered, "metadata.ListMembershipsHandler")
}
if o.AdminListOrganizationMembersHandler == nil {
unregistered = append(unregistered, "admin.ListOrganizationMembersHandler")
}
@ -691,6 +699,10 @@ func (o *ZrokAPI) initHandlerCache() {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/frontends"] = admin.NewListFrontends(o.context, o.AdminListFrontendsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/memberships"] = metadata.NewListMemberships(o.context, o.MetadataListMembershipsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}

View File

@ -28,6 +28,8 @@ model/frontend.ts
model/grantsRequest.ts
model/inviteRequest.ts
model/inviteTokenGenerateRequest.ts
model/listMemberships200Response.ts
model/listMemberships200ResponseMembershipsInner.ts
model/listOrganizationMembers200Response.ts
model/listOrganizationMembers200ResponseMembersInner.ts
model/listOrganizations200Response.ts

View File

@ -19,6 +19,7 @@ import { Configuration } from '../model/configuration';
import { Environment } from '../model/environment';
import { EnvironmentAndResources } from '../model/environmentAndResources';
import { Frontend } from '../model/frontend';
import { ListMemberships200Response } from '../model/listMemberships200Response';
import { Metrics } from '../model/metrics';
import { Overview } from '../model/overview';
import { Share } from '../model/share';
@ -654,6 +655,70 @@ export class MetadataApi {
});
});
}
/**
*
*/
public async listMemberships (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListMemberships200Response; }> {
const localVarPath = this.basePath + '/memberships';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/zrok.v1+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.key.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.key.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: ListMemberships200Response; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "ListMemberships200Response");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param organizationToken

View File

@ -0,0 +1,32 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { RequestFile } from './models';
import { ListMemberships200ResponseMembershipsInner } from './listMemberships200ResponseMembershipsInner';
export class ListMemberships200Response {
'memberships'?: Array<ListMemberships200ResponseMembershipsInner>;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "memberships",
"baseName": "memberships",
"type": "Array<ListMemberships200ResponseMembershipsInner>"
} ];
static getAttributeTypeMap() {
return ListMemberships200Response.attributeTypeMap;
}
}

View File

@ -0,0 +1,43 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { RequestFile } from './models';
export class ListMemberships200ResponseMembershipsInner {
'token'?: string;
'description'?: string;
'admin'?: boolean;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "token",
"baseName": "token",
"type": "string"
},
{
"name": "description",
"baseName": "description",
"type": "string"
},
{
"name": "admin",
"baseName": "admin",
"type": "boolean"
} ];
static getAttributeTypeMap() {
return ListMemberships200ResponseMembershipsInner.attributeTypeMap;
}
}

View File

@ -22,6 +22,8 @@ export * from './frontend';
export * from './grantsRequest';
export * from './inviteRequest';
export * from './inviteTokenGenerateRequest';
export * from './listMemberships200Response';
export * from './listMemberships200ResponseMembershipsInner';
export * from './listOrganizationMembers200Response';
export * from './listOrganizationMembers200ResponseMembersInner';
export * from './listOrganizations200Response';
@ -85,6 +87,8 @@ import { Frontend } from './frontend';
import { GrantsRequest } from './grantsRequest';
import { InviteRequest } from './inviteRequest';
import { InviteTokenGenerateRequest } from './inviteTokenGenerateRequest';
import { ListMemberships200Response } from './listMemberships200Response';
import { ListMemberships200ResponseMembershipsInner } from './listMemberships200ResponseMembershipsInner';
import { ListOrganizationMembers200Response } from './listOrganizationMembers200Response';
import { ListOrganizationMembers200ResponseMembersInner } from './listOrganizationMembers200ResponseMembersInner';
import { ListOrganizations200Response } from './listOrganizations200Response';
@ -156,6 +160,8 @@ let typeMap: {[index: string]: any} = {
"GrantsRequest": GrantsRequest,
"InviteRequest": InviteRequest,
"InviteTokenGenerateRequest": InviteTokenGenerateRequest,
"ListMemberships200Response": ListMemberships200Response,
"ListMemberships200ResponseMembershipsInner": ListMemberships200ResponseMembershipsInner,
"ListOrganizationMembers200Response": ListOrganizationMembers200Response,
"ListOrganizationMembers200ResponseMembersInner": ListOrganizationMembers200ResponseMembersInner,
"ListOrganizations200Response": ListOrganizations200Response,

View File

@ -49,6 +49,8 @@ from zrok_api.models.inline_response2001 import InlineResponse2001
from zrok_api.models.inline_response2001_members import InlineResponse2001Members
from zrok_api.models.inline_response2002 import InlineResponse2002
from zrok_api.models.inline_response2002_organizations import InlineResponse2002Organizations
from zrok_api.models.inline_response2003 import InlineResponse2003
from zrok_api.models.inline_response2003_memberships import InlineResponse2003Memberships
from zrok_api.models.inline_response201 import InlineResponse201
from zrok_api.models.invite_request import InviteRequest
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest

View File

@ -764,6 +764,91 @@ class MetadataApi(object):
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_memberships(self, **kwargs): # noqa: E501
"""list_memberships # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_memberships_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_memberships_with_http_info(**kwargs) # noqa: E501
return data
def list_memberships_with_http_info(self, **kwargs): # noqa: E501
"""list_memberships # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_memberships" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/zrok.v1+json']) # noqa: E501
# Authentication setting
auth_settings = ['key'] # noqa: E501
return self.api_client.call_api(
'/memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2003', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def org_account_overview(self, organization_token, account_email, **kwargs): # noqa: E501
"""org_account_overview # noqa: E501

View File

@ -39,6 +39,8 @@ from zrok_api.models.inline_response2001 import InlineResponse2001
from zrok_api.models.inline_response2001_members import InlineResponse2001Members
from zrok_api.models.inline_response2002 import InlineResponse2002
from zrok_api.models.inline_response2002_organizations import InlineResponse2002Organizations
from zrok_api.models.inline_response2003 import InlineResponse2003
from zrok_api.models.inline_response2003_memberships import InlineResponse2003Memberships
from zrok_api.models.inline_response201 import InlineResponse201
from zrok_api.models.invite_request import InviteRequest
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest

View File

@ -0,0 +1,110 @@
# coding: utf-8
"""
zrok
zrok client access # noqa: E501
OpenAPI spec version: 0.3.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class InlineResponse2003(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'memberships': 'list[InlineResponse2003Memberships]'
}
attribute_map = {
'memberships': 'memberships'
}
def __init__(self, memberships=None): # noqa: E501
"""InlineResponse2003 - a model defined in Swagger""" # noqa: E501
self._memberships = None
self.discriminator = None
if memberships is not None:
self.memberships = memberships
@property
def memberships(self):
"""Gets the memberships of this InlineResponse2003. # noqa: E501
:return: The memberships of this InlineResponse2003. # noqa: E501
:rtype: list[InlineResponse2003Memberships]
"""
return self._memberships
@memberships.setter
def memberships(self, memberships):
"""Sets the memberships of this InlineResponse2003.
:param memberships: The memberships of this InlineResponse2003. # noqa: E501
:type: list[InlineResponse2003Memberships]
"""
self._memberships = memberships
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(InlineResponse2003, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, InlineResponse2003):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -0,0 +1,162 @@
# coding: utf-8
"""
zrok
zrok client access # noqa: E501
OpenAPI spec version: 0.3.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class InlineResponse2003Memberships(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'token': 'str',
'description': 'str',
'admin': 'bool'
}
attribute_map = {
'token': 'token',
'description': 'description',
'admin': 'admin'
}
def __init__(self, token=None, description=None, admin=None): # noqa: E501
"""InlineResponse2003Memberships - a model defined in Swagger""" # noqa: E501
self._token = None
self._description = None
self._admin = None
self.discriminator = None
if token is not None:
self.token = token
if description is not None:
self.description = description
if admin is not None:
self.admin = admin
@property
def token(self):
"""Gets the token of this InlineResponse2003Memberships. # noqa: E501
:return: The token of this InlineResponse2003Memberships. # noqa: E501
:rtype: str
"""
return self._token
@token.setter
def token(self, token):
"""Sets the token of this InlineResponse2003Memberships.
:param token: The token of this InlineResponse2003Memberships. # noqa: E501
:type: str
"""
self._token = token
@property
def description(self):
"""Gets the description of this InlineResponse2003Memberships. # noqa: E501
:return: The description of this InlineResponse2003Memberships. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this InlineResponse2003Memberships.
:param description: The description of this InlineResponse2003Memberships. # noqa: E501
:type: str
"""
self._description = description
@property
def admin(self):
"""Gets the admin of this InlineResponse2003Memberships. # noqa: E501
:return: The admin of this InlineResponse2003Memberships. # noqa: E501
:rtype: bool
"""
return self._admin
@admin.setter
def admin(self, admin):
"""Sets the admin of this InlineResponse2003Memberships.
:param admin: The admin of this InlineResponse2003Memberships. # noqa: E501
:type: bool
"""
self._admin = admin
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(InlineResponse2003Memberships, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, InlineResponse2003Memberships):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -691,6 +691,31 @@ paths:
500:
description: internal server error
/memberships:
get:
tags:
- metadata
security:
- key: []
operationId: listMemberships
responses:
200:
description: ok
schema:
properties:
memberships:
type: array
items:
properties:
token:
type: string
description:
type: string
admin:
type: boolean
500:
description: internal server error
/overview:
get:
tags:

View File

@ -53,6 +53,12 @@ export function getShareDetail(shrToken) {
return gateway.request(getShareDetailOperation, parameters)
}
/**
*/
export function listMemberships() {
return gateway.request(listMembershipsOperation)
}
/**
*/
export function overview() {
@ -178,6 +184,16 @@ const getShareDetailOperation = {
]
}
const listMembershipsOperation = {
path: '/memberships',
method: 'get',
security: [
{
id: 'key'
}
]
}
const overviewOperation = {
path: '/overview',
method: 'get',