Class: Appwrite::Activities

Inherits:
Service
  • Object
show all
Defined in:
lib/appwrite/services/activities.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Activities

Returns a new instance of Activities.



5
6
7
# File 'lib/appwrite/services/activities.rb', line 5

def initialize(client)
    @client = client
end

Instance Method Details

#get_event(event_id:) ⇒ ActivityEvent

Get event by ID.

Parameters:

  • event_id (String) —

    Event ID.

Returns:

  • (ActivityEvent)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/appwrite/services/activities.rb', line 46

def get_event(
    event_id:
)
    if event_id.nil? || event_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "eventId"')
    end

    api_path = '/activities/events/{eventId}'
        .gsub('{eventId}', @client.encode_path(event_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::ActivityEvent
    )
end

#list_events(queries: nil, total: nil) ⇒ ActivityEventList

List all events for selected filters.

Parameters:

  • queries (Array) (defaults to: nil) —

    Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc.

  • [] —

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (ActivityEventList)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/appwrite/services/activities.rb', line 15

def list_events(
    queries: nil,
    total: nil
)
    api_path = '/activities/events'

    api_params = {
        queries: queries,
        total: total,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::ActivityEventList
    )
end