-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdc_component.py
59 lines (51 loc) · 2.63 KB
/
dc_component.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import edgee_world.data_collection.exports as exports
import edgee_world.data_collection.exports.data_collection as data_collection
from edgee_world.data_collection.types import *
'''
This is the main class that you will need to implement. It should inherit from
edgee_world.data_collection.exports.Provider and implement the following methods:
page, track, user
'''
class DataCollection(exports.DataCollection):
'''
The page method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send page data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def page(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
'''
settings is a list of tuple, which contains each key and value for the provider
for example, if your component define this setting:
[component.settings.example]
title = "Example Config Field"
type = "string"
settings will be [("example", "value")], so you can access its value as follows:
example_value = dict(settings)['example']
'''
'''
the function should return the following:
return provider.EdgeeRequest(
method=provider.HttpMethod.GET,
url="https://yourwebsite.com",
headers={},
forward_client_headers=true,
body="")
'''
raise NotImplementedError("page is not implemented")
'''
The track method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send track data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def track(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
raise NotImplementedError("track is not implemented")
'''
The user method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send user data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def user(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
raise NotImplementedError("user is not implemented")