forked from zelo72/mastodon-ios
39 lines
908 B
Swift
39 lines
908 B
Swift
//
|
|
// APIService+App.swift
|
|
// Mastodon
|
|
//
|
|
// Created by MainasuK Cirno on 2021/2/2.
|
|
//
|
|
|
|
import Foundation
|
|
import Combine
|
|
import CoreData
|
|
import CoreDataStack
|
|
import MastodonSDK
|
|
|
|
extension APIService {
|
|
|
|
#if DEBUG
|
|
private static let clientName = "Skimming"
|
|
#else
|
|
private static let clientName = "Mastodon for iOS"
|
|
#endif
|
|
|
|
private static let appWebsite = "https://app.joinmastodon.org/ios"
|
|
|
|
func createApplication(domain: String) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Application>, Error> {
|
|
let query = Mastodon.API.App.CreateQuery(
|
|
clientName: APIService.clientName,
|
|
redirectURIs: MastodonAuthenticationController.callbackURL,
|
|
website: APIService.appWebsite
|
|
)
|
|
return Mastodon.API.App.create(
|
|
session: session,
|
|
domain: domain,
|
|
query: query
|
|
)
|
|
}
|
|
|
|
}
|
|
|