Skip to content

Commit

Permalink
feat: Add date format header for profile request
Browse files Browse the repository at this point in the history
# Conflicts:
#	Sources/InfomaniakCore/Account/User/UserPhone.swift
  • Loading branch information
flowbe authored and PhilippeWeidmann committed Jul 12, 2024
1 parent cb9bf50 commit c8c7c35
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/InfomaniakCore/Networking/ApiFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ open class ApiFetcher {
try await perform(request: authenticatedRequest(.organisationAccounts))
}

public func userProfile(ignoreDefaultAvatar: Bool = false) async throws -> UserProfile {
try await perform(request: authenticatedRequest(.profile(ignoreDefaultAvatar: ignoreDefaultAvatar)))
public func userProfile(ignoreDefaultAvatar: Bool = false, dateFormat: DateFormat = .json) async throws -> UserProfile {
try await perform(request: authenticatedRequest(.profile(ignoreDefaultAvatar: ignoreDefaultAvatar), headers: ["X-Date-Format": dateFormat.rawValue]))
}
}

Expand Down
24 changes: 24 additions & 0 deletions Sources/InfomaniakCore/Networking/DateFormat.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Infomaniak Core - iOS
Copyright (C) 2022 Infomaniak Network SA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import Foundation

public enum DateFormat: String {
case iso8601
case json = "application/json"
}

0 comments on commit c8c7c35

Please sign in to comment.