{"id":37031542,"url":"https://github.com/contentstack/contentstack-model-generator","last_synced_at":"2026-01-14T03:52:41.197Z","repository":{"id":43178074,"uuid":"197517861","full_name":"contentstack/contentstack-model-generator","owner":"contentstack","description":"Generates a model of Contentstack's content types for .Net","archived":false,"fork":false,"pushed_at":"2026-01-12T12:35:04.000Z","size":1436,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-01-12T18:01:06.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/contentstack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-18T05:31:43.000Z","updated_at":"2026-01-12T08:14:29.000Z","dependencies_parsed_at":"2024-02-05T10:40:04.157Z","dependency_job_id":"8309b0ed-3d75-4536-a4ab-98409710dbd1","html_url":"https://github.com/contentstack/contentstack-model-generator","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/contentstack/contentstack-model-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fcontentstack-model-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fcontentstack-model-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fcontentstack-model-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fcontentstack-model-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentstack","download_url":"https://codeload.github.com/contentstack/contentstack-model-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fcontentstack-model-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":[],"created_at":"2026-01-14T03:52:40.619Z","updated_at":"2026-01-14T03:52:41.189Z","avatar_url":"https://github.com/contentstack.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/)\n\n# Contentstack model generator\nThis utility is use to generate models based on ContentTypes in Stack.\n\n## Installation\nTo install Contenstack model generator run following command:\n```\ndotnet tool install  -g contentstack.model.generator\n```\n\n## How to use\nOnce you install ```contentstack.model.generator```  run ```--help``` to view available commands.\n\n### Authentication Methods\n\nThe Contentstack Model Generator supports two authentication methods:\n\n1. **Traditional Authtoken Authentication** (default)\n2. **OAuth 2.0 Authentication**\n\n### Command Line Options\n\n| Short key | Long Key | Description |\n| -- | -- | -- |\n| `-a` | `--api-key` | The Stack API key for the Content Management API |\n| `-A` | `--authtoken` | The Authtoken for the Content Management API (required for traditional auth) |\n| `-b` | `--branch` | The branch header in the API request to fetch or manage modules located within specific branches. |\n| `-e` | `--endpoint` | The Contentstack Host for the Content Management API |\n| `-n` | `--namespace` | The namespace the classes should be created in |\n| `-N` | `--is-nullable` | The features that protect against throwing a System.NullReferenceException can be disruptive when turned on. |\n| `-f` | `--force` | Automatically overwrite files that already exist |\n| `-m` | `--modular-block-prefix` | The Modular block Class Prefix. |\n| `-g` | `--group-prefix` | The Group Class Prefix. |\n| `-p` | `--path` | Path to the file or directory to create files in. |\n\n### OAuth 2.0 Options\n\n| Long Key | Description |\n| -- | -- |\n| `--oauth` | Enable OAuth 2.0 authentication (mutually exclusive with traditional auth) |\n| `--client-id` | OAuth Client ID (required for OAuth) (Default Value: Ie0FEfTzlfAHL4xM ) |\n| `--client-secret` | OAuth Client Secret (optional for public clients using PKCE) |\n| `--redirect-uri` | OAuth Redirect URI (required for OAuth) (Default Value: http://localhost:8184 ) |\n| `--app-id` | OAuth App ID (optional) ( Default Value: 6400aa06db64de001a31c8a9 ) |\n| `--scopes` | OAuth Scopes (optional, space-separated) |\n\n## Examples\n\n### Traditional API Key Authentication\n\n#### Example 1: Basic Usage\nTo create classes in current directory run following command:\n```\ncontentstack.model.generator -a \u003cstack_api_key\u003e -A \u003cauthtoken\u003e\n```\n\n#### Example 2: Specific Path\nTo create classes in specific path run following command:\n```\ncontentstack.model.generator -a \u003cstack_api_key\u003e -A \u003cauthtoken\u003e -p /User/xxx/Desktop\n```\n\n#### Example 3: With Namespace\nTo create classes with namespace run following command:\n```\ncontentstack.model.generator -a \u003cstack_api_key\u003e -A \u003cauthtoken\u003e -n YourProject.Models\n```\n\n#### Example 4: With Nullable Annotations\nTo allow `Nullable` annotation context in model creation run following command:\n```\ncontentstack.model.generator -a \u003cstack_api_key\u003e -A \u003cauthtoken\u003e -N\n```\n\n### OAuth 2.0 Authentication\n\n#### Example 5: OAuth with PKCE (Recommended)\nFor public clients or enhanced security, use OAuth with PKCE:\n```\ncontentstack.model.generator --oauth -a \u003cstack_api_key\u003e --client-id \u003cclient_id\u003e --redirect-uri http://localhost:8184\n```\n\n#### Example 6: OAuth with Client Secret\nFor confidential clients with client secret:\n```\ncontentstack.model.generator --oauth -a \u003cstack_api_key\u003e --client-id \u003cclient_id\u003e --client-secret \u003cclient_secret\u003e --redirect-uri http://localhost:8184\n```\n\n#### Example 7: OAuth with App ID\nFor OAuth with specific app:\n```\ncontentstack.model.generator --oauth -a \u003cstack_api_key\u003e --client-id \u003cclient_id\u003e --redirect-uri http://localhost:8184 --app-id \u003capp_id\u003e\n```\n\n#### Example 8: OAuth with Custom Path and Namespace\n```\ncontentstack.model.generator --oauth -a \u003cstack_api_key\u003e --client-id \u003cclient_id\u003e --redirect-uri http://localhost:8184 -p /path/to/models -n YourProject.Models\n```\n\n## OAuth Command Example\n\nHere's what you'll see when running an OAuth command:\n\n```bash\n\n$ contentstack.model.generator --oauth -a \u003capi_key\u003e --client-id myclient123 --redirect-uri http://localhost:8184\n\nContentstack Model Generator v0.5.0\n=====================================\n\nOAuth Authentication Required\n=============================\n\nPlease open the following URL in your browser to authorize the application:\n\nhttps://app.contentstack.com/#!/apps/6400aa06db64de001a31c8a9/authorize?response_type=code\u0026client_id=myclient123\u0026redirect_uri=http%3A%2F%2Flocalhost%3A8184\u0026code_challenge=...\n\nAfter authorization, you will be redirected to a local URL.\nPlease copy the 'code' parameter from the redirect URL and paste it here:\n\nAuthorization code: [User pastes the code here]\n\nExchanging authorization code for access token...\nOAuth authentication successful!\nAccess token expires at: 2024-01-15 14:30:00 UTC\n\nFetching stack information...\nStack: My Contentstack Stack\nAPI Key: api_key\n\nFetching content types...\nFound 5 content types:\nGenerating files from content type\n\nFiles successfully created!\nOpening \u003cfile_path\u003e/Models\n\nLogging out from OAuth...\nOAuth logout successful!\n```\n\n### MIT License\n\nCopyright (c) 2012-2026 Contentstack\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentstack%2Fcontentstack-model-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentstack%2Fcontentstack-model-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentstack%2Fcontentstack-model-generator/lists"}