summaryrefslogtreecommitdiffstats
path: root/internal/client/osint.go
blob: 70dbb72c61290f51befbef8363157da86d4524c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package client

import (
	"dborg/internal/models"
	"encoding/json"
	"fmt"
	"net/url"
)

func (c *Client) LookupBSSID(params *models.BSSIDParams) (*models.BSSIDLookupResponse, error) {
	path := fmt.Sprintf("/osint/bssid/%s", url.PathEscape(params.BSSID))

	queryParams := url.Values{}
	if params.All {
		queryParams.Add("all", "true")
	}
	if params.Map {
		queryParams.Add("map", "true")
	}

	data, err := c.Get(path, queryParams)
	if err != nil {
		return nil, err
	}

	var response models.BSSIDLookupResponse
	if err := json.Unmarshal(data, &response); err != nil {
		return nil, fmt.Errorf("failed to parse BSSID lookup response: %w", err)
	}

	return &response, nil
}