Class: Appwrite::Teams

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

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Appwrite::Service

Instance Method Details

#create_team(name:, roles: ["owner"]) ⇒ Object



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

def create_team(name:, roles: ["owner"])
    path = '/teams'

    params = {
        'name': name, 
        'roles': roles
    }

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

#create_team_membership(team_id:, email:, roles:, redirect:, name: '') ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/appwrite/services/teams.rb', line 81

def create_team_membership(team_id:, email:, roles:, redirect:, name: '')
    path = '/teams/{teamId}/memberships'
        .gsub('{team_id}', team_id)

    params = {
        'email': email, 
        'name': name, 
        'roles': roles, 
        'redirect': redirect
    }

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

#create_team_membership_resend(team_id:, invite_id:, redirect:) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/appwrite/services/teams.rb', line 110

def create_team_membership_resend(team_id:, invite_id:, redirect:)
    path = '/teams/{teamId}/memberships/{inviteId}/resend'
        .gsub('{team_id}', team_id)
        .gsub('{invite_id}', invite_id)

    params = {
        'redirect': redirect
    }

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

#delete_team(team_id:) ⇒ Object



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

def delete_team(team_id:)
    path = '/teams/{teamId}'
        .gsub('{team_id}', team_id)

    params = {
    }

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

#delete_team_membership(team_id:, invite_id:) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/appwrite/services/teams.rb', line 97

def delete_team_membership(team_id:, invite_id:)
    path = '/teams/{teamId}/memberships/{inviteId}'
        .gsub('{team_id}', team_id)
        .gsub('{invite_id}', invite_id)

    params = {
    }

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

#get_team(team_id:) ⇒ Object



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

def get_team(team_id:)
    path = '/teams/{teamId}'
        .gsub('{team_id}', team_id)

    params = {
    }

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

#get_team_members(team_id:) ⇒ Object



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

def get_team_members(team_id:)
    path = '/teams/{teamId}/members'
        .gsub('{team_id}', team_id)

    params = {
    }

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

#list_teams(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/teams.rb', line 4

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

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

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

#update_team(team_id:, name:) ⇒ Object



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

def update_team(team_id:, name:)
    path = '/teams/{teamId}'
        .gsub('{team_id}', team_id)

    params = {
        'name': name
    }

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

#update_team_membership_status(team_id:, invite_id:, user_id:, secret:, success: '', failure: '') ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/appwrite/services/teams.rb', line 124

def update_team_membership_status(team_id:, invite_id:, user_id:, secret:, success: '', failure: '')
    path = '/teams/{teamId}/memberships/{inviteId}/status'
        .gsub('{team_id}', team_id)
        .gsub('{invite_id}', invite_id)

    params = {
        'userId': user_id, 
        'secret': secret, 
        'success': success, 
        'failure': failure
    }

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