Merge pull request #49 from appwrite/dev

feat: Swift SDK update for version 14.0.0
This commit is contained in:
Jake Barnby
2025-12-03 03:17:43 +00:00
committed by GitHub
22 changed files with 662 additions and 29 deletions
+7
View File
@@ -1,5 +1,12 @@
# Change Log
## 14.0.0
* Rename `VCSDeploymentType` enum to `VCSReferenceType`
* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters
* Add `getScreenshot` method to `Avatars` service
* Add `Theme`, `Timezone` and `Output` enums
## 13.3.0
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
+1 -1
View File
@@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:
```swift
dependencies: [
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "13.3.0"),
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "14.0.0"),
],
```
+2 -1
View File
@@ -5,6 +5,7 @@ import NIOSSL
import Foundation
import AsyncHTTPClient
@_exported import AppwriteModels
@_exported import JSONCodable
let DASHDASH = "--"
let CRLF = "\r\n"
@@ -21,7 +22,7 @@ open class Client {
"x-sdk-name": "Swift",
"x-sdk-platform": "server",
"x-sdk-language": "swift",
"x-sdk-version": "13.3.0",
"x-sdk-version": "14.0.0",
"x-appwrite-response-format": "1.8.0"
]
+4 -4
View File
@@ -654,7 +654,7 @@ open class Account: Service {
open func createMfaChallenge(
factor: AppwriteEnums.AuthenticationFactor
) async throws -> AppwriteModels.MfaChallenge {
let apiPath: String = "/account/mfa/challenge"
let apiPath: String = "/account/mfa/challenges"
let apiParams: [String: Any?] = [
"factor": factor
@@ -690,7 +690,7 @@ open class Account: Service {
open func createMFAChallenge(
factor: AppwriteEnums.AuthenticationFactor
) async throws -> AppwriteModels.MfaChallenge {
let apiPath: String = "/account/mfa/challenge"
let apiPath: String = "/account/mfa/challenges"
let apiParams: [String: Any?] = [
"factor": factor
@@ -731,7 +731,7 @@ open class Account: Service {
challengeId: String,
otp: String
) async throws -> AppwriteModels.Session {
let apiPath: String = "/account/mfa/challenge"
let apiPath: String = "/account/mfa/challenges"
let apiParams: [String: Any?] = [
"challengeId": challengeId,
@@ -772,7 +772,7 @@ open class Account: Service {
challengeId: String,
otp: String
) async throws -> AppwriteModels.Session {
let apiPath: String = "/account/mfa/challenge"
let apiPath: String = "/account/mfa/challenges"
let apiParams: [String: Any?] = [
"challengeId": challengeId,
+94
View File
@@ -311,5 +311,99 @@ open class Avatars: Service {
)
}
///
/// Use this endpoint to capture a screenshot of any website URL. This endpoint
/// uses a headless browser to render the webpage and capture it as an image.
///
/// You can configure the browser viewport size, theme, user agent,
/// geolocation, permissions, and more. Capture either just the viewport or the
/// full page scroll.
///
/// When width and height are specified, the image is resized accordingly. If
/// both dimensions are 0, the API provides an image at original size. If
/// dimensions are not specified, the default viewport size is 1280x720px.
///
/// - Parameters:
/// - url: String
/// - headers: Any (optional)
/// - viewportWidth: Int (optional)
/// - viewportHeight: Int (optional)
/// - scale: Double (optional)
/// - theme: AppwriteEnums.Theme (optional)
/// - userAgent: String (optional)
/// - fullpage: Bool (optional)
/// - locale: String (optional)
/// - timezone: AppwriteEnums.Timezone (optional)
/// - latitude: Double (optional)
/// - longitude: Double (optional)
/// - accuracy: Double (optional)
/// - touch: Bool (optional)
/// - permissions: [String] (optional)
/// - sleep: Int (optional)
/// - width: Int (optional)
/// - height: Int (optional)
/// - quality: Int (optional)
/// - output: AppwriteEnums.Output (optional)
/// - Throws: Exception if the request fails
/// - Returns: ByteBuffer
///
open func getScreenshot(
url: String,
headers: Any? = nil,
viewportWidth: Int? = nil,
viewportHeight: Int? = nil,
scale: Double? = nil,
theme: AppwriteEnums.Theme? = nil,
userAgent: String? = nil,
fullpage: Bool? = nil,
locale: String? = nil,
timezone: AppwriteEnums.Timezone? = nil,
latitude: Double? = nil,
longitude: Double? = nil,
accuracy: Double? = nil,
touch: Bool? = nil,
permissions: [String]? = nil,
sleep: Int? = nil,
width: Int? = nil,
height: Int? = nil,
quality: Int? = nil,
output: AppwriteEnums.Output? = nil
) async throws -> ByteBuffer {
let apiPath: String = "/avatars/screenshots"
let apiParams: [String: Any?] = [
"url": url,
"headers": headers,
"viewportWidth": viewportWidth,
"viewportHeight": viewportHeight,
"scale": scale,
"theme": theme,
"userAgent": userAgent,
"fullpage": fullpage,
"locale": locale,
"timezone": timezone,
"latitude": latitude,
"longitude": longitude,
"accuracy": accuracy,
"touch": touch,
"permissions": permissions,
"sleep": sleep,
"width": width,
"height": height,
"quality": quality,
"output": output,
"project": client.config["project"],
"session": client.config["session"]
]
let apiHeaders: [String: String] = [:]
return try await client.call(
method: "GET",
path: apiPath,
params: apiParams
)
}
}
+8 -5
View File
@@ -528,7 +528,8 @@ open class Functions: Service {
/// - repository: String
/// - owner: String
/// - rootDirectory: String
/// - version: String
/// - type: AppwriteEnums.TemplateReferenceType
/// - reference: String
/// - activate: Bool (optional)
/// - Throws: Exception if the request fails
/// - Returns: AppwriteModels.Deployment
@@ -538,7 +539,8 @@ open class Functions: Service {
repository: String,
owner: String,
rootDirectory: String,
version: String,
type: AppwriteEnums.TemplateReferenceType,
reference: String,
activate: Bool? = nil
) async throws -> AppwriteModels.Deployment {
let apiPath: String = "/functions/{functionId}/deployments/template"
@@ -548,7 +550,8 @@ open class Functions: Service {
"repository": repository,
"owner": owner,
"rootDirectory": rootDirectory,
"version": version,
"type": type,
"reference": reference,
"activate": activate
]
@@ -576,7 +579,7 @@ open class Functions: Service {
///
/// - Parameters:
/// - functionId: String
/// - type: AppwriteEnums.VCSDeploymentType
/// - type: AppwriteEnums.VCSReferenceType
/// - reference: String
/// - activate: Bool (optional)
/// - Throws: Exception if the request fails
@@ -584,7 +587,7 @@ open class Functions: Service {
///
open func createVcsDeployment(
functionId: String,
type: AppwriteEnums.VCSDeploymentType,
type: AppwriteEnums.VCSReferenceType,
reference: String,
activate: Bool? = nil
) async throws -> AppwriteModels.Deployment {
+9 -6
View File
@@ -413,7 +413,7 @@ open class Sites: Service {
///
/// Create a new site code deployment. Use this endpoint to upload a new
/// version of your site code. To activate your newly uploaded code, you'll
/// need to update the function's deployment to use your new deployment ID.
/// need to update the site's deployment to use your new deployment ID.
///
/// - Parameters:
/// - siteId: String
@@ -519,7 +519,8 @@ open class Sites: Service {
/// - repository: String
/// - owner: String
/// - rootDirectory: String
/// - version: String
/// - type: AppwriteEnums.TemplateReferenceType
/// - reference: String
/// - activate: Bool (optional)
/// - Throws: Exception if the request fails
/// - Returns: AppwriteModels.Deployment
@@ -529,7 +530,8 @@ open class Sites: Service {
repository: String,
owner: String,
rootDirectory: String,
version: String,
type: AppwriteEnums.TemplateReferenceType,
reference: String,
activate: Bool? = nil
) async throws -> AppwriteModels.Deployment {
let apiPath: String = "/sites/{siteId}/deployments/template"
@@ -539,7 +541,8 @@ open class Sites: Service {
"repository": repository,
"owner": owner,
"rootDirectory": rootDirectory,
"version": version,
"type": type,
"reference": reference,
"activate": activate
]
@@ -567,7 +570,7 @@ open class Sites: Service {
///
/// - Parameters:
/// - siteId: String
/// - type: AppwriteEnums.VCSDeploymentType
/// - type: AppwriteEnums.VCSReferenceType
/// - reference: String
/// - activate: Bool (optional)
/// - Throws: Exception if the request fails
@@ -575,7 +578,7 @@ open class Sites: Service {
///
open func createVcsDeployment(
siteId: String,
type: AppwriteEnums.VCSDeploymentType,
type: AppwriteEnums.VCSReferenceType,
reference: String,
activate: Bool? = nil
) async throws -> AppwriteModels.Deployment {
+10 -4
View File
@@ -61,6 +61,7 @@ open class Storage: Service {
/// - compression: AppwriteEnums.Compression (optional)
/// - encryption: Bool (optional)
/// - antivirus: Bool (optional)
/// - transformations: Bool (optional)
/// - Throws: Exception if the request fails
/// - Returns: AppwriteModels.Bucket
///
@@ -74,7 +75,8 @@ open class Storage: Service {
allowedFileExtensions: [String]? = nil,
compression: AppwriteEnums.Compression? = nil,
encryption: Bool? = nil,
antivirus: Bool? = nil
antivirus: Bool? = nil,
transformations: Bool? = nil
) async throws -> AppwriteModels.Bucket {
let apiPath: String = "/storage/buckets"
@@ -88,7 +90,8 @@ open class Storage: Service {
"allowedFileExtensions": allowedFileExtensions,
"compression": compression,
"encryption": encryption,
"antivirus": antivirus
"antivirus": antivirus,
"transformations": transformations
]
let apiHeaders: [String: String] = [
@@ -154,6 +157,7 @@ open class Storage: Service {
/// - compression: AppwriteEnums.Compression (optional)
/// - encryption: Bool (optional)
/// - antivirus: Bool (optional)
/// - transformations: Bool (optional)
/// - Throws: Exception if the request fails
/// - Returns: AppwriteModels.Bucket
///
@@ -167,7 +171,8 @@ open class Storage: Service {
allowedFileExtensions: [String]? = nil,
compression: AppwriteEnums.Compression? = nil,
encryption: Bool? = nil,
antivirus: Bool? = nil
antivirus: Bool? = nil,
transformations: Bool? = nil
) async throws -> AppwriteModels.Bucket {
let apiPath: String = "/storage/buckets/{bucketId}"
.replacingOccurrences(of: "{bucketId}", with: bucketId)
@@ -181,7 +186,8 @@ open class Storage: Service {
"allowedFileExtensions": allowedFileExtensions,
"compression": compression,
"encryption": encryption,
"antivirus": antivirus
"antivirus": antivirus,
"transformations": transformations
]
let apiHeaders: [String: String] = [
+2
View File
@@ -39,6 +39,7 @@ public enum BuildRuntime: String, CustomStringConvertible {
case dart33 = "dart-3.3"
case dart35 = "dart-3.5"
case dart38 = "dart-3.8"
case dart39 = "dart-3.9"
case dotnet60 = "dotnet-6.0"
case dotnet70 = "dotnet-7.0"
case dotnet80 = "dotnet-8.0"
@@ -66,6 +67,7 @@ public enum BuildRuntime: String, CustomStringConvertible {
case flutter327 = "flutter-3.27"
case flutter329 = "flutter-3.29"
case flutter332 = "flutter-3.32"
case flutter335 = "flutter-3.35"
public var description: String {
return rawValue
+15
View File
@@ -0,0 +1,15 @@
import Foundation
public enum Output: String, CustomStringConvertible {
case jpg = "jpg"
case jpeg = "jpeg"
case png = "png"
case webp = "webp"
case heic = "heic"
case avif = "avif"
case gif = "gif"
public var description: String {
return rawValue
}
}
+2
View File
@@ -39,6 +39,7 @@ public enum Runtime: String, CustomStringConvertible {
case dart33 = "dart-3.3"
case dart35 = "dart-3.5"
case dart38 = "dart-3.8"
case dart39 = "dart-3.9"
case dotnet60 = "dotnet-6.0"
case dotnet70 = "dotnet-7.0"
case dotnet80 = "dotnet-8.0"
@@ -66,6 +67,7 @@ public enum Runtime: String, CustomStringConvertible {
case flutter327 = "flutter-3.27"
case flutter329 = "flutter-3.29"
case flutter332 = "flutter-3.32"
case flutter335 = "flutter-3.35"
public var description: String {
return rawValue
@@ -0,0 +1,11 @@
import Foundation
public enum TemplateReferenceType: String, CustomStringConvertible {
case branch = "branch"
case commit = "commit"
case tag = "tag"
public var description: String {
return rawValue
}
}
+10
View File
@@ -0,0 +1,10 @@
import Foundation
public enum Theme: String, CustomStringConvertible {
case light = "light"
case dark = "dark"
public var description: String {
return rawValue
}
}
+427
View File
@@ -0,0 +1,427 @@
import Foundation
public enum Timezone: String, CustomStringConvertible {
case africaAbidjan = "africa/abidjan"
case africaAccra = "africa/accra"
case africaAddisAbaba = "africa/addis_ababa"
case africaAlgiers = "africa/algiers"
case africaAsmara = "africa/asmara"
case africaBamako = "africa/bamako"
case africaBangui = "africa/bangui"
case africaBanjul = "africa/banjul"
case africaBissau = "africa/bissau"
case africaBlantyre = "africa/blantyre"
case africaBrazzaville = "africa/brazzaville"
case africaBujumbura = "africa/bujumbura"
case africaCairo = "africa/cairo"
case africaCasablanca = "africa/casablanca"
case africaCeuta = "africa/ceuta"
case africaConakry = "africa/conakry"
case africaDakar = "africa/dakar"
case africaDarEsSalaam = "africa/dar_es_salaam"
case africaDjibouti = "africa/djibouti"
case africaDouala = "africa/douala"
case africaElAaiun = "africa/el_aaiun"
case africaFreetown = "africa/freetown"
case africaGaborone = "africa/gaborone"
case africaHarare = "africa/harare"
case africaJohannesburg = "africa/johannesburg"
case africaJuba = "africa/juba"
case africaKampala = "africa/kampala"
case africaKhartoum = "africa/khartoum"
case africaKigali = "africa/kigali"
case africaKinshasa = "africa/kinshasa"
case africaLagos = "africa/lagos"
case africaLibreville = "africa/libreville"
case africaLome = "africa/lome"
case africaLuanda = "africa/luanda"
case africaLubumbashi = "africa/lubumbashi"
case africaLusaka = "africa/lusaka"
case africaMalabo = "africa/malabo"
case africaMaputo = "africa/maputo"
case africaMaseru = "africa/maseru"
case africaMbabane = "africa/mbabane"
case africaMogadishu = "africa/mogadishu"
case africaMonrovia = "africa/monrovia"
case africaNairobi = "africa/nairobi"
case africaNdjamena = "africa/ndjamena"
case africaNiamey = "africa/niamey"
case africaNouakchott = "africa/nouakchott"
case africaOuagadougou = "africa/ouagadougou"
case africaPortoNovo = "africa/porto-novo"
case africaSaoTome = "africa/sao_tome"
case africaTripoli = "africa/tripoli"
case africaTunis = "africa/tunis"
case africaWindhoek = "africa/windhoek"
case americaAdak = "america/adak"
case americaAnchorage = "america/anchorage"
case americaAnguilla = "america/anguilla"
case americaAntigua = "america/antigua"
case americaAraguaina = "america/araguaina"
case americaArgentinaBuenosAires = "america/argentina/buenos_aires"
case americaArgentinaCatamarca = "america/argentina/catamarca"
case americaArgentinaCordoba = "america/argentina/cordoba"
case americaArgentinaJujuy = "america/argentina/jujuy"
case americaArgentinaLaRioja = "america/argentina/la_rioja"
case americaArgentinaMendoza = "america/argentina/mendoza"
case americaArgentinaRioGallegos = "america/argentina/rio_gallegos"
case americaArgentinaSalta = "america/argentina/salta"
case americaArgentinaSanJuan = "america/argentina/san_juan"
case americaArgentinaSanLuis = "america/argentina/san_luis"
case americaArgentinaTucuman = "america/argentina/tucuman"
case americaArgentinaUshuaia = "america/argentina/ushuaia"
case americaAruba = "america/aruba"
case americaAsuncion = "america/asuncion"
case americaAtikokan = "america/atikokan"
case americaBahia = "america/bahia"
case americaBahiaBanderas = "america/bahia_banderas"
case americaBarbados = "america/barbados"
case americaBelem = "america/belem"
case americaBelize = "america/belize"
case americaBlancSablon = "america/blanc-sablon"
case americaBoaVista = "america/boa_vista"
case americaBogota = "america/bogota"
case americaBoise = "america/boise"
case americaCambridgeBay = "america/cambridge_bay"
case americaCampoGrande = "america/campo_grande"
case americaCancun = "america/cancun"
case americaCaracas = "america/caracas"
case americaCayenne = "america/cayenne"
case americaCayman = "america/cayman"
case americaChicago = "america/chicago"
case americaChihuahua = "america/chihuahua"
case americaCiudadJuarez = "america/ciudad_juarez"
case americaCostaRica = "america/costa_rica"
case americaCoyhaique = "america/coyhaique"
case americaCreston = "america/creston"
case americaCuiaba = "america/cuiaba"
case americaCuracao = "america/curacao"
case americaDanmarkshavn = "america/danmarkshavn"
case americaDawson = "america/dawson"
case americaDawsonCreek = "america/dawson_creek"
case americaDenver = "america/denver"
case americaDetroit = "america/detroit"
case americaDominica = "america/dominica"
case americaEdmonton = "america/edmonton"
case americaEirunepe = "america/eirunepe"
case americaElSalvador = "america/el_salvador"
case americaFortNelson = "america/fort_nelson"
case americaFortaleza = "america/fortaleza"
case americaGlaceBay = "america/glace_bay"
case americaGooseBay = "america/goose_bay"
case americaGrandTurk = "america/grand_turk"
case americaGrenada = "america/grenada"
case americaGuadeloupe = "america/guadeloupe"
case americaGuatemala = "america/guatemala"
case americaGuayaquil = "america/guayaquil"
case americaGuyana = "america/guyana"
case americaHalifax = "america/halifax"
case americaHavana = "america/havana"
case americaHermosillo = "america/hermosillo"
case americaIndianaIndianapolis = "america/indiana/indianapolis"
case americaIndianaKnox = "america/indiana/knox"
case americaIndianaMarengo = "america/indiana/marengo"
case americaIndianaPetersburg = "america/indiana/petersburg"
case americaIndianaTellCity = "america/indiana/tell_city"
case americaIndianaVevay = "america/indiana/vevay"
case americaIndianaVincennes = "america/indiana/vincennes"
case americaIndianaWinamac = "america/indiana/winamac"
case americaInuvik = "america/inuvik"
case americaIqaluit = "america/iqaluit"
case americaJamaica = "america/jamaica"
case americaJuneau = "america/juneau"
case americaKentuckyLouisville = "america/kentucky/louisville"
case americaKentuckyMonticello = "america/kentucky/monticello"
case americaKralendijk = "america/kralendijk"
case americaLaPaz = "america/la_paz"
case americaLima = "america/lima"
case americaLosAngeles = "america/los_angeles"
case americaLowerPrinces = "america/lower_princes"
case americaMaceio = "america/maceio"
case americaManagua = "america/managua"
case americaManaus = "america/manaus"
case americaMarigot = "america/marigot"
case americaMartinique = "america/martinique"
case americaMatamoros = "america/matamoros"
case americaMazatlan = "america/mazatlan"
case americaMenominee = "america/menominee"
case americaMerida = "america/merida"
case americaMetlakatla = "america/metlakatla"
case americaMexicoCity = "america/mexico_city"
case americaMiquelon = "america/miquelon"
case americaMoncton = "america/moncton"
case americaMonterrey = "america/monterrey"
case americaMontevideo = "america/montevideo"
case americaMontserrat = "america/montserrat"
case americaNassau = "america/nassau"
case americaNewYork = "america/new_york"
case americaNome = "america/nome"
case americaNoronha = "america/noronha"
case americaNorthDakotaBeulah = "america/north_dakota/beulah"
case americaNorthDakotaCenter = "america/north_dakota/center"
case americaNorthDakotaNewSalem = "america/north_dakota/new_salem"
case americaNuuk = "america/nuuk"
case americaOjinaga = "america/ojinaga"
case americaPanama = "america/panama"
case americaParamaribo = "america/paramaribo"
case americaPhoenix = "america/phoenix"
case americaPortAuPrince = "america/port-au-prince"
case americaPortOfSpain = "america/port_of_spain"
case americaPortoVelho = "america/porto_velho"
case americaPuertoRico = "america/puerto_rico"
case americaPuntaArenas = "america/punta_arenas"
case americaRankinInlet = "america/rankin_inlet"
case americaRecife = "america/recife"
case americaRegina = "america/regina"
case americaResolute = "america/resolute"
case americaRioBranco = "america/rio_branco"
case americaSantarem = "america/santarem"
case americaSantiago = "america/santiago"
case americaSantoDomingo = "america/santo_domingo"
case americaSaoPaulo = "america/sao_paulo"
case americaScoresbysund = "america/scoresbysund"
case americaSitka = "america/sitka"
case americaStBarthelemy = "america/st_barthelemy"
case americaStJohns = "america/st_johns"
case americaStKitts = "america/st_kitts"
case americaStLucia = "america/st_lucia"
case americaStThomas = "america/st_thomas"
case americaStVincent = "america/st_vincent"
case americaSwiftCurrent = "america/swift_current"
case americaTegucigalpa = "america/tegucigalpa"
case americaThule = "america/thule"
case americaTijuana = "america/tijuana"
case americaToronto = "america/toronto"
case americaTortola = "america/tortola"
case americaVancouver = "america/vancouver"
case americaWhitehorse = "america/whitehorse"
case americaWinnipeg = "america/winnipeg"
case americaYakutat = "america/yakutat"
case antarcticaCasey = "antarctica/casey"
case antarcticaDavis = "antarctica/davis"
case antarcticaDumontdurville = "antarctica/dumontdurville"
case antarcticaMacquarie = "antarctica/macquarie"
case antarcticaMawson = "antarctica/mawson"
case antarcticaMcmurdo = "antarctica/mcmurdo"
case antarcticaPalmer = "antarctica/palmer"
case antarcticaRothera = "antarctica/rothera"
case antarcticaSyowa = "antarctica/syowa"
case antarcticaTroll = "antarctica/troll"
case antarcticaVostok = "antarctica/vostok"
case arcticLongyearbyen = "arctic/longyearbyen"
case asiaAden = "asia/aden"
case asiaAlmaty = "asia/almaty"
case asiaAmman = "asia/amman"
case asiaAnadyr = "asia/anadyr"
case asiaAqtau = "asia/aqtau"
case asiaAqtobe = "asia/aqtobe"
case asiaAshgabat = "asia/ashgabat"
case asiaAtyrau = "asia/atyrau"
case asiaBaghdad = "asia/baghdad"
case asiaBahrain = "asia/bahrain"
case asiaBaku = "asia/baku"
case asiaBangkok = "asia/bangkok"
case asiaBarnaul = "asia/barnaul"
case asiaBeirut = "asia/beirut"
case asiaBishkek = "asia/bishkek"
case asiaBrunei = "asia/brunei"
case asiaChita = "asia/chita"
case asiaColombo = "asia/colombo"
case asiaDamascus = "asia/damascus"
case asiaDhaka = "asia/dhaka"
case asiaDili = "asia/dili"
case asiaDubai = "asia/dubai"
case asiaDushanbe = "asia/dushanbe"
case asiaFamagusta = "asia/famagusta"
case asiaGaza = "asia/gaza"
case asiaHebron = "asia/hebron"
case asiaHoChiMinh = "asia/ho_chi_minh"
case asiaHongKong = "asia/hong_kong"
case asiaHovd = "asia/hovd"
case asiaIrkutsk = "asia/irkutsk"
case asiaJakarta = "asia/jakarta"
case asiaJayapura = "asia/jayapura"
case asiaJerusalem = "asia/jerusalem"
case asiaKabul = "asia/kabul"
case asiaKamchatka = "asia/kamchatka"
case asiaKarachi = "asia/karachi"
case asiaKathmandu = "asia/kathmandu"
case asiaKhandyga = "asia/khandyga"
case asiaKolkata = "asia/kolkata"
case asiaKrasnoyarsk = "asia/krasnoyarsk"
case asiaKualaLumpur = "asia/kuala_lumpur"
case asiaKuching = "asia/kuching"
case asiaKuwait = "asia/kuwait"
case asiaMacau = "asia/macau"
case asiaMagadan = "asia/magadan"
case asiaMakassar = "asia/makassar"
case asiaManila = "asia/manila"
case asiaMuscat = "asia/muscat"
case asiaNicosia = "asia/nicosia"
case asiaNovokuznetsk = "asia/novokuznetsk"
case asiaNovosibirsk = "asia/novosibirsk"
case asiaOmsk = "asia/omsk"
case asiaOral = "asia/oral"
case asiaPhnomPenh = "asia/phnom_penh"
case asiaPontianak = "asia/pontianak"
case asiaPyongyang = "asia/pyongyang"
case asiaQatar = "asia/qatar"
case asiaQostanay = "asia/qostanay"
case asiaQyzylorda = "asia/qyzylorda"
case asiaRiyadh = "asia/riyadh"
case asiaSakhalin = "asia/sakhalin"
case asiaSamarkand = "asia/samarkand"
case asiaSeoul = "asia/seoul"
case asiaShanghai = "asia/shanghai"
case asiaSingapore = "asia/singapore"
case asiaSrednekolymsk = "asia/srednekolymsk"
case asiaTaipei = "asia/taipei"
case asiaTashkent = "asia/tashkent"
case asiaTbilisi = "asia/tbilisi"
case asiaTehran = "asia/tehran"
case asiaThimphu = "asia/thimphu"
case asiaTokyo = "asia/tokyo"
case asiaTomsk = "asia/tomsk"
case asiaUlaanbaatar = "asia/ulaanbaatar"
case asiaUrumqi = "asia/urumqi"
case asiaUstNera = "asia/ust-nera"
case asiaVientiane = "asia/vientiane"
case asiaVladivostok = "asia/vladivostok"
case asiaYakutsk = "asia/yakutsk"
case asiaYangon = "asia/yangon"
case asiaYekaterinburg = "asia/yekaterinburg"
case asiaYerevan = "asia/yerevan"
case atlanticAzores = "atlantic/azores"
case atlanticBermuda = "atlantic/bermuda"
case atlanticCanary = "atlantic/canary"
case atlanticCapeVerde = "atlantic/cape_verde"
case atlanticFaroe = "atlantic/faroe"
case atlanticMadeira = "atlantic/madeira"
case atlanticReykjavik = "atlantic/reykjavik"
case atlanticSouthGeorgia = "atlantic/south_georgia"
case atlanticStHelena = "atlantic/st_helena"
case atlanticStanley = "atlantic/stanley"
case australiaAdelaide = "australia/adelaide"
case australiaBrisbane = "australia/brisbane"
case australiaBrokenHill = "australia/broken_hill"
case australiaDarwin = "australia/darwin"
case australiaEucla = "australia/eucla"
case australiaHobart = "australia/hobart"
case australiaLindeman = "australia/lindeman"
case australiaLordHowe = "australia/lord_howe"
case australiaMelbourne = "australia/melbourne"
case australiaPerth = "australia/perth"
case australiaSydney = "australia/sydney"
case europeAmsterdam = "europe/amsterdam"
case europeAndorra = "europe/andorra"
case europeAstrakhan = "europe/astrakhan"
case europeAthens = "europe/athens"
case europeBelgrade = "europe/belgrade"
case europeBerlin = "europe/berlin"
case europeBratislava = "europe/bratislava"
case europeBrussels = "europe/brussels"
case europeBucharest = "europe/bucharest"
case europeBudapest = "europe/budapest"
case europeBusingen = "europe/busingen"
case europeChisinau = "europe/chisinau"
case europeCopenhagen = "europe/copenhagen"
case europeDublin = "europe/dublin"
case europeGibraltar = "europe/gibraltar"
case europeGuernsey = "europe/guernsey"
case europeHelsinki = "europe/helsinki"
case europeIsleOfMan = "europe/isle_of_man"
case europeIstanbul = "europe/istanbul"
case europeJersey = "europe/jersey"
case europeKaliningrad = "europe/kaliningrad"
case europeKirov = "europe/kirov"
case europeKyiv = "europe/kyiv"
case europeLisbon = "europe/lisbon"
case europeLjubljana = "europe/ljubljana"
case europeLondon = "europe/london"
case europeLuxembourg = "europe/luxembourg"
case europeMadrid = "europe/madrid"
case europeMalta = "europe/malta"
case europeMariehamn = "europe/mariehamn"
case europeMinsk = "europe/minsk"
case europeMonaco = "europe/monaco"
case europeMoscow = "europe/moscow"
case europeOslo = "europe/oslo"
case europeParis = "europe/paris"
case europePodgorica = "europe/podgorica"
case europePrague = "europe/prague"
case europeRiga = "europe/riga"
case europeRome = "europe/rome"
case europeSamara = "europe/samara"
case europeSanMarino = "europe/san_marino"
case europeSarajevo = "europe/sarajevo"
case europeSaratov = "europe/saratov"
case europeSimferopol = "europe/simferopol"
case europeSkopje = "europe/skopje"
case europeSofia = "europe/sofia"
case europeStockholm = "europe/stockholm"
case europeTallinn = "europe/tallinn"
case europeTirane = "europe/tirane"
case europeUlyanovsk = "europe/ulyanovsk"
case europeVaduz = "europe/vaduz"
case europeVatican = "europe/vatican"
case europeVienna = "europe/vienna"
case europeVilnius = "europe/vilnius"
case europeVolgograd = "europe/volgograd"
case europeWarsaw = "europe/warsaw"
case europeZagreb = "europe/zagreb"
case europeZurich = "europe/zurich"
case indianAntananarivo = "indian/antananarivo"
case indianChagos = "indian/chagos"
case indianChristmas = "indian/christmas"
case indianCocos = "indian/cocos"
case indianComoro = "indian/comoro"
case indianKerguelen = "indian/kerguelen"
case indianMahe = "indian/mahe"
case indianMaldives = "indian/maldives"
case indianMauritius = "indian/mauritius"
case indianMayotte = "indian/mayotte"
case indianReunion = "indian/reunion"
case pacificApia = "pacific/apia"
case pacificAuckland = "pacific/auckland"
case pacificBougainville = "pacific/bougainville"
case pacificChatham = "pacific/chatham"
case pacificChuuk = "pacific/chuuk"
case pacificEaster = "pacific/easter"
case pacificEfate = "pacific/efate"
case pacificFakaofo = "pacific/fakaofo"
case pacificFiji = "pacific/fiji"
case pacificFunafuti = "pacific/funafuti"
case pacificGalapagos = "pacific/galapagos"
case pacificGambier = "pacific/gambier"
case pacificGuadalcanal = "pacific/guadalcanal"
case pacificGuam = "pacific/guam"
case pacificHonolulu = "pacific/honolulu"
case pacificKanton = "pacific/kanton"
case pacificKiritimati = "pacific/kiritimati"
case pacificKosrae = "pacific/kosrae"
case pacificKwajalein = "pacific/kwajalein"
case pacificMajuro = "pacific/majuro"
case pacificMarquesas = "pacific/marquesas"
case pacificMidway = "pacific/midway"
case pacificNauru = "pacific/nauru"
case pacificNiue = "pacific/niue"
case pacificNorfolk = "pacific/norfolk"
case pacificNoumea = "pacific/noumea"
case pacificPagoPago = "pacific/pago_pago"
case pacificPalau = "pacific/palau"
case pacificPitcairn = "pacific/pitcairn"
case pacificPohnpei = "pacific/pohnpei"
case pacificPortMoresby = "pacific/port_moresby"
case pacificRarotonga = "pacific/rarotonga"
case pacificSaipan = "pacific/saipan"
case pacificTahiti = "pacific/tahiti"
case pacificTarawa = "pacific/tarawa"
case pacificTongatapu = "pacific/tongatapu"
case pacificWake = "pacific/wake"
case pacificWallis = "pacific/wallis"
case utc = "utc"
public var description: String {
return rawValue
}
}
@@ -1,6 +1,6 @@
import Foundation
public enum VCSDeploymentType: String, CustomStringConvertible {
public enum VCSReferenceType: String, CustomStringConvertible {
case branch = "branch"
case commit = "commit"
case tag = "tag"
+13 -3
View File
@@ -17,6 +17,7 @@ open class Bucket: Codable {
case compression = "compression"
case encryption = "encryption"
case antivirus = "antivirus"
case transformations = "transformations"
}
/// Bucket ID.
@@ -55,6 +56,9 @@ open class Bucket: Codable {
/// Virus scanning is enabled.
public let antivirus: Bool
/// Image transformations are enabled.
public let transformations: Bool
init(
id: String,
@@ -68,7 +72,8 @@ open class Bucket: Codable {
allowedFileExtensions: [String],
compression: String,
encryption: Bool,
antivirus: Bool
antivirus: Bool,
transformations: Bool
) {
self.id = id
self.createdAt = createdAt
@@ -82,6 +87,7 @@ open class Bucket: Codable {
self.compression = compression
self.encryption = encryption
self.antivirus = antivirus
self.transformations = transformations
}
public required init(from decoder: Decoder) throws {
@@ -99,6 +105,7 @@ open class Bucket: Codable {
self.compression = try container.decode(String.self, forKey: .compression)
self.encryption = try container.decode(Bool.self, forKey: .encryption)
self.antivirus = try container.decode(Bool.self, forKey: .antivirus)
self.transformations = try container.decode(Bool.self, forKey: .transformations)
}
public func encode(to encoder: Encoder) throws {
@@ -116,6 +123,7 @@ open class Bucket: Codable {
try container.encode(compression, forKey: .compression)
try container.encode(encryption, forKey: .encryption)
try container.encode(antivirus, forKey: .antivirus)
try container.encode(transformations, forKey: .transformations)
}
public func toMap() -> [String: Any] {
@@ -131,7 +139,8 @@ open class Bucket: Codable {
"allowedFileExtensions": allowedFileExtensions as Any,
"compression": compression as Any,
"encryption": encryption as Any,
"antivirus": antivirus as Any
"antivirus": antivirus as Any,
"transformations": transformations as Any
]
}
@@ -148,7 +157,8 @@ open class Bucket: Codable {
allowedFileExtensions: map["allowedFileExtensions"] as! [String],
compression: map["compression"] as! String,
encryption: map["encryption"] as! Bool,
antivirus: map["antivirus"] as! Bool
antivirus: map["antivirus"] as! Bool,
transformations: map["transformations"] as! Bool
)
}
}
+36
View File
@@ -0,0 +1,36 @@
import Appwrite
import AppwriteEnums
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setSession("") // The user session to authenticate with
let avatars = Avatars(client)
let bytes = try await avatars.getScreenshot(
url: "https://example.com",
headers: [
"Authorization": "Bearer token123",
"X-Custom-Header": "value"
], // optional
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: .light, // optional
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional
fullpage: true, // optional
locale: "en-US", // optional
timezone: .africaAbidjan, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
touch: true, // optional
permissions: ["geolocation","notifications"], // optional
sleep: 3, // optional
width: 800, // optional
height: 600, // optional
quality: 85, // optional
output: .jpg // optional
)
@@ -1,4 +1,5 @@
import Appwrite
import AppwriteEnums
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -12,7 +13,8 @@ let deployment = try await functions.createTemplateDeployment(
repository: "<REPOSITORY>",
owner: "<OWNER>",
rootDirectory: "<ROOT_DIRECTORY>",
version: "<VERSION>",
type: .commit,
reference: "<REFERENCE>",
activate: false // optional
)
@@ -1,4 +1,5 @@
import Appwrite
import AppwriteEnums
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -12,7 +13,8 @@ let deployment = try await sites.createTemplateDeployment(
repository: "<REPOSITORY>",
owner: "<OWNER>",
rootDirectory: "<ROOT_DIRECTORY>",
version: "<VERSION>",
type: .branch,
reference: "<REFERENCE>",
activate: false // optional
)
+2 -1
View File
@@ -18,6 +18,7 @@ let bucket = try await storage.createBucket(
allowedFileExtensions: [], // optional
compression: .none, // optional
encryption: false, // optional
antivirus: false // optional
antivirus: false, // optional
transformations: false // optional
)
+2 -1
View File
@@ -18,6 +18,7 @@ let bucket = try await storage.updateBucket(
allowedFileExtensions: [], // optional
compression: .none, // optional
encryption: false, // optional
antivirus: false // optional
antivirus: false, // optional
transformations: false // optional
)