-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Documentation for Ratings API Endpoints (#366)
* Add Ratings API documentation * Use Signal as example App
- Loading branch information
1 parent
0288e74
commit 332b0d9
Showing
11 changed files
with
218 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule PlexusWeb.API.V1.Schemas.AppScore do | ||
alias OpenApiSpex.Schema | ||
require OpenApiSpex | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "Score", | ||
description: "The Average Score of an App", | ||
type: :object, | ||
properties: %{ | ||
rating_type: %Schema{type: :string, description: "Rating Type", enum: ["micro_g", "native"]}, | ||
numenator: %Schema{type: :number, description: "Numenator"}, | ||
denominator: %Schema{type: :integer, description: "Denominator"}, | ||
total_count: %Schema{type: :string, description: "Total count of ratings"} | ||
}, | ||
example: %{ | ||
"numerator" => 4.0, | ||
"denominator" => 4, | ||
"rating_type" => "micro_g", | ||
"total_count" => 69 | ||
} | ||
}) | ||
end |
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
10 changes: 5 additions & 5 deletions
10
..._web/controllers/api/v1/schemas/scores.ex → ...trollers/api/v1/schemas/average_scores.ex
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule PlexusWeb.API.V1.Schemas.Rating do | ||
alias OpenApiSpex.Schema | ||
alias PlexusWeb.API.V1.Schemas.Score | ||
require OpenApiSpex | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "Rating", | ||
description: "A Representation of User Rating", | ||
type: :object, | ||
properties: %{ | ||
id: %Schema{type: :string, description: "Unique Identifier"}, | ||
android_version: %Schema{type: :string, description: "Android Version"}, | ||
app_package: %Schema{type: :string, description: "App Package"}, | ||
app_version: %Schema{type: :string, description: "App Version"}, | ||
app_build_number: %Schema{type: :integer, description: "App Build Number"}, | ||
rom_name: %Schema{type: :string, description: "ROM Name"}, | ||
rom_build: %Schema{type: :string, description: "ROM Build"}, | ||
installation_source: %Schema{type: :string, description: "Installation Source"}, | ||
score: Score, | ||
notes: %Schema{type: :string, description: "Notes", nullable: true}, | ||
rating_type: %Schema{type: :string, description: "Rating Type", enum: ["micro_g", "native"]} | ||
}, | ||
example: %{ | ||
"id" => "72f5d88e-a467-4729-998f-db1edcfad6bc", | ||
"app_version" => "7.15.4", | ||
"rating_type" => "native", | ||
"app_package" => "org.thoughtcrime.securesms", | ||
"score" => %{"numerator" => 4, "denominator" => 4}, | ||
"android_version" => "14.0", | ||
"app_build_number" => 145_100, | ||
"installation_source" => "google_play_alternative", | ||
"notes" => nil, | ||
"rom_build" => "2024083100", | ||
"rom_name" => "GrapheneOS" | ||
} | ||
}) | ||
end |
30 changes: 30 additions & 0 deletions
30
lib/plexus_web/controllers/api/v1/schemas/rating_response.ex
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,30 @@ | ||
defmodule PlexusWeb.API.V1.Schemas.RatingResponse do | ||
alias PlexusWeb.API.V1.Schemas.Rating | ||
require OpenApiSpex | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "RatingResponse", | ||
description: "Response Schema for a Rating", | ||
type: :object, | ||
properties: %{ | ||
data: Rating | ||
}, | ||
example: %{ | ||
"data" => [ | ||
%{ | ||
"id" => "72f5d88e-a467-4729-998f-db1edcfad6bc", | ||
"app_version" => "7.15.4", | ||
"rating_type" => "native", | ||
"app_package" => "org.thoughtcrime.securesms", | ||
"score" => %{"numerator" => 4, "denominator" => 4}, | ||
"android_version" => "14.0", | ||
"app_build_number" => 145_100, | ||
"installation_source" => "google_play_alternative", | ||
"notes" => nil, | ||
"rom_build" => "2024083100", | ||
"rom_name" => "GrapheneOS" | ||
} | ||
] | ||
} | ||
}) | ||
end |
39 changes: 39 additions & 0 deletions
39
lib/plexus_web/controllers/api/v1/schemas/ratings_response.ex
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,39 @@ | ||
defmodule PlexusWeb.API.V1.Schemas.RatingsResponse do | ||
alias OpenApiSpex.Schema | ||
alias PlexusWeb.API.V1.Schemas.Page | ||
alias PlexusWeb.API.V1.Schemas.Rating | ||
require OpenApiSpex | ||
|
||
OpenApiSpex.schema(%{ | ||
title: "RatingsResponse", | ||
description: "Response Schema for a list of Ratings", | ||
type: :object, | ||
properties: %{ | ||
data: %Schema{type: :array, items: Rating}, | ||
meta: Page | ||
}, | ||
example: %{ | ||
"data" => [ | ||
%{ | ||
"id" => "72f5d88e-a467-4729-998f-db1edcfad6bc", | ||
"app_version" => "7.15.4", | ||
"rating_type" => "native", | ||
"app_package" => "org.thoughtcrime.securesms", | ||
"score" => %{"numerator" => 4, "denominator" => 4}, | ||
"android_version" => "14.0", | ||
"app_build_number" => 145_100, | ||
"installation_source" => "google_play_alternative", | ||
"notes" => "Works great!", | ||
"rom_build" => "2024083100", | ||
"rom_name" => "GrapheneOS" | ||
} | ||
], | ||
"meta" => %{ | ||
"page_number" => 3, | ||
"limit" => 1, | ||
"total_count" => 420, | ||
"total_pages" => 69 | ||
} | ||
} | ||
}) | ||
end |
Oops, something went wrong.