Skip to content

Commit

Permalink
Remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bourvill committed Feb 8, 2024
1 parent 591af8c commit 0a7c35d
Showing 1 changed file with 0 additions and 62 deletions.
62 changes: 0 additions & 62 deletions WallabagKit/Sources/WallabagKit/WallabagKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,70 +69,8 @@ public class WallabagKit {
try handleStatusCode(from: response, with: data)

return try decoder.decode(T.Object.self, from: data)

// fetch(to: to)
// .decode(type: T.self, decoder: decoder)
// .mapErrorToWallabagKitError()
// .eraseToAnyPublisher()
}

// private func fetch(to: WallabagKitEndpoint) -> AnyPublisher<Data, WallabagKitError> {
// session.dataTaskPublisher(for: request(for: to, withAuth: true))
// .tryMap { data, response in
// guard let response = response as? HTTPURLResponse else { fatalError() }
//
// try self.handleStatusCode(from: response, with: data)
//
// return data
// }
// .tryCatch { error in
// self.requestToken()
// .tryMap { token -> AnyPublisher<Data, WallabagKitError> in
// if token != nil {
// return self.fetch(to: to)
// }
// throw WallabagKitError.invalidToken
// }
// .mapError { error in WallabagKitError.wrap(error: error) }
// .switchToLatest()
// .eraseToAnyPublisher()
// }
// .mapErrorToWallabagKitError()
// .eraseToAnyPublisher()
// }

// public func send<T: Decodable>(to: WallabagKitEndpoint) -> AnyPublisher<T, WallabagKitError> {
// fetch(to: to)
// .decode(type: T.self, decoder: decoder)
// .mapErrorToWallabagKitError()
// .eraseToAnyPublisher()
// }

// private func fetch(to: WallabagKitEndpoint) -> AnyPublisher<Data, WallabagKitError> {
// session.dataTaskPublisher(for: request(for: to, withAuth: true))
// .tryMap { data, response in
// guard let response = response as? HTTPURLResponse else { fatalError() }
//
// try self.handleStatusCode(from: response, with: data)
//
// return data
// }
// .tryCatch { error in
// self.requestToken()
// .tryMap { token -> AnyPublisher<Data, WallabagKitError> in
// if token != nil {
// return self.fetch(to: to)
// }
// throw WallabagKitError.invalidToken
// }
// .mapError { error in WallabagKitError.wrap(error: error) }
// .switchToLatest()
// .eraseToAnyPublisher()
// }
// .mapErrorToWallabagKitError()
// .eraseToAnyPublisher()
// }

public func request(for endpoint: any WallabagKitEndpoint, withAuth: Bool = false) -> URLRequest {
var urlRequest = URLRequest(url: URL(string: "\(host)\(endpoint.endpoint())")!)
urlRequest.httpMethod = endpoint.method().rawValue
Expand Down

0 comments on commit 0a7c35d

Please sign in to comment.