@@ -290,5 +290,96 @@ open class Avatars: Service {
290290 )
291291 }
292292
293+ ///
294+ /// Use this endpoint to capture a screenshot of any website URL. This endpoint
295+ /// uses a headless browser to render the webpage and capture it as an image.
296+ ///
297+ /// You can configure the browser viewport size, theme, user agent,
298+ /// geolocation, permissions, and more. Capture either just the viewport or the
299+ /// full page scroll.
300+ ///
301+ /// When width and height are specified, the image is resized accordingly. If
302+ /// both dimensions are 0, the API provides an image at original size. If
303+ /// dimensions are not specified, the default viewport size is 1280x720px.
304+ ///
305+ /// - Parameters:
306+ /// - url: String
307+ /// - headers: Any (optional)
308+ /// - viewportWidth: Int (optional)
309+ /// - viewportHeight: Int (optional)
310+ /// - scale: Double (optional)
311+ /// - theme: AppwriteEnums.Theme (optional)
312+ /// - userAgent: String (optional)
313+ /// - fullpage: Bool (optional)
314+ /// - locale: String (optional)
315+ /// - timezone: AppwriteEnums.Timezone (optional)
316+ /// - latitude: Double (optional)
317+ /// - longitude: Double (optional)
318+ /// - accuracy: Double (optional)
319+ /// - touch: Bool (optional)
320+ /// - permissions: [String] (optional)
321+ /// - sleep: Int (optional)
322+ /// - width: Int (optional)
323+ /// - height: Int (optional)
324+ /// - quality: Int (optional)
325+ /// - output: AppwriteEnums.Output (optional)
326+ /// - Throws: Exception if the request fails
327+ /// - Returns: ByteBuffer
328+ ///
329+ open func getScreenshot(
330+ url: String ,
331+ headers: Any ? = nil ,
332+ viewportWidth: Int ? = nil ,
333+ viewportHeight: Int ? = nil ,
334+ scale: Double ? = nil ,
335+ theme: AppwriteEnums . Theme ? = nil ,
336+ userAgent: String ? = nil ,
337+ fullpage: Bool ? = nil ,
338+ locale: String ? = nil ,
339+ timezone: AppwriteEnums . Timezone ? = nil ,
340+ latitude: Double ? = nil ,
341+ longitude: Double ? = nil ,
342+ accuracy: Double ? = nil ,
343+ touch: Bool ? = nil ,
344+ permissions: [ String ] ? = nil ,
345+ sleep: Int ? = nil ,
346+ width: Int ? = nil ,
347+ height: Int ? = nil ,
348+ quality: Int ? = nil ,
349+ output: AppwriteEnums . Output ? = nil
350+ ) async throws -> ByteBuffer {
351+ let apiPath : String = " /avatars/screenshots "
352+
353+ let apiParams : [ String : Any ? ] = [
354+ " url " : url,
355+ " headers " : headers,
356+ " viewportWidth " : viewportWidth,
357+ " viewportHeight " : viewportHeight,
358+ " scale " : scale,
359+ " theme " : theme,
360+ " userAgent " : userAgent,
361+ " fullpage " : fullpage,
362+ " locale " : locale,
363+ " timezone " : timezone,
364+ " latitude " : latitude,
365+ " longitude " : longitude,
366+ " accuracy " : accuracy,
367+ " touch " : touch,
368+ " permissions " : permissions,
369+ " sleep " : sleep,
370+ " width " : width,
371+ " height " : height,
372+ " quality " : quality,
373+ " output " : output,
374+ " project " : client. config [ " project " ]
375+ ]
376+
377+ return try await client. call (
378+ method: " GET " ,
379+ path: apiPath,
380+ params: apiParams
381+ )
382+ }
383+
293384
294385}
0 commit comments