Skip to content

Commit

Permalink
Small update to v3 endpoint (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
etoledom authored Sep 26, 2024
1 parent 4f0ad2b commit 27632aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/Gravatar/Network/Services/ProfileService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct ProfileService: ProfileFetching, Sendable {

package func fetchAvatars(with token: String, id: ProfileIdentifier) async throws -> [Avatar] {
do {
guard let url = avatarsBaseURLComponents.settingQueryItems([.init(name: "selected_email", value: id.id)]).url else {
guard let url = avatarsBaseURLComponents.settingQueryItems([.init(name: "selected_email_hash", value: id.id)]).url else {
throw APIError.requestError(reason: .urlInitializationFailed)
}
let request = URLRequest(url: url).settingAuthorizationHeaderField(with: token)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Gravatar/OpenApi/Generated/ModelError.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation

/// An error response from the API.
///
public struct ModelError: Codable, Hashable, Sendable {
/// The error message
public private(set) var error: String
Expand Down
11 changes: 6 additions & 5 deletions openapi/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ components:
image_url:
type: string
description: Image URL
format: uri
examples:
- >-
https://gravatar.com/userimage/252014526/d38bele5a98a2bbc40df69172a2a8348.jpeg
Expand Down Expand Up @@ -450,6 +451,7 @@ components:
- '2021-10-01T12:00:00Z'
Error:
type: object
description: An error response from the API.
properties:
error:
type: string
Expand Down Expand Up @@ -571,12 +573,12 @@ paths:
security:
- oauth: []
parameters:
- name: selected_email
- name: selected_email_hash
in: query
description: >-
The email address used to determine which avatar is selected. The
'selected' attribute in the avatar list will be set to 'true' for
the avatar associated with this email.
The sha256 hash of the email address used to determine which avatar
is selected. The 'selected' attribute in the avatar list will be set
to 'true' for the avatar associated with this email.
schema:
type: string
default: null
Expand Down Expand Up @@ -667,4 +669,3 @@ paths:
responses:
'204':
description: Avatar successfully set

0 comments on commit 27632aa

Please sign in to comment.