You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dynamix-golang-sdk/pkg/cloudapi/user/api_list.go

42 lines
931 B

package user
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// APIListRequest struct for getting API list.
type APIListRequest struct {
// ID of the user.
// Required: true
UserID string `url:"userId" json:"userId" validate:"required"`
}
// APIList gets a list of all API functions that a given user has
// access to according to their apiaccess group membership.
func (u User) APIList(ctx context.Context, req APIListRequest) (*APIsEndpoints, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/user/apiList"
info := APIsEndpoints{}
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}