mirror of
https://github.com/foomo/walker.git
synced 2026-11-29 16:31:44 +00:00
415 lines
16 KiB
Swift
415 lines
16 KiB
Swift
// Code generated by goswiftrpc https://github.com/foomo/goswiftrpc - DO NOT EDIT.
|
|
import Foundation
|
|
|
|
extension Walker {
|
|
// github.com/foomo/walker/go/internal/service.Service
|
|
public struct ServiceClient: Sendable {
|
|
public static let defaultEndpoint = "/service"
|
|
|
|
public let transport: any GotsRPCTransport
|
|
public let endpoint: String
|
|
|
|
public init(transport: any GotsRPCTransport, endpoint: String = ServiceClient.defaultEndpoint) {
|
|
self.transport = transport
|
|
self.endpoint = endpoint
|
|
}
|
|
|
|
public func getBrokenLinks(scrape: String) async throws -> [WalkerVO.BrokenLink]? {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: [WalkerVO.BrokenLink]?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode([WalkerVO.BrokenLink]?.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetBrokenLinks", args: _Args(a0: scrape), result: _Result.self).r0
|
|
}
|
|
|
|
public func getFolderPages(scrape: String, options: WalkerVO.GraphOptions, folder: String, maxPages: Int) async throws -> WalkerVO.FolderPages {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: WalkerVO.GraphOptions
|
|
let a2: String
|
|
let a3: Int
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
try container.encode(a3)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.FolderPages
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.FolderPages.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetFolderPages", args: _Args(a0: scrape, a1: options, a2: folder, a3: maxPages), result: _Result.self).r0
|
|
}
|
|
|
|
public func getGraph(scrape: String, options: WalkerVO.GraphOptions) async throws -> WalkerVO.Graph {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: WalkerVO.GraphOptions
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.Graph
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.Graph.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetGraph", args: _Args(a0: scrape, a1: options), result: _Result.self).r0
|
|
}
|
|
|
|
public func getLinkedFrom(scrape: String, targetURL: String, limit: Int) async throws -> WalkerVO.LinkedFromPage {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: String
|
|
let a2: Int
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.LinkedFromPage
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.LinkedFromPage.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetLinkedFrom", args: _Args(a0: scrape, a1: targetURL, a2: limit), result: _Result.self).r0
|
|
}
|
|
|
|
public func getLinks(scrape: String) async throws -> [WalkerVO.PageLinks]? {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: [WalkerVO.PageLinks]?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode([WalkerVO.PageLinks]?.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetLinks", args: _Args(a0: scrape), result: _Result.self).r0
|
|
}
|
|
|
|
public func getPageFolderLinks(scrape: String, options: WalkerVO.GraphOptions, page: String) async throws -> [WalkerVO.FolderLink]? {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: WalkerVO.GraphOptions
|
|
let a2: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: [WalkerVO.FolderLink]?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode([WalkerVO.FolderLink]?.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetPageFolderLinks", args: _Args(a0: scrape, a1: options, a2: page), result: _Result.self).r0
|
|
}
|
|
|
|
public func getPageGraph(scrape: String, options: WalkerVO.GraphOptions, page: String, maxNodes: Int) async throws -> WalkerVO.Graph {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: WalkerVO.GraphOptions
|
|
let a2: String
|
|
let a3: Int
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
try container.encode(a3)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.Graph
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.Graph.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetPageGraph", args: _Args(a0: scrape, a1: options, a2: page, a3: maxNodes), result: _Result.self).r0
|
|
}
|
|
|
|
public func getRedirects(scrape: String) async throws -> [WalkerVO.RedirectChain]? {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: [WalkerVO.RedirectChain]?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode([WalkerVO.RedirectChain]?.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetRedirects", args: _Args(a0: scrape), result: _Result.self).r0
|
|
}
|
|
|
|
public func getResult(scrape: String, targetURL: String) async throws -> WalkerVO.ScrapeResult? {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.ScrapeResult?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.ScrapeResult?.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetResult", args: _Args(a0: scrape, a1: targetURL), result: _Result.self).r0
|
|
}
|
|
|
|
public func getResults(filters: Walker.Filters, page: Int, pageSize: Int) async throws -> (filterOptions: Walker.FilterOptions, results: [WalkerVO.ScrapeResult]?, numPages: Int, folders: [WalkerVO.Folder]?) {
|
|
struct _Args: Encodable {
|
|
let a0: Walker.Filters
|
|
let a1: Int
|
|
let a2: Int
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: Walker.FilterOptions
|
|
let r1: [WalkerVO.ScrapeResult]?
|
|
let r2: Int
|
|
let r3: [WalkerVO.Folder]?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(Walker.FilterOptions.self)
|
|
r1 = try container.decode([WalkerVO.ScrapeResult]?.self)
|
|
r2 = try container.decode(Int.self)
|
|
r3 = try container.decode([WalkerVO.Folder]?.self)
|
|
}
|
|
}
|
|
|
|
let result = try await transport.call(endpoint: endpoint, method: "GetResults", args: _Args(a0: filters, a1: page, a2: pageSize), result: _Result.self)
|
|
return (result.r0, result.r1, result.r2, result.r3)
|
|
}
|
|
|
|
public func getScrapes() async throws -> (complete: WalkerVO.ScrapeSummary?, current: WalkerVO.ScrapeSummary?) {
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.ScrapeSummary?
|
|
let r1: WalkerVO.ScrapeSummary?
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.ScrapeSummary?.self)
|
|
r1 = try container.decode(WalkerVO.ScrapeSummary?.self)
|
|
}
|
|
}
|
|
|
|
let result = try await transport.call(endpoint: endpoint, method: "GetScrapes", args: GotsRPCNoArgs(), result: _Result.self)
|
|
return (result.r0, result.r1)
|
|
}
|
|
|
|
public func getSemanticDocument(targetURL: String, html: String, content: Bool) async throws -> WalkerVO.SemanticDocument {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: String
|
|
let a2: Bool
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.SemanticDocument
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.SemanticDocument.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetSemanticDocument", args: _Args(a0: targetURL, a1: html, a2: content), result: _Result.self).r0
|
|
}
|
|
|
|
public func getShapeRoot(shapeRoot: String) async throws -> WalkerVO.ShapeRootInfo {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.ShapeRootInfo
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.ShapeRootInfo.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetShapeRoot", args: _Args(a0: shapeRoot), result: _Result.self).r0
|
|
}
|
|
|
|
public func getShapeRootVersion(shapeRoot: String) async throws -> String {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: String
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(String.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetShapeRootVersion", args: _Args(a0: shapeRoot), result: _Result.self).r0
|
|
}
|
|
|
|
public func getStatus() async throws -> WalkerVO.ServiceStatus {
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.ServiceStatus
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.ServiceStatus.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "GetStatus", args: GotsRPCNoArgs(), result: _Result.self).r0
|
|
}
|
|
|
|
public func restartScrape() async throws -> Bool {
|
|
struct _Result: Decodable {
|
|
let r0: Bool
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(Bool.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "RestartScrape", args: GotsRPCNoArgs(), result: _Result.self).r0
|
|
}
|
|
|
|
public func validateShape(shapeRoot: String, group: String, groupHeader: String, targetURL: String, html: String) async throws -> WalkerVO.ShapeValidation {
|
|
struct _Args: Encodable {
|
|
let a0: String
|
|
let a1: String
|
|
let a2: String
|
|
let a3: String
|
|
let a4: String
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
var container = encoder.unkeyedContainer()
|
|
try container.encode(a0)
|
|
try container.encode(a1)
|
|
try container.encode(a2)
|
|
try container.encode(a3)
|
|
try container.encode(a4)
|
|
}
|
|
}
|
|
|
|
struct _Result: Decodable {
|
|
let r0: WalkerVO.ShapeValidation
|
|
|
|
init(from decoder: Decoder) throws {
|
|
var container = try decoder.unkeyedContainer()
|
|
r0 = try container.decode(WalkerVO.ShapeValidation.self)
|
|
}
|
|
}
|
|
|
|
return try await transport.call(endpoint: endpoint, method: "ValidateShape", args: _Args(a0: shapeRoot, a1: group, a2: groupHeader, a3: targetURL, a4: html), result: _Result.self).r0
|
|
}
|
|
}
|
|
}
|