X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fclientapi%2Fcommon%2Fcommon_client.go;h=de4a4d7985e74e57a8882479e621ac639218887c;hb=refs%2Fchanges%2F65%2F5865%2F4;hp=8db6f11037e55441f588acdfd1d3f188e5cf5d66;hpb=844be329568878ce3e2f3aa4a5f9dcfc92b8b0f5;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/clientapi/common/common_client.go b/pkg/clientapi/common/common_client.go index 8db6f11..de4a4d7 100644 --- a/pkg/clientapi/common/common_client.go +++ b/pkg/clientapi/common/common_client.go @@ -24,6 +24,34 @@ type Client struct { formats strfmt.Registry } +/* +Subscribe subscribes a list of x2 a p event triggers to receive messages sent by r a n +*/ +func (a *Client) Subscribe(params *SubscribeParams) (*SubscribeCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewSubscribeParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "Subscribe", + Method: "POST", + PathPattern: "/subscriptions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &SubscribeReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*SubscribeCreated), nil + +} + /* Unsubscribe unsubscribes x2 a p events from subscription manager */ @@ -52,6 +80,34 @@ func (a *Client) Unsubscribe(params *UnsubscribeParams) (*UnsubscribeNoContent, } +/* +GetAllSubscriptions returns list of subscriptions +*/ +func (a *Client) GetAllSubscriptions(params *GetAllSubscriptionsParams) (*GetAllSubscriptionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAllSubscriptionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "getAllSubscriptions", + Method: "GET", + PathPattern: "/subscriptions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAllSubscriptionsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAllSubscriptionsOK), nil + +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport