-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocorro.nu
More file actions
39 lines (33 loc) · 1015 Bytes
/
socorro.nu
File metadata and controls
39 lines (33 loc) · 1015 Bytes
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
33
34
35
36
37
38
39
export def "api processed-crash" [
crash_id: string,
] {
_http get "ProcessedCrash/" { crash_id: $crash_id }
}
export def "api signatures-by-bugs" [
...bug_ids: int,
] {
_http get "SignaturesByBugs/" { bug_ids: ($bug_ids | each { into string }) }
}
export def "api super-search" [
arguments: record,
] {
_http get "SuperSearch/" $arguments
}
export def reports-from-bug [
bug_id: int,
] {
let signatures = api signatures-by-bugs $bug_id | get hits.signature
let reports = api super-search {
signature: ($signatures | each { $'=($in)' }) # `=` is a string search operator for "exact match"
product: Firefox
} | get hits.uuid
$reports | par-each { api processed-crash $in }
}
export def "_http get" [
url_path: string,
query_params: record,
] {
const USER_AGENT_HEADER = ["User-Agent" "ErichDonGubler-Socorro-Nushell/1.0"]
let req_url = $'https://crash-stats.mozilla.org/api/($url_path)?($query_params | url build-query)'
http get --headers $USER_AGENT_HEADER $req_url
}