mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-02 11:58:14 -05:00
Compare commits
6 Commits
0.31
...
deployed_0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a115557b3 | ||
|
|
14c2d7d9e8 | ||
|
|
4a7a759cea | ||
|
|
da8da24b01 | ||
|
|
ccbb13e685 | ||
|
|
a3ca815975 |
56
README.md
56
README.md
@@ -1,24 +1,52 @@
|
|||||||
# Galaxy python plugin API
|
# GOG Galaxy - Community Integration - Python API
|
||||||
|
|
||||||
## Usage
|
This document is still work in progress.
|
||||||
|
|
||||||
Implement plugin:
|
## Basic Usage
|
||||||
|
|
||||||
|
Basic implementation:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import asyncio
|
import sys
|
||||||
from galaxy.api.plugin import Plugin
|
from galaxy.api.plugin import Plugin, create_and_run_plugin
|
||||||
|
from galaxy.api.consts import Platform
|
||||||
|
|
||||||
class PluginExample(Plugin):
|
class PluginExample(Plugin):
|
||||||
|
def __init__(self, reader, writer, token):
|
||||||
|
super().__init__(
|
||||||
|
Platform.Generic, # Choose platform from available list
|
||||||
|
"0.1", # Version
|
||||||
|
reader,
|
||||||
|
writer,
|
||||||
|
token
|
||||||
|
)
|
||||||
|
|
||||||
# implement methods
|
# implement methods
|
||||||
async def authenticate(self, stored_credentials=None):
|
async def authenticate(self, stored_credentials=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def main():
|
||||||
|
create_and_run_plugin(PluginExample, sys.argv)
|
||||||
|
|
||||||
# run plugin event loop
|
# run plugin event loop
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(MockPlugin().run())
|
main()
|
||||||
```
|
```
|
||||||
|
|
||||||
Use [pyinstaller](https://www.pyinstaller.org/) to create plugin executbale.
|
Plugin should be deployed with manifest:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "Example plugin",
|
||||||
|
"platform": "generic",
|
||||||
|
"guid": "UNIQUE-GUID",
|
||||||
|
"version": "0.1",
|
||||||
|
"description": "Example plugin",
|
||||||
|
"author": "Name",
|
||||||
|
"email": "author@email.com",
|
||||||
|
"url": "https://github.com/user/galaxy-plugin-example",
|
||||||
|
"script": "plugin.py"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -31,15 +59,5 @@ Run tests:
|
|||||||
```bash
|
```bash
|
||||||
pytest
|
pytest
|
||||||
```
|
```
|
||||||
|
## Methods Documentation
|
||||||
## Changelog
|
TODO
|
||||||
|
|
||||||
### 0.21
|
|
||||||
* Add `Epic` platform.
|
|
||||||
### 0.16
|
|
||||||
* Do not log sensitive data.
|
|
||||||
* Return `LocalGameState` as int (possible combination of flags).
|
|
||||||
### 0.15
|
|
||||||
* `shutdown()` is called on socket disconnection.
|
|
||||||
### 0.14
|
|
||||||
* Added required version parameter to Plugin constructor.
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ stage('Upload to github')
|
|||||||
deleteDir()
|
deleteDir()
|
||||||
checkout scm
|
checkout scm
|
||||||
withPythonEnv('/usr/local/bin/python3.7') {
|
withPythonEnv('/usr/local/bin/python3.7') {
|
||||||
withCredentials([usernamePassword(credentialsId: 'github_friendsofgalaxy', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')]) {
|
withCredentials([string(credentialsId: 'github_goggalaxy', variable: 'GITHUB_TOKEN')]) {
|
||||||
sh 'pip install -r jenkins/requirements.txt'
|
sh 'pip install -r jenkins/requirements.txt'
|
||||||
def version = sh(returnStdout: true, script: 'python setup.py --version').trim()
|
def version = sh(returnStdout: true, script: 'python setup.py --version').trim()
|
||||||
sh "python jenkins/release.py $version"
|
sh "python jenkins/release.py $version"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from galaxy.github.exporter import transfer_repo
|
from galaxy.github.exporter import transfer_repo
|
||||||
|
|
||||||
GITHUB_USERNAME = "FriendsOfGalaxy"
|
GITHUB_USERNAME = "goggalaxy"
|
||||||
GITHUB_EMAIL = "friendsofgalaxy@gmail.com"
|
GITHUB_EMAIL = "galaxy-sdk@gog.com"
|
||||||
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
|
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
|
||||||
GITHUB_REPO_NAME = "galaxy-plugin-api"
|
GITHUB_REPO_NAME = "galaxy-integrations-python-api"
|
||||||
SOURCE_BRANCH = os.environ["GIT_REFSPEC"]
|
SOURCE_BRANCH = os.environ["GIT_REFSPEC"]
|
||||||
|
|
||||||
GITLAB_USERNAME = "galaxy-client"
|
GITLAB_USERNAME = "galaxy-client"
|
||||||
|
|||||||
Reference in New Issue
Block a user