From e3ec3372984cc82d9194fbbdba8ef3a815ca9ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= Date: Tue, 21 May 2024 12:09:26 +0200 Subject: [PATCH] feat(SPV-804): adjust contact search methods --- http.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/http.go b/http.go index 7f12cfb..a858410 100644 --- a/http.go +++ b/http.go @@ -664,7 +664,7 @@ func (wc *WalletClient) ConfirmContact(ctx context.Context, contact *models.Cont } // GetContacts will get contacts by conditions -func (wc *WalletClient) GetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Contact, ResponseError) { +func (wc *WalletClient) GetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) (*models.SearchContactsResponse, ResponseError) { jsonStr, err := json.Marshal(map[string]interface{}{ FieldConditions: conditions, FieldMetadata: processMetadata(metadata), @@ -674,7 +674,7 @@ func (wc *WalletClient) GetContacts(ctx context.Context, conditions map[string]i return nil, WrapError(err) } - var result []*models.Contact + var result *models.SearchContactsResponse if err := wc.doHTTPRequest( ctx, http.MethodPost, "/contact/search", jsonStr, wc.xPriv, wc.signRequest, &result, ); err != nil { @@ -1025,7 +1025,7 @@ func (wc *WalletClient) AdminGetSharedConfig(ctx context.Context) (*models.Share } // AdminGetContacts executes an HTTP POST request to search for contacts based on specified conditions, metadata, and query parameters. -func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Contact, ResponseError) { +func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) (*models.SearchContactsResponse, ResponseError) { jsonStr, err := json.Marshal(map[string]interface{}{ FieldConditions: conditions, FieldMetadata: processMetadata(metadata), @@ -1035,7 +1035,7 @@ func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions map[str return nil, WrapError(err) } - var contacts []*models.Contact + var contacts *models.SearchContactsResponse err = wc.doHTTPRequest(ctx, http.MethodPost, "/admin/contact/search", jsonStr, wc.adminXPriv, true, &contacts) return contacts, WrapError(err) }