Class: Appwrite::Users

Inherits:
Service show all
Defined in:
lib/appwrite/services/users.rb

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Appwrite::Service

Instance Method Details

#create_user(email:, password:, name: '') ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/appwrite/services/users.rb', line 19

def create_user(email:, password:, name: '')
    path = '/users'

    params = {
        'email': email, 
        'password': password, 
        'name': name
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end

#delete_user_session(user_id:, session_id:) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/appwrite/services/users.rb', line 106

def delete_user_session(user_id:, session_id:)
    path = '/users/{userId}/sessions/:session'
        .gsub('{user_id}', user_id)

    params = {
        'sessionId': session_id
    }

    return @client.call('delete', path, {
        'content-type' => 'application/json',
    }, params);
end

#delete_user_sessions(user_id:) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/appwrite/services/users.rb', line 94

def delete_user_sessions(user_id:)
    path = '/users/{userId}/sessions'
        .gsub('{user_id}', user_id)

    params = {
    }

    return @client.call('delete', path, {
        'content-type' => 'application/json',
    }, params);
end

#get_user(user_id:) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/appwrite/services/users.rb', line 33

def get_user(user_id:)
    path = '/users/{userId}'
        .gsub('{user_id}', user_id)

    params = {
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#get_user_logs(user_id:) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/appwrite/services/users.rb', line 45

def get_user_logs(user_id:)
    path = '/users/{userId}/logs'
        .gsub('{user_id}', user_id)

    params = {
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#get_user_prefs(user_id:) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/appwrite/services/users.rb', line 57

def get_user_prefs(user_id:)
    path = '/users/{userId}/prefs'
        .gsub('{user_id}', user_id)

    params = {
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#get_user_sessions(user_id:) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/appwrite/services/users.rb', line 82

def get_user_sessions(user_id:)
    path = '/users/{userId}/sessions'
        .gsub('{user_id}', user_id)

    params = {
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#list_users(search: '', limit: 25, offset: 0, order_type: 'ASC') ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/appwrite/services/users.rb', line 4

def list_users(search: '', limit: 25, offset: 0, order_type: 'ASC')
    path = '/users'

    params = {
        'search': search, 
        'limit': limit, 
        'offset': offset, 
        'orderType': order_type
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#update_user_prefs(user_id:, prefs:) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/appwrite/services/users.rb', line 69

def update_user_prefs(user_id:, prefs:)
    path = '/users/{userId}/prefs'
        .gsub('{user_id}', user_id)

    params = {
        'prefs': prefs
    }

    return @client.call('patch', path, {
        'content-type' => 'application/json',
    }, params);
end

#update_user_status(user_id:, status:) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/appwrite/services/users.rb', line 119

def update_user_status(user_id:, status:)
    path = '/users/{userId}/status'
        .gsub('{user_id}', user_id)

    params = {
        'status': status
    }

    return @client.call('patch', path, {
        'content-type' => 'application/json',
    }, params);
end