jeyraof / is-ui-available

check ubiquiti product in stock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I finally bought the Dream Router! We no longer need this Repository.

https://twitter.com/_jeyraof/status/1537756024106496002


is-ui-available

Build

$ go build -o is-ui-available

Usage

$ ./is-ui-available -config=sample_config.yaml

[{"name":"Cloud Key Gen2 Plus","url":"https://store.ui.com/collections/unifi-network-unifi-os-consoles/products/unifi-cloudkey-plus","in_stock":true}]

syntax for config.yaml

products:
  - name: "name for identifying"
    url: "url for ubiquiti item"
  - name: "name for identifying (2)"
    url: "url for ubiquiti item (2)"

Piping

use jq:

$ ./is-ui-available -config=sample_config.yaml | jq .   
[
  {
    "name": "Dream Router",
    "url": "https://store.ui.com/collections/unifi-network-unifi-os-consoles/products/dream-router",
    "in_stock": false
  },
  {
    "name": "Cloud Key Gen2 Plus",
    "url": "https://store.ui.com/collections/unifi-network-unifi-os-consoles/products/unifi-cloudkey-plus",
    "in_stock": true
  }
]

use jq for choosing only in stock:

$ ./is-ui-available -config=config.yaml | jq '[.[] | select(.in_stock)]' 
[
  {
    "name": "Cloud Key Gen2 Plus",
    "url": "https://store.ui.com/collections/unifi-network-unifi-os-consoles/products/unifi-cloudkey-plus",
    "in_stock": true
  }
]

About

check ubiquiti product in stock


Languages

Language:Go 100.0%