Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv/
build
convoy_python.egg-info
dist/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ An application represents a user's application trying to receive webhooks. Once
```python
appData = { "name": "my_app", "support_email": "support@myapp.com" }
(response, status) = convoy.applications.create({}, appData)
appId = response["data"]["uid"]
app_id = response["data"]["uid"]

```

Expand All @@ -61,7 +61,7 @@ endpointData = {
"events": ["*"],
}

(response, status) = convoy.endpoint.create(appId, {}, endpointData)
(response, status) = convoy.endpoint.create(app_id, {}, endpointData)
```

### Sending an Event
Expand All @@ -70,7 +70,7 @@ To send an event, you'll need the `uid` we created in the earlier section.

```python
eventData = {
"app_id": appId,
"app_id": app_id,
"event_type": "payment.success",
"data": {
"event": "payment.success",
Expand Down
30 changes: 15 additions & 15 deletions convoy/api/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ def __init__(self, config):
self.client = Client(config)

def all(self, query):
'''
"""
Get all applicaitons.
'''
response = self.client.httpGet("/applications", query)
"""
response = self.client.http_get("/applications", query)
return response

def create(self, query, data):
'''
"""
Create a new application.
Parameters
----------
data = {
"name": "",
"support_email": ""
}
'''
response = self.client.httpPost("/applications", query, data)
"""
response = self.client.http_post("/applications", query, data)
return response

def find(self, id, query):
'''
"""
Find a particular application.
'''
response = self.client.httpGet("/applications/%s" % (id), query)
"""
response = self.client.http_get("/applications/%s" % (id), query)
return response

def update(self, id, query, data):
'''
"""
Update an application.
Parameters
----------
data = {
"name": "",
"support_email": ""
}
'''
response = self.client.httpPut("/applications/%s" % id, query, data)
"""
response = self.client.http_put("/applications/%s" % id, query, data)
return response

def delete(self, id, query, data):
'''
"""
Delete an application.
'''
response = self.client.httpDelete("/applications/%s" % id, query, data)
"""
response = self.client.http_delete("/applications/%s" % id, query, data)
return response

8 changes: 4 additions & 4 deletions convoy/api/delivery_attempts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class DeliveryAttempt():
def __init__(self, config):
self.client = Client(config)

def all(self, eventdeliveryId, query):
response = self.client.httpGet("/eventdeliveries/%s/deliveryattempts" % eventdeliveryId, query)
def all(self, event_delivery_id, query):
response = self.client.http_get("/eventdeliveries/%s/deliveryattempts" % event_delivery_id, query)
return response

def find(self, eventdeliveryId, deliveryAttemptId, query):
response = self.client.httpGet("/eventdeliveries/%s/deliveryattempts/%s" % (eventdeliveryId, deliveryAttemptId), query)
def find(self, event_delivery_id, delivery_attempt_id, query):
response = self.client.http_get("/eventdeliveries/%s/deliveryattempts/%s" % (event_delivery_id, delivery_attempt_id), query)
return response

40 changes: 20 additions & 20 deletions convoy/api/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class Endpoint():
def __init__(self, config):
self.client = Client(config)

def all(self, appId, query):
'''
def all(self, app_id, query):
"""
Get all endpoints for an application.
'''
response = self.client.httpGet("/applications/%s/endpoints" % appId, query)
"""
response = self.client.http_get("/applications/%s/endpoints" % app_id, query)
return response

def create(self, appId, query, data):
'''
def create(self, app_id, query, data):
"""
Create a new endpoint.
Parameters
----------
Expand All @@ -28,19 +28,19 @@ def create(self, appId, query, data):
"secret": "",
"events": [],
}
'''
response = self.client.httpPost("/applications/%s/endpoints" % appId, query, data)
"""
response = self.client.http_post("/applications/%s/endpoints" % app_id, query, data)
return response

def find(self, appId, endpointId, query):
'''
def find(self, app_id, endpoint_id, query):
"""
Find a particular application.
'''
response = self.client.httpGet("/applications/%s/endpoints/%s" % (appId, endpointId), query)
"""
response = self.client.http_get("/applications/%s/endpoints/%s" % (app_id, endpoint_id), query)
return response

def update(self, appId, endpointId, query, data):
'''
def update(self, app_id, endpoint_id, query, data):
"""
Update an application.
Parameters
----------
Expand All @@ -50,14 +50,14 @@ def update(self, appId, endpointId, query, data):
"secret": "",
"events": [],
}
'''
response = self.client.httpPut("/applications/%s/endpoints/%s" % (appId, endpointId), query, data)
"""
response = self.client.http_put("/applications/%s/endpoints/%s" % (app_id, endpoint_id), query, data)
return response

def delete(self, appId, endpointId, query, data):
'''
def delete(self, app_id, endpoint_id, query, data):
"""
Delete an application.
'''
response = self.client.httpDelete("/applications/%s/endpoints/%s" % (appId, endpointId), query, data)
"""
response = self.client.http_delete("/applications/%s/endpoints/%s" % (app_id, endpoint_id), query, data)
return response

10 changes: 5 additions & 5 deletions convoy/api/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def __init__(self, config):
self.client = Client(config)

def all(self, query):
response = self.client.httpGet("/events", query)
response = self.client.http_get("/events", query)
return response

def create(self, query, data):
'''
"""
Create a new event.
Parameters
----------
Expand All @@ -27,11 +27,11 @@ def create(self, query, data):
"data": {},
}
}
'''
response = self.client.httpPost("/events", query, data)
"""
response = self.client.http_post("/events", query, data)
return response

def find(self, id, query):
response = self.client.httpGet("/events/%s" % id, query)
response = self.client.http_get("/events/%s" % id, query)
return response

24 changes: 12 additions & 12 deletions convoy/api/event_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ def __init__(self, config):
self.client = Client(config)

def all(self, query):
'''
"""
Get all eventdeliveries.
'''
response = self.client.httpGet("/eventdeliveries", query)
"""
response = self.client.http_get("/eventdeliveries", query)
return response

def find(self, id, query):
'''
"""
Find a particular eventdelivery.
'''
response = self.client.httpGet("/eventdeliveries/%s" % id, query)
"""
response = self.client.http_get("/eventdeliveries/%s" % id, query)
return response

def resend(self, id, query):
'''
"""
Resend an eventdelivery.
'''
response = self.client.httpPut("/eventdeliveries/%s/resend" % id, query, {})
"""
response = self.client.http_put("/eventdeliveries/%s/resend" % id, query, {})
return response

def batchresend(self, id, query, data):
'''
"""
Batch resend eventdeliveries.
Parameters
----------
data = {
ids: []
}
'''
response = self.client.httpPut("/eventdeliveries/batchretry" % id, query, data)
"""
response = self.client.http_put("/eventdeliveries/batchretry" % id, query, data)
return response

30 changes: 15 additions & 15 deletions convoy/api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def __init__(self, config):
self.client = Client(config)

def all(self, query):
'''
"""
Get all groups.
'''
response = self.client.httpGet("/groups", query)
"""
response = self.client.http_get("/groups", query)
return response

def create(self, query, data):
'''
"""
Create a new group.
Parameters
----------
Expand All @@ -40,19 +40,19 @@ def create(self, query, data):
},
},
}
'''
response = self.client.httpPost("/groups", query, data)
"""
response = self.client.http_post("/groups", query, data)
return response

def find(self, id, query):
'''
"""
Find a particular group.
'''
response = self.client.httpGet("/groups/%s" % id, query)
"""
response = self.client.http_get("/groups/%s" % id, query)
return response

def update(self, id, query, data):
'''
"""
Update a group.
Parameters
----------
Expand All @@ -74,14 +74,14 @@ def update(self, id, query, data):
},
},
}
'''
response = self.client.httpPut("/groups/%s" % id, query, data)
"""
response = self.client.http_put("/groups/%s" % id, query, data)
return response

def delete(self, id, query, data):
'''
"""
Delete a group.
'''
response = self.client.httpDelete("/groups/%s" % id, query, data)
"""
response = self.client.http_delete("/groups/%s" % id, query, data)
return response

Loading