func (c *Caller) Call(req *jsonrpc.RPCRequest) (*jsonrpc.RPCResponse, error) {
	if c.endpoint == "" {
		return nil, errors.Err("cannot call blank endpoint")
	}

	walletID := ""
	if c.userID != 0 {
		walletID = sdkrouter.WalletID(c.userID)
	}

	q, err := NewQuery(req, walletID)
	if err != nil {
		return nil, err
	}

	// Applying preflight hooks
	var res *jsonrpc.RPCResponse
	for _, hook := range c.preflightHooks {
		if isMatchingHook(q.Method(), hook) {
			res, err = hook.function(c, &HookContext{Query: q})
			if err != nil {
				return nil, rpcerrors.NewSDKError(err)
			}
			if res != nil {
				return res, nil
			}
		}
	}

	if res == nil {
		res, err = c.callQueryWithRetry(q)
		if err != nil {
			return nil, rpcerrors.NewSDKError(err)
		}
	}

	if isCacheable(q) {
		c.Cache.Save(q.Method(), q.Params(), res)
	}

	return res, nil
}
// Call method forwards a JSON-RPC request to the lbrynet server.
// It returns a response that is ready to be sent back to the JSON-RPC client as is.
Call method forwards a JSON-RPC request to the lbrynet server.
It returns a response that is ready to be sent back to the JSON-RPC client as is.
// Call method forwards a JSON - RPC request to the lbrynet server . // It returns a response that is ready to be sent back to the JSON - RPC client as is .
func (c *Caller) Call(req *jsonrpc.RPCRequest) (*jsonrpc.RPCResponse, error) {
	if c.endpoint == "" {
		return nil, errors.Err("cannot call blank endpoint")
	}
	walletID := ""
	if c.userID != 0 {
		walletID = sdkrouter.WalletID(c.userID)
	}
	q, err := NewQuery(req, walletID)
	if err != nil {
		return nil, err
	}
	var res *jsonrpc.RPCResponse
	for _, hook := range c.preflightHooks {
		if isMatchingHook(q.Method(), hook) {
			res, err = hook.function(c, &HookContext{Query: q})
			if err != nil {
				return nil, rpcerrors.NewSDKError(err)
			}
			if res != nil {
				return res, nil
			}
		}
	}
	if res == nil {
		res, err = c.callQueryWithRetry(q)
		if err != nil {
			return nil, rpcerrors.NewSDKError(err)
		}
	}
	if isCacheable(q) {
		c.Cache.Save(q.Method(), q.Params(), res)
	}
	return res, nil
}
func ( c * Caller ) Call ( req * jsonrpc . RPCRequest ) ( * jsonrpc . RPCResponse , error ) { if c . endpoint == " " { return nil , errors . Err ( " " ) } walletID := " " if c . userID != 0 { walletID = sdkrouter . WalletID ( c . userID ) } q , err := NewQuery ( req , walletID ) if err != nil { return nil , err } var res * jsonrpc . RPCResponse for _ , hook := range c . preflightHooks { if isMatchingHook ( q . Method ( ) , hook ) { res , err = hook . function ( c , & HookContext { Query : q } ) if err != nil { return nil , rpcerrors . NewSDKError ( err ) } if res != nil { return res , nil } } } if res == nil { res , err = c . callQueryWithRetry ( q ) if err != nil { return nil , rpcerrors . NewSDKError ( err ) } } if isCacheable ( q ) { c . Cache . Save ( q . Method ( ) , q . Params ( ) , res ) } return res , nil }
Call method forwards a JSON-RPC request to the lbrynet server.
Call method forwards a JSON - RPC request to the lbrynet server .
// Applying preflight hooks