@@ -303,182 +303,6 @@ open class Account: Service {
303303 )
304304 }
305305
306- ///
307- /// Get a list of all API keys from the current account.
308- ///
309- /// - Parameters:
310- /// - total: Bool (optional)
311- /// - Throws: Exception if the request fails
312- /// - Returns: AppwriteModels.KeyList
313- ///
314- open func listKeys(
315- total: Bool ? = nil
316- ) async throws -> AppwriteModels . KeyList {
317- let apiPath : String = " /account/keys "
318-
319- let apiParams : [ String : Any ? ] = [
320- " total " : total
321- ]
322-
323- let apiHeaders : [ String : String ] = [ : ]
324-
325- let converter : ( Any ) -> AppwriteModels . KeyList = { response in
326- return AppwriteModels . KeyList. from ( map: response as! [ String : Any ] )
327- }
328-
329- return try await client. call (
330- method: " GET " ,
331- path: apiPath,
332- headers: apiHeaders,
333- params: apiParams,
334- converter: converter
335- )
336- }
337-
338- ///
339- /// Create a new account API key.
340- ///
341- /// - Parameters:
342- /// - name: String
343- /// - scopes: [AppwriteEnums.Scopes]
344- /// - expire: String (optional)
345- /// - Throws: Exception if the request fails
346- /// - Returns: AppwriteModels.Key
347- ///
348- open func createKey(
349- name: String ,
350- scopes: [ AppwriteEnums . Scopes ] ,
351- expire: String ? = nil
352- ) async throws -> AppwriteModels . Key {
353- let apiPath : String = " /account/keys "
354-
355- let apiParams : [ String : Any ? ] = [
356- " name " : name,
357- " scopes " : scopes,
358- " expire " : expire
359- ]
360-
361- let apiHeaders : [ String : String ] = [
362- " content-type " : " application/json "
363- ]
364-
365- let converter : ( Any ) -> AppwriteModels . Key = { response in
366- return AppwriteModels . Key. from ( map: response as! [ String : Any ] )
367- }
368-
369- return try await client. call (
370- method: " POST " ,
371- path: apiPath,
372- headers: apiHeaders,
373- params: apiParams,
374- converter: converter
375- )
376- }
377-
378- ///
379- /// Get a key by its unique ID. This endpoint returns details about a specific
380- /// API key in your account including it's scopes.
381- ///
382- /// - Parameters:
383- /// - keyId: String
384- /// - Throws: Exception if the request fails
385- /// - Returns: AppwriteModels.Key
386- ///
387- open func getKey(
388- keyId: String
389- ) async throws -> AppwriteModels . Key {
390- let apiPath : String = " /account/keys/{keyId} "
391- . replacingOccurrences ( of: " {keyId} " , with: keyId)
392-
393- let apiParams : [ String : Any ] = [ : ]
394-
395- let apiHeaders : [ String : String ] = [ : ]
396-
397- let converter : ( Any ) -> AppwriteModels . Key = { response in
398- return AppwriteModels . Key. from ( map: response as! [ String : Any ] )
399- }
400-
401- return try await client. call (
402- method: " GET " ,
403- path: apiPath,
404- headers: apiHeaders,
405- params: apiParams,
406- converter: converter
407- )
408- }
409-
410- ///
411- /// Update a key by its unique ID. Use this endpoint to update the name,
412- /// scopes, or expiration time of an API key.
413- ///
414- /// - Parameters:
415- /// - keyId: String
416- /// - name: String
417- /// - scopes: [AppwriteEnums.Scopes]
418- /// - expire: String (optional)
419- /// - Throws: Exception if the request fails
420- /// - Returns: AppwriteModels.Key
421- ///
422- open func updateKey(
423- keyId: String ,
424- name: String ,
425- scopes: [ AppwriteEnums . Scopes ] ,
426- expire: String ? = nil
427- ) async throws -> AppwriteModels . Key {
428- let apiPath : String = " /account/keys/{keyId} "
429- . replacingOccurrences ( of: " {keyId} " , with: keyId)
430-
431- let apiParams : [ String : Any ? ] = [
432- " name " : name,
433- " scopes " : scopes,
434- " expire " : expire
435- ]
436-
437- let apiHeaders : [ String : String ] = [
438- " content-type " : " application/json "
439- ]
440-
441- let converter : ( Any ) -> AppwriteModels . Key = { response in
442- return AppwriteModels . Key. from ( map: response as! [ String : Any ] )
443- }
444-
445- return try await client. call (
446- method: " PUT " ,
447- path: apiPath,
448- headers: apiHeaders,
449- params: apiParams,
450- converter: converter
451- )
452- }
453-
454- ///
455- /// Delete a key by its unique ID. Once deleted, the key can no longer be used
456- /// to authenticate API calls.
457- ///
458- /// - Parameters:
459- /// - keyId: String
460- /// - Throws: Exception if the request fails
461- /// - Returns: Any
462- ///
463- open func deleteKey(
464- keyId: String
465- ) async throws -> Any {
466- let apiPath : String = " /account/keys/{keyId} "
467- . replacingOccurrences ( of: " {keyId} " , with: keyId)
468-
469- let apiParams : [ String : Any ] = [ : ]
470-
471- let apiHeaders : [ String : String ] = [
472- " content-type " : " application/json "
473- ]
474-
475- return try await client. call (
476- method: " DELETE " ,
477- path: apiPath,
478- headers: apiHeaders,
479- params: apiParams )
480- }
481-
482306 ///
483307 /// Get the list of latest security activity logs for the currently logged in
484308 /// user. Each log returns user IP address, location and date and time of log.
0 commit comments