Skip to content
sdoteePublic

About

The official Swift SDK for the S.EE API.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

see-sdk

CI CodeQL

The official Swift SDK for the S.EE API. It uses Swift Concurrency and URLSession with no third-party dependencies.

Supported platforms:

  • iOS 15 or later
  • macOS 12 or later
  • Swift 6 or later

Installation

Add the package in Xcode, or declare it in Package.swift:

dependencies: [
    .package(url: "https://github.com/sdotee/sdk.swift", from: "1.0.0")
]

Add the see-sdk product to your target, then import the SeeSDK module.

Client

import SeeSDK

let client = SEEClient(configuration: .init(apiKey: "your-api-key"))

Use a custom endpoint when needed:

let client = SEEClient(configuration: .init(
    apiKey: "your-api-key",
    baseURL: URL(string: "https://example.com/api/v1/")!
))

The default API base URL is https://s.ee/api/v1/.

Short URLs

let shortURL = try await client.shortURLs.create(.init(
    domain: "s.ee",
    targetURL: "https://example.com/long-path",
    customSlug: "example",
    title: "Example"
))

let history = try await client.shortURLs.history(page: 1)
let statistics = try await client.shortURLs.visitStatistics(
    domain: "s.ee",
    slug: shortURL.slug,
    period: .monthly
)

File Upload

Upload a small file with multipart form data:

let data = try Data(contentsOf: fileURL)
let file = try await client.files.upload(
    data: data,
    filename: fileURL.lastPathComponent,
    mimeType: "application/pdf"
)

Create and complete a TUS large-file upload:

let session = try await client.files.createLargeUpload(.init(
    fileName: "archive.zip",
    fileSize: Int64(data.count),
    mimeType: "application/zip"
))

if !session.fastUpload, let uploadID = session.uploadID {
    var offset: Int64 = 0
    for chunk in chunks {
        offset = try await client.files.uploadChunk(
            uploadID: uploadID,
            data: chunk,
            offset: offset
        )
    }
    let result = try await client.files.completeLargeUpload(uploadID: uploadID)
}

Services

  • client.shortURLs: short URLs, domains, history, and visit statistics
  • client.files: multipart upload, TUS upload, history, deletion, and private download URLs
  • client.texts: text sharing and history
  • client.qrCodes: QR code creation and history
  • client.bioPages: bio page management and history
  • client.account: tags, usage, and token validation

All public request and response models conform to Codable and Sendable. Transport and API failures are reported as SEEError.

About

The official Swift SDK for the S.EE API.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages

⌂