Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brittonhayes/fbi
Go client for the FBI's Most Wanted REST API 🚔
https://github.com/brittonhayes/fbi
Last synced: 16 days ago
JSON representation
Go client for the FBI's Most Wanted REST API 🚔
- Host: GitHub
- URL: https://github.com/brittonhayes/fbi
- Owner: brittonhayes
- License: mit
- Created: 2021-01-08T03:49:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-08T09:03:07.000Z (almost 4 years ago)
- Last Synced: 2024-10-04T19:07:25.000Z (about 1 month ago)
- Language: Go
- Size: 16.6 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# fbi
```go
import "github.com/brittonhayes/fbi"
```fbi is a Go client for the FBI's Most Wanted REST API 🚔
### Installation
```
go get -u github.com/brittonhayes/fbi
```### Usage
```
func main() {
// Initialize fugitives
f := new(fbi.Fugitives)// List the fugitives
err := f.List()
if err != nil {
// handle error
panic(err)
}// Print raw results
fmt.Println(f)// Print specific items from the list of results
fmt.Println(f.Items[0])}
```### Pretty Print Results
```
func main() {
// Initialize fugitives
f := new(fbi.Fugitives)// List the fugitives as pretty-printed json
j, err := f.ListPretty()
if err != nil {
panic(err)
}// Print out the results
fmt.Println(string(j))}
```### Reference
Source API: https://api.fbi.gov/wanted/v1/list
## Index
- [Constants](<#constants>)
- [type Downloader](<#type-downloader>)
- [type FBI](<#type-fbi>)
- [type Files](<#type-files>)
- [func (f Files) Download(filename string) error](<#func-files-download>)
- [type Fugitives](<#type-fugitives>)
- [func (f *Fugitives) Find(opt *Options) error](<#func-fugitives-find>)
- [func (f *Fugitives) List() error](<#func-fugitives-list>)
- [func (f *Fugitives) ListPretty() ([]byte, error)](<#func-fugitives-listpretty>)
- [type Images](<#type-images>)
- [func (i Images) Download(filename string) error](<#func-images-download>)
- [type Individual](<#type-individual>)
- [type Options](<#type-options>)## Constants
```go
const (
BaseURL = "https://api.fbi.gov/wanted/v1"
)
```## type Downloader
Downloader allows locally downloading the remote files and images from their URLs
```go
type Downloader interface {
Download(filename string) error
}
```## type FBI
FBI contains the methods available to the Individual type
```go
type FBI interface {
List() error
ListPretty() ([]byte, error)
Find(opt *Options) error
}
```## type Files
Files are any related files available pertaining to the individual
```go
type Files struct {
Name string `json:"name"`
URL string `json:"url"`
}
```### func \(Files\) Download
```go
func (f Files) Download(filename string) error
```Download files to a file from the URLs provided
## type Fugitives
Fugitives is the base structure for the FBI most wanted REST API response and contains a list of individuals as well as the total items found
```go
type Fugitives struct {
Total int `json:"total"`
Items []Individual `json:"items"`
}
```### func \(\*Fugitives\) Find
```go
func (f *Fugitives) Find(opt *Options) error
```Find all fugitives matching the parameters provided in the opt struct
### func \(\*Fugitives\) List
```go
func (f *Fugitives) List() error
```List all fugitives from the Most Wanted API
### func \(\*Fugitives\) ListPretty
```go
func (f *Fugitives) ListPretty() ([]byte, error)
```ListPretty lists all fugitives from the Most Wanted API and then auto formats results as pretty\-printed JSON
## type Images
Images are the pictures available of the individual
```go
type Images struct {
Large string `json:"large"`
Caption interface{} `json:"caption"`
Original string `json:"original"`
Thumb string `json:"thumb"`
}
```### func \(Images\) Download
```go
func (i Images) Download(filename string) error
```Download images to a file from the URLs provided
## type Individual
Individual represents a single person in the FBI most wanted list
```go
type Individual struct {
Images []Images `json:"images"`
Occupations interface{} `json:"occupations"`
DatesOfBirthUsed interface{} `json:"dates_of_birth_used"`
WeightMax interface{} `json:"weight_max"`
AgeMax interface{} `json:"age_max"`
AgeRange interface{} `json:"age_range"`
AdditionalInformation interface{} `json:"additional_information"`
WeightMin interface{} `json:"weight_min"`
RewardText string `json:"reward_text"`
Aliases interface{} `json:"aliases"`
UID string `json:"uid"`
HairRaw interface{} `json:"hair_raw"`
Race interface{} `json:"race"`
RaceRaw interface{} `json:"race_raw"`
Eyes interface{} `json:"eyes"`
Hair interface{} `json:"hair"`
Sex interface{} `json:"sex"`
Languages interface{} `json:"languages"`
WarningMessage interface{} `json:"warning_message"`
PossibleCountries interface{} `json:"possible_countries"`
Remarks interface{} `json:"remarks"`
Build interface{} `json:"build"`
HeightMin interface{} `json:"height_min"`
Suspects interface{} `json:"suspects"`
Publication string `json:"publication"`
Status string `json:"status"`
Subjects []string `json:"subjects"`
Title string `json:"title"`
ScarsAndMarks interface{} `json:"scars_and_marks"`
Path string `json:"path"`
PossibleStates interface{} `json:"possible_states"`
Nationality interface{} `json:"nationality"`
Files []Files `json:"files"`
Coordinates []interface{} `json:"coordinates"`
PersonClassification string `json:"person_classification"`
Description string `json:"description"`
PlaceOfBirth interface{} `json:"place_of_birth"`
HeightMax interface{} `json:"height_max"`
Locations interface{} `json:"locations"`
Caution interface{} `json:"caution"`
EyesRaw interface{} `json:"eyes_raw"`
Ncic interface{} `json:"ncic"`
LegatNames interface{} `json:"legat_names"`
Complexion interface{} `json:"complexion"`
FieldOffices []string `json:"field_offices"`
RewardMin int `json:"reward_min"`
RewardMax int `json:"reward_max"`
AgeMin interface{} `json:"age_min"`
URL string `json:"url"`
Details string `json:"details"`
Modified time.Time `json:"modified"`
Weight interface{} `json:"weight"`
ID string `json:"@id"`
}
```## type Options
Options contains the available query params for filter API request results
```go
type Options struct {
Title string `url:"title"`
FieldOffices string `url:"field_offices"`
Status string `url:"status"`
PersonClassification string `url:"person_classification"`
Page int `url:"page"`
Limit int `url:"pageSize"`
SortOn string `url:"sort_on"`
SortOrder string `url:"sort_order"`
}
```Generated by [gomarkdoc]()