mastodon-ios/Mastodon/Service/APIService/APIService+App.swift

39 lines
908 B
Swift
Raw Normal View History

2021-02-02 12:31:10 +01:00
//
// 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
2021-07-27 07:56:55 +02:00
private static let appWebsite = "https://app.joinmastodon.org/ios"
2021-07-26 10:15:50 +02:00
2021-02-02 12:31:10 +01:00
func createApplication(domain: String) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Application>, Error> {
let query = Mastodon.API.App.CreateQuery(
clientName: APIService.clientName,
redirectURIs: MastodonAuthenticationController.callbackURL,
2021-07-26 10:15:50 +02:00
website: APIService.appWebsite
)
2021-02-02 12:31:10 +01:00
return Mastodon.API.App.create(
session: session,
domain: domain,
query: query
)
}
}