// ListPayments returns a list of all outgoing payments.
330776
func (r *rpcServer) ListPayments(ctx context.Context,
	_ *lnrpc.ListPaymentsRequest) (*lnrpc.ListPaymentsResponse, error) {

	rpcsLog.Debugf("[ListPayments]")

	payments, err := r.server.chanDB.FetchAllPayments()
	if err != nil && err != channeldb.ErrNoPaymentsCreated {
		return nil, err
	}

	paymentsResp := &lnrpc.ListPaymentsResponse{
		Payments: make([]*lnrpc.Payment, len(payments)),
	}
	for i, payment := range payments {
		path := make([]string, len(payment.Path))
		for i, hop := range payment.Path {
			path[i] = hex.EncodeToString(hop[:])
		}

		msatValue := int64(payment.Terms.Value)
		satValue := int64(payment.Terms.Value.ToSatoshis())

		paymentHash := sha256.Sum256(payment.PaymentPreimage[:])
		paymentsResp.Payments[i] = &lnrpc.Payment{
			PaymentHash:     hex.EncodeToString(paymentHash[:]),
			Value:           satValue,
			ValueMsat:       msatValue,
			ValueSat:        satValue,
			CreationDate:    payment.CreationDate.Unix(),
			Path:            path,
			Fee:             int64(payment.Fee.ToSatoshis()),
			PaymentPreimage: hex.EncodeToString(payment.PaymentPreimage[:]),
		}
	}

	return paymentsResp, nil
}
1114683
func (pdb *BytesBrokerWatcherEtcd) ListKeys(prefix string) (keyval.BytesKeyIterator, error) {
	return listKeysInternal(pdb.Logger, pdb.kv, pdb.opTimeout, prefix)
}
979910
func (a *Agent) ListKeys() (*serf.KeyResponse, error) {
	a.logger.Print("[INFO] agent: Initiating key listing")
	manager := a.serf.KeyManager()
	return manager.ListKeys()
}
87357
func (cbb *BytesBrokerWrapper) ListValues(key string) (keyval.BytesKeyValIterator, error) {
	kv, err := cbb.BytesBroker.ListValues(key)
	if err != nil {
		return kv, err
	}
	return &BytesKeyValIteratorWrapper{
		BytesKeyValIterator: kv,
		decryptData:         cbb.decryptData,
	}, nil
}
241656
func (pdb *BytesBrokerWatcherEtcd) ListValues(key string) (keyval.BytesKeyValIterator, error) {
	return listValuesInternal(pdb.Logger, pdb.kv, pdb.opTimeout, key)
}
1045879
func (c *Client) ListTransactionsCount(account string, count int) ([]btcjson.ListTransactionsResult, error) {
	return c.ListTransactionsCountAsync(account, count).Receive()
}
1032779
func (a *ActionAPI) ListAll(arg params.Entities) (params.ActionsByReceivers, error) {
	if err := a.checkCanRead(); err != nil {
		return params.ActionsByReceivers{}, errors.Trace(err)
	}

	return a.internalList(arg, combine(pendingActions, runningActions, completedActions))
}
639874
func (s *serviceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) {
	result := &api.ServiceAccountList{}

	err := s.client.Get().
		Namespace(s.namespace).
		Resource("serviceAccounts").
		VersionedParams(&opts, api.Scheme).
		Do().
		Into(result)

	return result, err
}
555707
func (c oauthClient) Lists() ([]wl.List, error) {
	url := fmt.Sprintf(
		"%s/lists",
		c.apiURL,
	)

	req, err := c.newGetRequest(url)
	if err != nil {
		return nil, err
	}

	resp, err := c.do(req)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("Unexpected response code %d - expected %d", resp.StatusCode, http.StatusOK)
	}

	lists := []wl.List{}
	err = json.NewDecoder(resp.Body).Decode(&lists)
	if err != nil {
		return lists, err
	}
	return lists, nil
}
295512
func (a *AccountState) PendingPayments(ctx context.Context, limit int) ([]stellar1.PaymentSummary, error) {
	a.RLock()
	defer a.RUnlock()
	a.enqueueRefreshReq()
	if limit > 0 && limit < len(a.pending) {
		return a.pending[:limit], nil
	}
	return a.pending, nil
}
738984
func (no NetworkOffering) ListRequest() (ListCommand, error) {
	req := &ListNetworkOfferings{
		Availability: no.Availability,
		ID:           no.ID,
		Name:         no.Name,
		State:        no.State,
		TrafficType:  no.TrafficType,
	}

	return req, nil
}
72635
func (c Client) List(listParams *stripe.CardListParams) *Iter {
	var path string
	var outerErr error

	// Because the external accounts and sources endpoints can return non-card
	// objects, CardListParam's `AppendTo` will add the filter `object=card` to
	// make sure that only cards come back with the response.
	if listParams == nil {
		outerErr = errors.New("params should not be nil")
	} else if listParams.Account != nil {
		path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts",
			stripe.StringValue(listParams.Account))
	} else if listParams.Customer != nil {
		path = stripe.FormatURLPath("/v1/customers/%s/sources",
			stripe.StringValue(listParams.Customer))
	} else if listParams.Recipient != nil {
		path = stripe.FormatURLPath("/v1/recipients/%s/cards", stripe.StringValue(listParams.Recipient))
	} else {
		outerErr = errors.New("Invalid card params: either account, customer or recipient need to be set")
	}

	return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.CardList{}

		if outerErr != nil {
			return nil, list.ListMeta, outerErr
		}

		err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)

		ret := make([]interface{}, len(list.Data))
		for i, v := range list.Data {
			ret[i] = v
		}

		return ret, list.ListMeta, err
	})}
}
873066
func (s *SSHKeysService) List() ([]SSHKey, *http.Response, error) {
	u := "/v2/account/keys"

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	sr := new(SSHKeyListResponse)
	resp, err := s.client.Do(req, sr)
	if err != nil {
		return nil, resp, err
	}
	return sr.SSHKeys, resp, err
}
241776
func (c oauthClient) List(listID uint) (wl.List, error) {
	url := fmt.Sprintf(
		"%s/lists/%d",
		c.apiURL,
		listID,
	)

	req, err := c.newGetRequest(url)
	if err != nil {
		return wl.List{}, err
	}

	resp, err := c.do(req)
	if err != nil {
		return wl.List{}, err
	}

	if resp.StatusCode != http.StatusOK {
		return wl.List{}, fmt.Errorf("Unexpected response code %d - expected %d", resp.StatusCode, http.StatusOK)
	}

	list := wl.List{}
	err = json.NewDecoder(resp.Body).Decode(&list)
	if err != nil {
		return wl.List{}, err
	}
	return list, nil
}
740939
func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, error) {
	// Grab the best block the wallet knows of, we'll use this to calculate
	// # of confirmations shortly below.
	bestBlock := b.wallet.Manager.SyncedTo()
	currentHeight := bestBlock.Height

	// We'll attempt to find all unconfirmed transactions (height of -1),
	// as well as all transactions that are known to have confirmed at this
	// height.
	start := base.NewBlockIdentifierFromHeight(0)
	stop := base.NewBlockIdentifierFromHeight(-1)
	txns, err := b.wallet.GetTransactions(start, stop, nil)
	if err != nil {
		return nil, err
	}

	txDetails := make([]*lnwallet.TransactionDetail, 0,
		len(txns.MinedTransactions)+len(txns.UnminedTransactions))

	// For both confirmed and unconfirmed transactions, create a
	// TransactionDetail which re-packages the data returned by the base
	// wallet.
	for _, blockPackage := range txns.MinedTransactions {
		details, err := minedTransactionsToDetails(currentHeight, blockPackage, b.netParams)
		if err != nil {
			return nil, err
		}

		txDetails = append(txDetails, details...)
	}
	for _, tx := range txns.UnminedTransactions {
		detail, err := unminedTransactionsToDetail(tx)
		if err != nil {
			return nil, err
		}

		txDetails = append(txDetails, detail)
	}

	return txDetails, nil
}
989171
func (db *ProtoBrokerWrapper) ListValues(key string) (keyval.ProtoKeyValIterator, error) {
	kv, err := db.ProtoBroker.ListValues(key)
	if err != nil {
		return kv, err
	}
	return &ProtoKeyValIteratorWrapper{
		ProtoKeyValIterator: kv,
		decryptData:         db.decryptData,
	}, nil
}
348837
func (h *Client) list(ctx context.Context, req *rls.ListReleasesRequest) (*rls.ListReleasesResponse, error) {
	c, err := h.connect(ctx)
	if err != nil {
		return nil, err
	}
	defer c.Close()

	rlc := rls.NewReleaseServiceClient(c)
	s, err := rlc.ListReleases(ctx, req)
	if err != nil {
		return nil, err
	}
	var resp *rls.ListReleasesResponse
	for {
		r, err := s.Recv()
		if err == io.EOF {
			break
		}
		if err != nil {
			return nil, err
		}
		if resp == nil {
			resp = r
			continue
		}
		resp.Releases = append(resp.Releases, r.GetReleases()...)
	}
	return resp, nil
}