@@ -25,12 +25,12 @@ public struct AuthAdmin: Sendable {
2525 /// - Warning: Never expose your `service_role` key on the client.
2626 public func deleteUser( id: String , shouldSoftDelete: Bool = false ) async throws {
2727 _ = try await api. execute (
28- HTTPRequest (
29- url: configuration. url. appendingPathComponent ( " admin/users/ \( id) " ) ,
28+ for: HTTPRequest (
3029 method: . delete,
31- body: encoder. encode (
32- DeleteUserRequest ( shouldSoftDelete: shouldSoftDelete)
33- )
30+ url: configuration. url. appendingPathComponent ( " admin/users/ \( id) " )
31+ ) ,
32+ from: encoder. encode (
33+ DeleteUserRequest ( shouldSoftDelete: shouldSoftDelete)
3434 )
3535 )
3636 }
@@ -46,27 +46,29 @@ public struct AuthAdmin: Sendable {
4646 let aud : String
4747 }
4848
49- let httpResponse = try await api. execute (
50- HTTPRequest (
51- url: configuration. url. appendingPathComponent ( " admin/users " ) ,
49+ let ( data, response) = try await api. execute (
50+ for: HTTPRequest (
5251 method: . get,
53- query: [
54- URLQueryItem ( name: " page " , value: params? . page? . description ?? " " ) ,
55- URLQueryItem ( name: " per_page " , value: params? . perPage? . description ?? " " ) ,
56- ]
57- )
52+ url: configuration. url
53+ . appendingPathComponent ( " admin/users " )
54+ . appendingQueryItems ( [
55+ URLQueryItem ( name: " page " , value: params? . page? . description ?? " " ) ,
56+ URLQueryItem ( name: " per_page " , value: params? . perPage? . description ?? " " ) ,
57+ ] )
58+ ) ,
59+ from: nil
5860 )
5961
60- let response = try httpResponse . decoded ( as : Response . self, decoder : configuration . decoder )
62+ let responseData = try configuration . decoder . decode ( Response . self, from : data )
6163
6264 var pagination = ListUsersPaginatedResponse (
63- users: response . users,
64- aud: response . aud,
65+ users: responseData . users,
66+ aud: responseData . aud,
6567 lastPage: 0 ,
66- total: httpResponse . headers [ . xTotalCount] . flatMap ( Int . init) ?? 0
68+ total: response . headerFields [ . xTotalCount] . flatMap ( Int . init) ?? 0
6769 )
6870
69- let links = httpResponse . headers [ . link] ? . components ( separatedBy: " , " ) ?? [ ]
71+ let links = response . headerFields [ . link] ? . components ( separatedBy: " , " ) ?? [ ]
7072 if !links. isEmpty {
7173 for link in links {
7274 let page = link. components ( separatedBy: " ; " ) [ 0 ] . components ( separatedBy: " = " ) [ 1 ] . prefix ( while: \. isNumber)
0 commit comments