{"id":18871454,"url":"https://github.com/sfomuseum/go-edtf-http","last_synced_at":"2026-02-15T09:30:18.401Z","repository":{"id":57643427,"uuid":"328040904","full_name":"sfomuseum/go-edtf-http","owner":"sfomuseum","description":"Go package for sfomuseum/go-edtf HTTP handlers.","archived":false,"fork":false,"pushed_at":"2021-10-08T16:43:54.000Z","size":123,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T00:13:56.891Z","etag":null,"topics":["edtf","golang","http"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sfomuseum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-09T00:15:34.000Z","updated_at":"2021-10-08T16:43:02.000Z","dependencies_parsed_at":"2022-08-27T20:02:35.793Z","dependency_job_id":null,"html_url":"https://github.com/sfomuseum/go-edtf-http","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-edtf-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-edtf-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-edtf-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-edtf-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sfomuseum","download_url":"https://codeload.github.com/sfomuseum/go-edtf-http/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239819074,"owners_count":19702277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["edtf","golang","http"],"created_at":"2024-11-08T05:25:59.133Z","updated_at":"2026-02-15T09:30:18.323Z","avatar_url":"https://github.com/sfomuseum.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-edtf-http\n\nGo package for sfomuseum/go-edtf HTTP handlers.\n\n## Example\n\n```\nimport (\n\t\"flag\"\n\t\"github.com/sfomuseum/go-edtf-http/api\"\n\t\"net/http\"\n)\n\nfunc main() {\n\n\tapi_parse_handler, _ := api.ParseHandler()\n\tapi_valid_handler, _ := api.IsValidHandler()\n\tapi_matches_handler, _ := api.MatchesHandler()\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/api/parse\", api_parse_handler)\n\tmux.Handle(\"/api/valid\", api_valid_handler)\n\tmux.Handle(\"/api/matches\", api_matches_handler)\n\n\thttp.ListenAndServe(\"localhost:8080\", mux)\n}\n```\n\n_Error handling omitted for brevity._\n\n### /api/matches\n\n```\n$\u003e curl -s 'http://localhost:8080/api/matches?edtf=1985-01-03/1987'\n{\"level\":0,\"feature\":\"Time Interval\"}\n```\n\n### /api/parse\n\n```\n$\u003e curl -s 'http://localhost:8080/api/parse?edtf=1985-01-03/1987' | jq\n{\n  \"start\": {\n    \"edtf\": \"1985-01-03\",\n    \"lower\": {\n      \"datetime\": \"1985-01-03T00:00:00Z\",\n      \"timestamp\": 473558400,\n      \"ymd\": {\n        \"year\": 1985,\n        \"month\": 1,\n        \"day\": 3\n      },\n      \"precision\": 64\n    },\n    \"upper\": {\n      \"datetime\": \"1985-01-03T23:59:59Z\",\n      \"timestamp\": 473644799,\n      \"ymd\": {\n        \"year\": 1985,\n        \"month\": 1,\n        \"day\": 3\n      },\n      \"precision\": 64\n    }\n  },\n  \"end\": {\n    \"edtf\": \"1987\",\n    \"lower\": {\n      \"datetime\": \"1987-01-01T00:00:00Z\",\n      \"timestamp\": 536457600,\n      \"ymd\": {\n        \"year\": 1987,\n        \"month\": 1,\n        \"day\": 1\n      },\n      \"precision\": 64\n    },\n    \"upper\": {\n      \"datetime\": \"1987-12-31T23:59:59Z\",\n      \"timestamp\": 567993599,\n      \"ymd\": {\n        \"year\": 1987,\n        \"month\": 12,\n        \"day\": 31\n      },\n      \"precision\": 64\n    }\n  },\n  \"edtf\": \"1985-01-03/1987\",\n  \"level\": 0,\n  \"feature\": \"Time Interval\"\n}\n```\n\n### /api/valid\n\n```\n$\u003e curl -s 'http://localhost:8080/api/valid?edtf=Jan,%203%201985'\nfalse\n```\n\n```\n$\u003e curl -s 'http://localhost:8080/api/valid?edtf=1985-01-03'\ntrue\n```\n\n## Handlers\n\n### api.IsValidHandler()\n\nReturn a `http.HandlerFunc` instance that exposes the `sfomuseum/go-edtf parser.IsValid` method over HTTP.\n\nThe handler expects to be passed a \"edtf\" `GET` parameter and returns a JSON-encoded boolean value, on success.\n\n### api.MatchesHandler\n\nReturn a `http.HandlerFunc` instance that exposes the `sfomuseum/go-edtf parser.Matches` method over HTTP.\n\nThe handler expects to be passed a \"edtf\" `GET` parameter and returns a JSON-encoded string value, on success.\n\n### api.ParseHandler\n\nReturn a `http.HandlerFunc` instance that exposes the `sfomuseum/go-edtf parser.ParseString` method over HTTP.\n\nThe handler expects to be passed a \"edtf\" `GET` parameter and returns a JSON-encoded `edtf.EDTFDate` value, on success.\n\n## Tools\n\n### server\n\nHTTP server for exposing sfomuseum/go-edtf-http handlers.\n\n```\n$\u003e ./bin/server -h\nHTTP server for exposing sfomuseum/go-edtf-http handlers.\nUsage:\n\t ./bin/server [options]\n  -enable-matches-api\n    \tEnable the /api/matches endpoint (default true)\n  -enable-parse-api\n    \tEnable the /api/parse endpoint (default true)\n  -enable-valid-api\n    \tEnable the /api/valid endpoint (default true)\n  -server-uri string\n    \tA valid aaronland/go-http-server URI. (default \"http://localhost:8080\")\n```\n\nFor example:\n\n```\n$\u003e ./bin/server\n2021/01/08 17:03:04 Listening on http://localhost:8080\n```\n\n## See also\n\n* https://github.com/sfomuseum/go-edtf\n* https://github.com/aaronland/go-http-server","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfomuseum%2Fgo-edtf-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsfomuseum%2Fgo-edtf-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfomuseum%2Fgo-edtf-http/lists"}