{"id":13719574,"url":"https://github.com/bombsimon/swedish-zipcode","last_synced_at":"2025-03-21T00:41:41.799Z","repository":{"id":103304162,"uuid":"166002458","full_name":"bombsimon/swedish-zipcode","owner":"bombsimon","description":"📬 Validation package in Go for Swedish zip codes","archived":false,"fork":false,"pushed_at":"2019-11-20T15:05:19.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T01:45:17.564Z","etag":null,"topics":["postal-codes","swedish","zip","zip-code","zip-codes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bombsimon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-16T08:23:31.000Z","updated_at":"2020-03-18T00:04:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"706fac33-8e4e-4579-b3dc-280f9ad0927f","html_url":"https://github.com/bombsimon/swedish-zipcode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bombsimon%2Fswedish-zipcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bombsimon%2Fswedish-zipcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bombsimon%2Fswedish-zipcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bombsimon%2Fswedish-zipcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bombsimon","download_url":"https://codeload.github.com/bombsimon/swedish-zipcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717362,"owners_count":20498283,"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":["postal-codes","swedish","zip","zip-code","zip-codes"],"created_at":"2024-08-03T01:00:51.893Z","updated_at":"2025-03-21T00:41:41.780Z","avatar_url":"https://github.com/bombsimon.png","language":"Go","readme":"# Swedish Zipcode\n\nThis package provides validation for Swedish zip codes (or postal codes) based\non the provided [CSV](sweden-zipcode.csv). The CSV was generated at 2019-01-19\nby traversing the Bring API described below between `10000` and `99999`.\n\n## HTTPS fallback\n\nSince there're constantly changes in zip codes in Sweden a lot of them are\nmissing in the CSV submodule. This package supports the possibiity to fallback\nto an [HTTPS API from Bring](https://developer.bring.com/api/postal-code/).\n\nIf you call `Store()` on the `ZipCodes` type you can store all newly found zip\ncodes in the existing CSV file for faster and offline execution in the future.\n\n## Multiple results\n\nA few zip codes are listed as multiple matches which means they're shared\nbetween multiple locations. Instead of choosing one of them none is chosen so\nto see which these are you can use `grep  ',$' sweden-zipcode.csv`.\n\n**Example**\n```\nset ex (grep  ',$' sweden-zipcode.csv | string sub --length 5 | head -1); \\\n    curl -sL \\\n    \"https://api.bring.com/shippingguide/api/postalCode.json?clientUrl=ex\u0026country=SE\u0026pnr=$ex\" \\\n    | jq .multipleMatches\n\n[\n  \"Södertälje\",\n  \"Enhörna\"\n]\n```\n\n## Examples\n\n```go\n// One time validation\nsz.Valid(\"12010\") // true\nsz.Valid(12010)   // true\n\n// Multiple validations - create a cache\nhttpFallback := true\nzc := sz.NewZipCodes(httpFallback)\nzc.ClientURL(\"https://my.url.se\")\n\nzc.Valid(\"12010\") // true\nzc.Valid(12010)   // true\nzc.Valid(99999)   // false\n\nzc.Store()        // Updates the CSV file with new zip codes.\n```\n","funding_links":[],"categories":["Misc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbombsimon%2Fswedish-zipcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbombsimon%2Fswedish-zipcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbombsimon%2Fswedish-zipcode/lists"}