{"id":17933821,"url":"https://github.com/jacobsvante/google-taxonomy","last_synced_at":"2025-10-11T00:34:39.212Z","repository":{"id":47744637,"uuid":"395643228","full_name":"jacobsvante/google-taxonomy","owner":"jacobsvante","description":"Rust enum with all Google Product Categories / Taxonomy","archived":false,"fork":false,"pushed_at":"2021-08-27T11:42:12.000Z","size":134,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-15T11:33:08.271Z","etag":null,"topics":["google","google-merchant","taxonomy"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/google_taxonomy","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobsvante.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-13T12:16:22.000Z","updated_at":"2023-10-16T13:37:13.000Z","dependencies_parsed_at":"2022-09-08T13:12:18.512Z","dependency_job_id":null,"html_url":"https://github.com/jacobsvante/google-taxonomy","commit_stats":null,"previous_names":["jmagnusson/google-taxonomy"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/jacobsvante/google-taxonomy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobsvante%2Fgoogle-taxonomy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobsvante%2Fgoogle-taxonomy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobsvante%2Fgoogle-taxonomy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobsvante%2Fgoogle-taxonomy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobsvante","download_url":"https://codeload.github.com/jacobsvante/google-taxonomy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobsvante%2Fgoogle-taxonomy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005655,"owners_count":26083943,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["google","google-merchant","taxonomy"],"created_at":"2024-10-28T21:41:53.831Z","updated_at":"2025-10-11T00:34:39.186Z","avatar_url":"https://github.com/jacobsvante.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Taxonomy / Product Categories\n\nThe purpose of this crate is to more easily work with [Google Product Categories / Taxonomy](https://support.google.com/merchants/answer/6324436).\nThis is provided via the `google_taxonomy::ProductCategory` struct which contains all categories that exist as of 2021-08-13.\n\n## Associated constants naming\n\nThe ProductCategory contains each product category as an associated constant. They are translated from the [taxonomy-with-ids.en-US.txt](https://www.google.com/basepages/producttype/taxonomy-with-ids.en-US.txt) file as follows:\n1. The leading ID is removed (and can be obtained using the `id` method).\n2. The immediately following characters ` - ` are removed\n3. All occurrences of `\u0026` are replaced with `And`\n4. Finally, all non-alphanumeric ascii characters are removed\n\nFor example `1604 - Apparel \u0026 Accessories \u003e Clothing` becomes `ProductCategory::ApparelAndAccessoriesClothing`.\n\nEach constant takes up 2 bytes of memory.\n\n## Examples\n\n### Try to parse an integer as a product category (i.e. from its ID)\n\n```rust\nuse std::convert::TryInto;\nuse google_taxonomy::ProductCategory;\n\nlet cat: ProductCategory = 3237.try_into().unwrap();\nassert_eq!(cat, ProductCategory::AnimalsAndPetSuppliesLiveAnimals);\n```\n\n### Get the number representation of the product category\n```rust\nuse google_taxonomy::ProductCategory;\nassert_eq!(ProductCategory::AnimalsAndPetSuppliesLiveAnimals.id(), 3237);\n```\n\n### Get the name of a product category\n```rust\nuse google_taxonomy::ProductCategory;\nassert_eq!(ProductCategory::AnimalsAndPetSuppliesLiveAnimals.to_string(), \"Animals \u0026 Pet Supplies \u003e Live Animals\");\n```\n\n### Serialize / deserialize with Serde\n\n```rust\n#[cfg(feature = \"serde\")]\n{\n    use serde::{Deserialize, Serialize};\n    use google_taxonomy::ProductCategory;\n\n    #[derive(Deserialize, Serialize, Debug, PartialEq)]\n    struct Product {\n        category: ProductCategory,\n    }\n    let serialized = r#\"{\"category\":\"Animals \u0026 Pet Supplies\"}\"#;\n\n    // Deserialize, e.g. with serde_json\n    let deserialized: Product = serde_json::from_str(\u0026serialized).unwrap();\n\n    assert_eq!(deserialized, Product { category: ProductCategory::AnimalsAndPetSupplies });\n\n    // And back to its original serialized form again...\n    assert_eq!(serde_json::to_string(\u0026deserialized).unwrap(), serialized);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobsvante%2Fgoogle-taxonomy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobsvante%2Fgoogle-taxonomy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobsvante%2Fgoogle-taxonomy/lists"}