MCPcopy
hub / github.com/nats-io/nats.go / apiRequestJSON

Method apiRequestJSON

jetstream/api.go:115–124  ·  view source on GitHub ↗
(ctx context.Context, subject string, resp any, data ...[]byte)

Source from the content-addressed store, hash-verified

113)
114
115func (js *jetStream) apiRequestJSON(ctx context.Context, subject string, resp any, data ...[]byte) (*jetStreamMsg, error) {
116 jsMsg, err := js.apiRequest(ctx, subject, data...)
117 if err != nil {
118 return nil, err
119 }
120 if err := json.Unmarshal(jsMsg.Data(), resp); err != nil {
121 return nil, err
122 }
123 return jsMsg, nil
124}
125
126// a RequestWithContext with tracing via TraceCB
127func (js *jetStream) apiRequest(ctx context.Context, subj string, data ...[]byte) (*jetStreamMsg, error) {

Callers 15

CreateStreamMethod · 0.95
UpdateStreamMethod · 0.95
StreamMethod · 0.95
DeleteStreamMethod · 0.95
AccountInfoMethod · 0.95
StreamNameBySubjectMethod · 0.95
InfoMethod · 0.80
InfoMethod · 0.80
upsertConsumerFunction · 0.80
fetchConsumerInfoFunction · 0.80
deleteConsumerFunction · 0.80
pauseConsumerFunction · 0.80

Calls 2

apiRequestMethod · 0.95
DataMethod · 0.65

Tested by

no test coverage detected