2021-02-19 04:56:51 +01:00
|
|
|
//
|
|
|
|
// APIService+Onboarding.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-2-19.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import Combine
|
|
|
|
import MastodonSDK
|
|
|
|
|
|
|
|
extension APIService {
|
|
|
|
|
|
|
|
func servers(
|
|
|
|
language: String?,
|
|
|
|
category: String?
|
|
|
|
) -> AnyPublisher<Mastodon.Response.Content<[Mastodon.Entity.Server]>, Error> {
|
|
|
|
let query = Mastodon.API.Onboarding.ServersQuery(language: language, category: category)
|
|
|
|
return Mastodon.API.Onboarding.servers(session: session, query: query)
|
|
|
|
}
|
|
|
|
|
|
|
|
func categories() -> AnyPublisher<Mastodon.Response.Content<[Mastodon.Entity.Category]>, Error> {
|
|
|
|
return Mastodon.API.Onboarding.categories(session: session)
|
|
|
|
}
|
|
|
|
|
2021-03-05 15:50:20 +01:00
|
|
|
static func stubCategories() -> [Mastodon.Entity.Category] {
|
2021-02-19 05:17:12 +01:00
|
|
|
return Mastodon.Entity.Category.Kind.allCases.map { kind in
|
|
|
|
return Mastodon.Entity.Category(category: kind.rawValue, serversCount: 0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-19 04:56:51 +01:00
|
|
|
}
|