{"id":15389284,"url":"https://github.com/tpluscode/uritemplatestring","last_synced_at":"2025-07-02T07:07:15.627Z","repository":{"id":82631337,"uuid":"76295075","full_name":"tpluscode/UriTemplateString","owner":"tpluscode","description":"Some C# structure for URI Templates","archived":false,"fork":false,"pushed_at":"2018-12-08T10:18:28.000Z","size":113,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T15:51:17.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","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/tpluscode.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-12T21:00:06.000Z","updated_at":"2019-05-05T05:46:35.000Z","dependencies_parsed_at":"2023-03-12T16:19:15.173Z","dependency_job_id":null,"html_url":"https://github.com/tpluscode/UriTemplateString","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tpluscode/UriTemplateString","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2FUriTemplateString","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2FUriTemplateString/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2FUriTemplateString/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2FUriTemplateString/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpluscode","download_url":"https://codeload.github.com/tpluscode/UriTemplateString/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpluscode%2FUriTemplateString/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263091027,"owners_count":23412344,"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":[],"created_at":"2024-10-01T14:59:55.829Z","updated_at":"2025-07-02T07:07:15.599Z","avatar_url":"https://github.com/tpluscode.png","language":"C#","readme":"![trail icon](https://raw.githubusercontent.com/tpluscode/UriTemplateString/master/assets/noun_690990.png)\n\n# UriTemplateString [![Build status][av-badge]][build] [![NuGet version][nuget-badge]][nuget-link] [![codecov.io][cov-badge]][cov-link] [![codefactor][codefactor-badge]][codefactor-link]\n\nParses [URI Templates](https://tools.ietf.org/html/rfc6570) into a friendly object structure. \n\n## Installation\n\nGet from nuget.org\n\n```\ninstall-package UriTemplateString\n```\n\n## Usage\n\nSimply cast a string to `UriTemplateString`.\n\n``` c#\nvar template = (UriTemplateString)\"/base/users{/page:2}{?name}\";\n```\n\nNow you can inspect the structure of the template\n\n\n``` c#\ntemplate.Parts.Length == 3;\n\n// access literal parts\nvar literal = template.Parts[0] as Literal;\nliteral.ToString() == \"/base/users\";\n\n// access parts with modifier\nvar pageSeg = template[1] as Expression;\n(pageSeg.Modifier as MaxLength).MaxLength == 2;\n\n// access variables and operator\nvar query = template.Parts[2] as Expression;\nquery.Operator.Equals(Operator.QueryComponent);\nquery.Variables[0].Name == \"name\";\n```\n\nAnd do simple operations\n\n``` c#\n// concatenate templates (and raw strings)\ntemplate += \"{\u0026rest*}\";\n// produces /base/users{/page:2}{?name}{\u0026rest*}\n\n// append query\ntemplate.AppendQueryParam(\"rest\", explode: true);\n// produces /base/users{/page:2}{?name,rest*}\n```\n\n## Gotchas\n\nParsing is implemented using regular expressions so performance can be suboptimal.\n\nAlso, currently the expressions are an approximation of the real spec. Quirks possible ahead.\n\n[The stencil print icon](https://thenounproject.com/term/stencil-print/690990) by [Dairy Free Design](https://thenounproject.com/emmaihall/) from [The Noun Project](http://thenounproject.com/)\n\n[av-badge]: https://ci.appveyor.com/api/projects/status/je1g2h91wy7nas8q/branch/master?svg=true\n[build]: https://ci.appveyor.com/project/tpluscode78631/uritemplatestring/branch/master\n[nuget-badge]: https://badge.fury.io/nu/UriTemplateString.svg\n[nuget-link]: https://badge.fury.io/nu/UriTemplateString\n[cov-badge]: https://codecov.io/github/tpluscode/UriTemplateString/coverage.svg?branch=master\n[cov-link]: https://codecov.io/github/tpluscode/UriTemplateString?branch=master\n[codefactor-badge]: https://www.codefactor.io/repository/github/tpluscode/UriTemplateString/badge/master\n[codefactor-link]: https://www.codefactor.io/repository/github/tpluscode/UriTemplateString/overview/master\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpluscode%2Furitemplatestring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpluscode%2Furitemplatestring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpluscode%2Furitemplatestring/lists"}