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(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(name:, roles: ["owner"])
    path = '/teams'

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

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

#create_membership(team_id:, email:, roles:, url:, 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_membership(team_id:, email:, roles:, url:, name: '')
    path = '/teams/{teamId}/memberships'
        .gsub('{teamId}', team_id)

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

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

#delete(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_id:)
    path = '/teams/{teamId}'
        .gsub('{teamId}', team_id)

    params = {
    }

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

#delete_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_membership(team_id:, invite_id:)
    path = '/teams/{teamId}/memberships/{inviteId}'
        .gsub('{teamId}', team_id)
        .gsub('{inviteId}', invite_id)

    params = {
    }

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

#get(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_id:)
    path = '/teams/{teamId}'
        .gsub('{teamId}', team_id)

    params = {
    }

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

#get_memberships(team_id:) ⇒ Object



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

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

    params = {
    }

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

#list(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(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_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_id:, name:)
    path = '/teams/{teamId}'
        .gsub('{teamId}', team_id)

    params = {
        'name': name
    }

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