Compare commits
5 Commits
v0.9.0
...
invite-urls
| Author | SHA1 | Date | |
|---|---|---|---|
| c3ae5b3c76 | |||
| d02ab15d3f | |||
| 9a8641e596 | |||
| 802f018519 | |||
| be74c4e5b7 |
@@ -0,0 +1,23 @@
|
||||
name: Tests
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
name: Test on Python ${{ matrix.py_version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
py_version: [2.7, 3.5, 3.6, 3.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python ${{ matrix.py_version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.py_version }}
|
||||
- name: Install mock for Python 2.7
|
||||
run: pip install mock
|
||||
- name: Run tests
|
||||
run: python setup.py test
|
||||
+5
-2
@@ -69,5 +69,8 @@ Once running you can access the Discourse install at http://localhost:4000.
|
||||
TODO
|
||||
====
|
||||
|
||||
Refer to, https://github.com/discourse/discourse_api/blob/master/routes.txt for
|
||||
a list of all operations available in Discourse.
|
||||
For a list of all operations:
|
||||
|
||||
you can just run rake routes inside of the discourse repo to get an up to date list
|
||||
|
||||
Or check the old [`routes.txt`](https://github.com/discourse/discourse_api/blob/aa75df6cd851f0666f9e8071c4ef9dfdd39fc8f8/routes.txt) file, though this is certainly outdated.
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
pydiscourse
|
||||
===========
|
||||
|
||||
.. image:: https://secure.travis-ci.org/bennylope/pydiscourse.svg?branch=master
|
||||
.. image:: https://github.com/bennylope/pydiscourse/workflows/Tests/badge.svg
|
||||
:alt: Build Status
|
||||
:target: http://travis-ci.org/bennylope/pydiscourse
|
||||
:target: https://github.com/bennylope/pydiscourse/actions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Check%20out%20the-Docs-blue.svg
|
||||
:alt: Check out the Docs
|
||||
|
||||
@@ -84,6 +84,50 @@ class DiscourseClient(object):
|
||||
"""
|
||||
return self._get("/admin/users/{0}.json".format(user_id))
|
||||
|
||||
def invite(self, email, group_names, custom_message, **kwargs):
|
||||
"""
|
||||
Invite a user by email to join your forum
|
||||
|
||||
Args:
|
||||
email: their email, will be used for activation and summary emails
|
||||
group_names: the group names
|
||||
custom_message: message to include
|
||||
**kwargs: ???? what else can be sent through?
|
||||
|
||||
Returns:
|
||||
API response body (dict)
|
||||
|
||||
"""
|
||||
return self._post(
|
||||
"/invites",
|
||||
email=email,
|
||||
group_names=group_names,
|
||||
custom_message=custom_message,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def invite_link(self, email, group_names, custom_message, **kwargs):
|
||||
"""
|
||||
Generate an invite link for a user to join your forum
|
||||
|
||||
Args:
|
||||
email: their email, will be used for activation and summary emails
|
||||
group_names: the group names
|
||||
custom_message: message to include
|
||||
**kwargs: ???? what else can be sent through?
|
||||
|
||||
Returns:
|
||||
Invite link
|
||||
|
||||
"""
|
||||
return self._post(
|
||||
"/invites/link",
|
||||
email=email,
|
||||
group_names=group_names,
|
||||
custom_message=custom_message,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def create_user(self, name, username, email, password, **kwargs):
|
||||
"""
|
||||
Create a Discourse user
|
||||
@@ -1303,6 +1347,7 @@ class DiscourseClient(object):
|
||||
params: dictionary of parameters to include to the API
|
||||
|
||||
Returns:
|
||||
dictionary of response body data or None
|
||||
|
||||
"""
|
||||
params["api_key"] = self.api_key
|
||||
|
||||
@@ -34,15 +34,16 @@ setup(
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Development Status :: 5 - Production/Stable"
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
'Programming Language :: Python :: Implementation :: PyPy',
|
||||
],
|
||||
zip_safe=False,
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import sys
|
||||
import unittest
|
||||
import mock
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from pydiscourse import client
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3,):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user