diff options
author | bnewbold <bnewbold@robocracy.org> | 2012-05-15 15:47:17 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2012-05-15 15:47:17 -0400 |
commit | e8b87ff1746d7aaa7cd5915e34b3a016b285750f (patch) | |
tree | 2f9a6fd0720b0e003e647d9d57fdd3e5fb4b0a4e | |
parent | 1a8a469233e95c9474d911c352cc86d5b9e8e709 (diff) | |
download | bommom-e8b87ff1746d7aaa7cd5915e34b3a016b285750f.tar.gz bommom-e8b87ff1746d7aaa7cd5915e34b3a016b285750f.zip |
wip: b1gfoot notes, octopart startwip
-rw-r--r-- | b1gfoot | 29 | ||||
-rw-r--r-- | octopart.go | 48 |
2 files changed, 77 insertions, 0 deletions
@@ -0,0 +1,29 @@ + _ _ __ _ +| |__ / | __ _ / _| ___ ___ | |_ +| '_ \| |/ _` | |_ / _ \ / _ \| __| +| |_) | | (_| | _| (_) | (_) | |_ +|_.__/|_|\__, |_| \___/ \___/ \__| + |___/ + +electronics CAD symbol+footprint management tools and repository server. + +vaporware/proposal, no actual code + +### Basic Features + +- imports/exports Eagle XML, KiCad, and gEDA formats +- search/query interface +- basic component categorization ontology +- "smart" pattern matching and mapping to standard symbols/footprints +- complete JEDEC library +- render to PNG and SVG +- HTTP JSON and XML API for easy application interfacing + +### Extra Features + +- wiki-like interface for communal editing of info +- other (ISO?) sybol/footprint/package ontologies +- import/export Orcad, Altium, etc +- render to PDF +- scrape symbols and pinouts datasheet pdfs (at least some manufacturers?) +- synchronization between repositories (local/remote) diff --git a/octopart.go b/octopart.go new file mode 100644 index 0000000..a1f14df --- /dev/null +++ b/octopart.go @@ -0,0 +1,48 @@ +package main + +import ( + "net/http" +) + +/* +Routines to make (cached) API calls to Octopart and merge results into BOM +LineItems. +*/ + +var pricingSource *OctopartClient + +type OctopartClient struct { + ApiKey string + RemoteHost string + client *http.Client +} + +func NewOctopartClient(apikey string) *OctopartClient { + oc := &OctopartClient{ApiKey: apikey, + RemoteHost: "https://www.octopart.com"} + oc.client = &http.Client{} + return oc +} + +func openPricingSource() { + pricingSource = NewOctopartClient("") +} + +func (*oc OctopartClient) apiCall(method string, params map[string]string) (map[string]interface, error) { + paramString := "?apikey=" + oc.ApiKey + for key := range params { + paramString += "&" + key + "=" + params[key] + } + resp, err := oc.client.Get(oc.RemoteHost + "/api/v2/" + method) + + // resp as json, or interpret as error + return +} + +func (*oc OctopartClient) GetMarketInfo(mpn, manufacturer string) (map[string]interface, error) { + +} + +func (*oc OctopartClient) GetPricing(method string, params map[string]string) (map[string]interface, error) { + +} |