{"id":23629812,"url":"https://github.com/neo-vortex/versioningapi","last_synced_at":"2025-11-08T03:30:34.376Z","repository":{"id":269353937,"uuid":"907148448","full_name":"Neo-vortex/VersioningApi","owner":"Neo-vortex","description":"A simple API server aims to pull versioning out of source codes and make them centralized ","archived":false,"fork":false,"pushed_at":"2024-12-23T00:15:47.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-23T00:38:41.103Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neo-vortex.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":"2024-12-22T23:56:57.000Z","updated_at":"2024-12-23T00:15:50.000Z","dependencies_parsed_at":"2024-12-23T00:49:22.144Z","dependency_job_id":null,"html_url":"https://github.com/Neo-vortex/VersioningApi","commit_stats":null,"previous_names":["neo-vortex/versioningapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-vortex%2FVersioningApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-vortex%2FVersioningApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-vortex%2FVersioningApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-vortex%2FVersioningApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neo-vortex","download_url":"https://codeload.github.com/Neo-vortex/VersioningApi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239547424,"owners_count":19657149,"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-12-28T01:18:20.723Z","updated_at":"2025-02-18T20:41:12.390Z","avatar_url":"https://github.com/Neo-vortex.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n#Documentation\n\nThis document outlines the details, usage, and scenarios of the API. It provides sample requests and responses, step-by-step guides, and detailed explanations of how to use the API effectively.\n\n---\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [Prerequisites](#prerequisites)\n3. [Authentication](#authentication)\n4. [API Endpoints](#api-endpoints)\n   - [Projects](#projects)\n   - [Environments](#environments)\n   - [Versions](#versions)\n5. [DTOs (Data Transfer Objects)](#dtos)\n6. [Scenarios](#scenarios)\n   - [Managing a Software with Dev and Staging Environments](#managing-a-software-with-dev-and-staging-environments)\n7. [Step-by-Step Usage Guide](#step-by-step-usage-guide)\n\n---\n\n## Introduction\n\nThe **Version Manager API** allows you to manage projects, environments, and versions in a streamlined way. This API is designed for teams who need structured version control and environment management for their applications.\n\n---\n\n## Prerequisites\n\n1. **Environment Configuration**:\n   - The API uses a `secret` header for authentication. You must set an environment variable `SECRET` with your chosen secret key. If not set, the default value is `\"changeme\"`.\n2. **Framework**:\n   - ASP.NET Core backend.\n3. **Dependencies**:\n   - Install necessary packages for `DapperContext`, `Scalar.AspNetCore`, and services.\n\n---\n\n## Authentication\n\nThe API uses a custom header `secret` for authentication. Requests must include this header to access protected endpoints.\n\n### Example:\n```http\nGET /api/projects HTTP/1.1\nHost: yourdomain.com\nsecret: your-secret-key\n```\n\nIf the header is missing or invalid, the API will respond with:\n```json\n{\n  \"status\": 403,\n  \"message\": \"Forbidden: Invalid or missing 'secret' header.\"\n}\n```\n\nSet the environment variable in your application using:\n```bash\nexport SECRET=your-secret-key\n```\n\n---\n\n## API Endpoints\n\n### Projects\n\n#### Create a Project\n**Endpoint**: `POST /api/projects`  \n**Request Body**:\n```json\n{\n  \"name\": \"MySoftware\",\n  \"environments\": [\"dev\", \"staging\"]\n}\n```\n**Response**:\n```json\n{\n  \"projectId\": 1,\n  \"projectName\": \"MySoftware\"\n}\n```\n\n#### Get All Projects\n**Endpoint**: `GET /api/projects`  \n**Response**:\n```json\n[\n  {\n    \"projectId\": 1,\n    \"projectName\": \"MySoftware\"\n  }\n]\n```\n\n#### Delete a Project\n**Endpoint**: `DELETE /api/projects/{id}`  \n**Response**: `204 No Content`\n\n---\n\n### Environments\n\n#### Create an Environment\n**Endpoint**: `POST /api/projects/{projectId}/environments`  \n**Request Body**:\n```json\n{\n  \"name\": \"dev\"\n}\n```\n**Response**:\n```json\n{\n  \"environmentId\": 1,\n  \"name\": \"dev\"\n}\n```\n\n#### Get Environments for a Project\n**Endpoint**: `GET /api/projects/{projectId}/environments`  \n**Response**:\n```json\n[\n  {\n    \"environmentId\": 1,\n    \"name\": \"dev\"\n  },\n  {\n    \"environmentId\": 2,\n    \"name\": \"staging\"\n  }\n]\n```\n\n---\n\n### Versions\n\n#### Get Current Version\n**Endpoint**: `GET /api/projects/{projectId}/{environment}/version`  \n**Response**:\n```json\n{\n  \"projectId\": 1,\n  \"environment\": \"dev\",\n  \"version\": \"1.0.0\"\n}\n```\n\n#### Set Version\n**Endpoint**: `PUT /api/projects/{projectId}/{environment}/version`  \n**Request Body**:\n```json\n{\n  \"major\": 1,\n  \"minor\": 1,\n  \"patch\": 0\n}\n```\n**Response**:\n```json\n{\n  \"message\": \"Version updated successfully.\"\n}\n```\n\n---\n\n## DTOs (Data Transfer Objects)\n\n### CreateEnvironmentRequest\n```json\n{\n  \"name\": \"string\"\n}\n```\n\n### CreateProjectRequest\n```json\n{\n  \"name\": \"string\",\n  \"environments\": [\"string\"]\n}\n```\n\n### SetVersionRequest\n```json\n{\n  \"major\": \"int\",\n  \"minor\": \"int\",\n  \"patch\": \"int\"\n}\n```\n\n---\n\n## Scenarios\n\n### Managing a Software with Dev and Staging Environments\n\n#### Scenario:\nYou have a software project with two environments: `dev` and `staging`. You want to use the API to manage these environments and automate version updates during CI/CD.\n\n**Steps**:\n1. **Create the Project**:\n   ```http\n   POST /api/projects\n   ```\n   **Request Body**:\n   ```json\n   {\n     \"name\": \"MySoftware\",\n     \"environments\": [\"dev\", \"staging\"]\n   }\n   ```\n\n2. **Get the Project's Environments**:\n   ```http\n   GET /api/projects/1/environments\n   ```\n\n3. **Set the Version for `dev` Environment**:\n   ```http\n   PUT /api/projects/1/dev/version\n   ```\n   **Request Body**:\n   ```json\n   {\n     \"major\": 1,\n     \"minor\": 0,\n     \"patch\": 0\n   }\n   ```\n\n4. **Increment Version for `staging` During Deployment**:\n   ```http\n   POST /api/projects/1/staging/version/increment\n   ```\n   **Request Body**:\n   ```json\n   {\n     \"part\": \"minor\"\n   }\n   ```\n\n5. **Get the Updated Version for `staging`**:\n   ```http\n   GET /api/projects/1/staging/version\n   ```\n\n---\n\n## Step-by-Step Usage Guide\n\n1. Configure your `SECRET` key in the environment:\n   ```bash\n   export SECRET=your-secret-key\n   ```\n\n2. Create a new project with environments.\n\n3. Use the API to manage versions across environments during CI/CD.\n\n---\n\n## Contact\n\nFor any issues or questions, feel free to open an issue on the GitHub repository.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-vortex%2Fversioningapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo-vortex%2Fversioningapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-vortex%2Fversioningapi/lists"}