diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c40a5..7f4141c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 13.5.0 + +* Add `getScreenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums + ## 13.4.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance diff --git a/README.md b/README.md index d734a03..a48b205 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "13.4.0"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "13.5.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 432c3df..26ae339 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -5,6 +5,7 @@ import NIOSSL import Foundation import AsyncHTTPClient @_exported import AppwriteModels +@_exported import JSONCodable let DASHDASH = "--" let CRLF = "\r\n" @@ -23,7 +24,7 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "13.4.0", + "x-sdk-version": "13.5.0", "x-appwrite-response-format": "1.8.0" ] diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index 9acfaf2..b250ad2 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -290,5 +290,96 @@ 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"] + ] + + return try await client.call( + method: "GET", + path: apiPath, + params: apiParams + ) + } + } \ No newline at end of file diff --git a/Sources/Appwrite/Services/TablesDb.swift b/Sources/Appwrite/Services/TablesDB.swift similarity index 100% rename from Sources/Appwrite/Services/TablesDb.swift rename to Sources/Appwrite/Services/TablesDB.swift diff --git a/Sources/AppwriteEnums/Output.swift b/Sources/AppwriteEnums/Output.swift new file mode 100644 index 0000000..c8d245f --- /dev/null +++ b/Sources/AppwriteEnums/Output.swift @@ -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 + } +} diff --git a/Sources/AppwriteEnums/Theme.swift b/Sources/AppwriteEnums/Theme.swift new file mode 100644 index 0000000..4b42ad8 --- /dev/null +++ b/Sources/AppwriteEnums/Theme.swift @@ -0,0 +1,10 @@ +import Foundation + +public enum Theme: String, CustomStringConvertible { + case light = "light" + case dark = "dark" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/Timezone.swift b/Sources/AppwriteEnums/Timezone.swift new file mode 100644 index 0000000..05d0367 --- /dev/null +++ b/Sources/AppwriteEnums/Timezone.swift @@ -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 + } +} diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md new file mode 100644 index 0000000..7f4ef5d --- /dev/null +++ b/docs/examples/avatars/get-screenshot.md @@ -0,0 +1,32 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getScreenshot( + url: "https://example.com", + headers: [:], // optional + viewportWidth: 1, // optional + viewportHeight: 1, // optional + scale: 0.1, // optional + theme: .light, // optional + userAgent: "", // optional + fullpage: false, // optional + locale: "", // optional + timezone: .africaAbidjan, // optional + latitude: -90, // optional + longitude: -180, // optional + accuracy: 0, // optional + touch: false, // optional + permissions: [], // optional + sleep: 0, // optional + width: 0, // optional + height: 0, // optional + quality: -1, // optional + output: .jpg // optional +) +