-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrequests.sh
83 lines (75 loc) · 2.22 KB
/
requests.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
getReleaseVersions () {
publisherExtension="$1"
writeTo="$2"
req=$(cat <<EOF
{
"assetTypes": [],
"filters": [
{
"criteria": [
{
"filterType": 8,
"value": "Microsoft.VisualStudio.Code"
},
{
"filterType": 7,
"value": "$publisherExtension"
}
],
"pageNumber": 1,
"pageSize": 2
}
],
"flags": 1073
}
EOF
)
printf "%s" "$req" \
| curl -sSL -H 'Accept: application/json;api-version=6.1-preview.1' -H 'Content-Type: application/json' https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery -d @- \
> "$writeTo"
}
getLatestVersion () {
publisherExtension="$1"
writeTo="$2"
req=$(cat <<EOF
{
"assetTypes": [],
"filters": [
{
"criteria": [
{
"filterType": 8,
"value": "Microsoft.VisualStudio.Code"
},
{
"filterType": 7,
"value": "$publisherExtension"
},
{
"filterType": 12,
"value": "4096"
}
],
"sortBy": 4,
"sortOrder": 2,
"pageNumber": 1,
"pageSize": 3
}
],
"assetTypes": [],
"flags": 946
}
EOF
)
printf "%s" "$req" \
| curl -sSL -H 'Accept: application/json;api-version=6.1-preview.1' -H 'Content-Type: application/json' https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery -d @- \
> "$writeTo"
}
mkdir -p tmp
getReleaseVersions "github.copilot" "tmp/copilot.versions.json"
jq -M . tmp/copilot.versions.json > tmp/formatted
cat tmp/formatted > tmp/copilot.versions.json
getLatestVersion "github.copilot" "tmp/copilot.latest.json"
jq -M . tmp/copilot.latest.json > tmp/formatted
cat tmp/formatted > tmp/copilot.latest.json
rm tmp/formatted