-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Macro-Deck-App/feature/github-file-provider
Replace local data storage with GitHub
- Loading branch information
Showing
53 changed files
with
705 additions
and
1,211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,63 @@ | ||
# MacroDeck.UpdateService API v2 | ||
# Macro Deck Update Service API V2 Version Controller Documentation | ||
|
||
This API provides endpoints to check for software updates, fetch version details, and download specific versions for different platforms. | ||
The `ApiV2VersionController` in the Macro Deck Update Service provides methods for managing and interacting with Macro Deck versions. This controller is part of the API V2 and includes methods for checking for updates, retrieving the latest version, getting information about a specific version, and getting the file size of a specific version for a specific platform. | ||
|
||
## **Endpoint: Check for Updates** | ||
## Endpoints | ||
|
||
`GET /v2/check/{installedVersion}/{platform}` | ||
### GET /v2versions/check/{installedVersion}/{platform} | ||
|
||
Checks if there is a newer version available than the installed one. | ||
This endpoint checks for newer versions of Macro Deck based on the currently installed version and the platform. | ||
|
||
### Parameters | ||
- **Parameters**: | ||
- `apiVersion`: The API version. | ||
- `installedVersion`: A string representation of the installed version. | ||
- `platform`: A `PlatformIdentifier` enum representing the Macro Deck's platform. | ||
- `previewVersions` (optional, query): A boolean indicating whether to include preview versions in the check. | ||
- **Returns**: An object representing the `ApiV2CheckResult`. | ||
|
||
- `installedVersion`: The current installed version of the software. | ||
- `platform`: The platform identifier where the software is running (See PlatformIdentifier enum values). | ||
### GET /v2/versions/latest/{platform} | ||
|
||
### Query Parameters | ||
This endpoint returns the latest version of Macro Deck for a specific platform. | ||
|
||
- `previewVersions`: Boolean value that indicates if preview versions should be considered. Defaults to `false`. | ||
- **Parameters**: | ||
- `apiVersion`: The API version. | ||
- `platform`: A `PlatformIdentifier` enum representing the Macro Deck's platform. | ||
- `previewVersions` (optional, query): A boolean indicating whether to include preview versions in the response. | ||
- **Returns**: An object representing the `ApiV2VersionInfo`. | ||
|
||
### Responses | ||
### GET /v2/versions/{version} | ||
|
||
Returns an `ApiV2CheckResult` object with properties: | ||
This endpoint returns information about a specific version of Macro Deck. | ||
|
||
- `NewerVersionAvailable`: Boolean indicating if a newer version is available. | ||
- `Version`: String representing the newer version, if available. | ||
- **Parameters**: | ||
- `apiVersion`: The API version. | ||
- `version`: A string representation of the version. | ||
- **Returns**: An object representing the `ApiV2VersionInfo`. | ||
|
||
--- | ||
### GET /v2/versions/{version}/fileSize/{platform} | ||
|
||
## **Endpoint: Get Latest Version** | ||
This endpoint returns the file size of a specific version of Macro Deck for a specific platform. | ||
|
||
`GET /v2/latest/{platform}` | ||
- **Parameters**: | ||
- `apiVersion`: The API version. | ||
- `version`: A string representation of the version. | ||
- `platform`: A `PlatformIdentifier` enum representing the Macro Deck's platform. | ||
- **Returns**: The file size as a double. | ||
|
||
Fetches the latest software version details for the specified platform. | ||
## Data Types | ||
|
||
### Parameters | ||
### `ApiV2VersionInfo` | ||
|
||
- `platform`: The platform identifier (See PlatformIdentifier enum values). | ||
The `ApiV2VersionInfo` class provides information about a Macro Deck version. This includes the version number and a dictionary of platform identifiers each mapped to their respective download link. | ||
|
||
### Query Parameters | ||
- **Properties**: | ||
- `Version`: A string representation of the Macro Deck version. | ||
- `Platforms`: A dictionary mapping `PlatformIdentifier` enum values to their respective download links for the specified version. | ||
|
||
- `previewVersions`: Boolean value that indicates if preview versions should be considered. Defaults to `false`. | ||
### `ApiV2CheckResult` | ||
|
||
### Responses | ||
The `ApiV2CheckResult` class provides the result of a version check for Macro Deck. It includes a boolean indicating if a newer version is available and an `ApiV2VersionInfo` object providing details about the available version, if applicable. | ||
|
||
Returns an `ApiV2VersionInfo` object with properties: | ||
|
||
- `Version`: String representing the version number. | ||
- `VersionState`: State of the version. | ||
- `Downloads`: Long representing the download count. | ||
- `SupportedPlatforms`: Array of supported platforms. | ||
|
||
--- | ||
|
||
## **Endpoint: Get Version** | ||
|
||
`GET /v2/{version}` | ||
|
||
Fetches the specific software version details. | ||
|
||
### Parameters | ||
|
||
- `version`: The version of the software to retrieve details for. | ||
|
||
### Responses | ||
|
||
Returns an `ApiV2VersionInfo` object similar to the Get Latest Version endpoint. | ||
|
||
--- | ||
|
||
## **Endpoint: Download Latest Version** | ||
|
||
`GET /v2/latest/download/{platform}` | ||
|
||
Downloads the latest version for the specified platform. | ||
|
||
### Parameters | ||
|
||
- `platform`: The platform identifier for the download. | ||
|
||
### Query Parameters | ||
|
||
- `downloadReason`: Indicates the reason for download (See DownloadReason enum values). Defaults to `FirstDownload`. | ||
- `previewVersions`: Boolean value that indicates if preview versions should be considered. Defaults to `false`. | ||
|
||
### Responses | ||
|
||
Returns a byte array representing the file contents of the version. A header "x-file-hash" with the file's hash is also set in the response. | ||
|
||
--- | ||
|
||
## **Endpoint: Download Version** | ||
|
||
`GET /v2/{version}/download/{platform}` | ||
|
||
Downloads the specific version for the specified platform. | ||
|
||
### Parameters | ||
|
||
- `version`: The version of the software to download. | ||
- `platform`: The platform identifier for the download. | ||
|
||
### Query Parameters | ||
|
||
- `downloadReason`: Indicates the reason for download (See DownloadReason enum values). Defaults to `FirstDownload`. | ||
|
||
### Responses | ||
|
||
Returns a byte array representing the file contents of the version. A header "x-file-hash" with the file's hash is also set in the response. | ||
|
||
--- | ||
|
||
## Enums | ||
|
||
### **PlatformIdentifier** | ||
|
||
- `WinX64`: Windows 64-bit | ||
- `MacX64`: Mac OS 64-bit | ||
- `MacArm64`: Mac OS Arm 64-bit | ||
- `LinuxX64`: Linux 64-bit | ||
- `LinuxArm64`: Linux Arm 64-bit | ||
- `LinuxArm32`: Linux Arm 32-bit | ||
|
||
### **DownloadReason** | ||
|
||
- `FirstDownload`: The version is being downloaded for the first time. | ||
- `UpdateDownload`: The version is being downloaded as an update to a previous version. | ||
- **Properties**: | ||
- `NewerVersionAvailable`: A boolean indicating whether a newer version of Macro Deck is available. | ||
- `Version`: An instance of `ApiV2VersionInfo` providing information about the newer version if one is available; null otherwise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/MacroDeck.UpdateService.Core/Constants/FileProviderBaseUrls.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace MacroDeck.UpdateService.Core.Constants; | ||
|
||
public static class FileProviderBaseUrls | ||
{ | ||
public const string GitHubFileBaseUrl = "https://github.com/macro-deck-app/macro-deck/releases/download"; | ||
} |
30 changes: 0 additions & 30 deletions
30
src/MacroDeck.UpdateService.Core/DataAccess/Entities/Config/FileDownloadEntityConfig.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/MacroDeck.UpdateService.Core/DataAccess/Entities/FileDownloadEntity.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/MacroDeck.UpdateService.Core/DataAccess/Repositories/FileDownloadRepository.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.