GitHub Utils (Independent Publisher) (#2583)

* Added connector

* Updated parameters and formatting

* Updated securityDefinitions & security

* Fixed parameters

* Updated connector metadata, contact & description

---------

Co-authored-by: Daniel Laskewitz <daniel.laskewitz@microsoft.com>
This commit is contained in:
Daniel Laskewitz 2023-04-26 17:47:12 +02:00 коммит произвёл GitHub
Родитель d709bf348b
Коммит 68ea10d58b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 584 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,43 @@
# GitHub Utils
The GitHub Utils connector has a bunch of actions in there that can help you with certain topics that you can encounter. For instance, it's possible to get information about licenses and code of conducts, to convert markdown to HTML and much more!
## Publisher: Daniel Laskewitz
## Pre-requisites
None
## Supported Operations
The connector supports the following operations:
### Render a Markdown document
Render a markdown document as an HTML page or as raw text.
### Render a Markdown document in raw mode
Render a Markdown document in raw mode.
### Get All API versions
Get all supported GitHub API versions.
### Get the Zen of GitHub
Get a random sentence from the Zen of GitHub.
### Get All Commonly Used Licenses
Get all commonly used licenses.
### Get a license
Get information about a specific license.
### Get all codes of conduct
Get all codes of conduct.
### Get a code of conduct
Get information about a specific code of conduct.
### Deploying the sample
Run the following commands and follow the prompts:
```paconn
paconn create --api-def apiDefinition.swagger.json --api-prop apiProperties.json
```

Просмотреть файл

@ -0,0 +1,531 @@
{
"swagger": "2.0",
"info": {
"title": "GitHub Utils",
"description": "The GitHub Utils connector has a bunch of actions in there that can help you with certain topics that you can encounter. For instance, it's possible to get information about licenses and code of conducts, to convert markdown to HTML and much more!",
"version": "1.0",
"contact": {
"name": "Daniel Laskewitz",
"url": "https://youtube.com/daniellaskewitz",
"email": "connectorsupport@laskewitz.io"
}
},
"x-ms-connector-metadata": [
{
"propertyName": "Website",
"propertyValue": "https://docs.github.com/en/rest?apiVersion=2022-11-28"
},
{
"propertyName": "Privacy policy",
"propertyValue": "https://docs.github.com/en/github/site-policy/github-privacy-statement"
},
{
"propertyName": "Categories",
"propertyValue": "Content and Files"
}
],
"host": "api.github.com",
"basePath": "/",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/markdown": {
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string",
"format": "byte"
}
}
},
"summary": "Render a Markdown document",
"description": "Render a markdown document as an HTML page or as raw text.",
"operationId": "PostMarkdown",
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
},
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The Markdown text to render in HTML.",
"title": "Text",
"x-ms-visibility": "important"
},
"mode": {
"type": "string",
"description": "The rendering mode.",
"title": "Mode",
"x-ms-visibility": "advanced",
"default": "markdown",
"enum": [
"markdown",
"gfm"
]
},
"context": {
"type": "string",
"description": "The repository context to use when creating references in gfm mode. For example, setting context to octo-org/octo-repo will change the text #42 into an HTML link to issue 42 in the octo-org/octo-repo repository.",
"title": "Context",
"x-ms-visibility": "advanced"
}
},
"required": [
"text"
]
}
}
]
}
},
"/markdown/raw": {
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
},
"summary": "Render a Markdown document in raw mode",
"description": "Render a Markdown document in raw mode.",
"operationId": "PostMarkdownRaw",
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
},
{
"name": "Content-Type",
"in": "header",
"required": true,
"type": "string",
"default": "text/x-markdown",
"description": "Use a text/plain or text/x-markdown",
"x-ms-summary": "Content-Type",
"enum": [
"text/plain",
"text/x-markdown"
],
"x-ms-visibility": "advanced"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
]
}
},
"/versions": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"summary": "Get All API versions",
"operationId": "GetVersions",
"description": "Get all supported GitHub API versions.",
"x-ms-visibility": "advanced",
"parameters": [
{
"$ref": "#/parameters/Accept"
}
]
}
},
"/zen": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
},
"summary": "Get the Zen of GitHub",
"description": "Get a random sentence from the Zen of GitHub.",
"operationId": "GetZen",
"x-ms-visibility": "advanced",
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
}
]
}
},
"/licenses": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/License"
}
}
}
},
"summary": "Get All Commonly Used Licenses",
"description": "Get all commonly used licenses.",
"operationId": "GetLicenses",
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/Page"
},
{
"$ref": "#/parameters/Per-Page"
},
{
"$ref": "#/parameters/Featured"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
}
]
}
},
"/licenses/{license}": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/License_Advanced"
}
}
},
"summary": "Get a license",
"description": "Get information about a specific license.",
"operationId": "GetLicense",
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
},
{
"$ref": "#/parameters/License"
}
]
}
},
"/codes_of_conduct": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Code_Of_Conducts"
}
}
},
"parameters": [
{
"$ref": "#/parameters/Accept"
},
{
"$ref": "#/parameters/X-GitHub-Api-Version"
}
],
"summary": "Get all codes of conduct",
"description": "Get all codes of conduct.",
"operationId": "GetCodesOfConduct",
"x-ms-visibility": "important"
}
},
"/codes_of_conduct/{code_of_conduct}": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Code_Of_Conduct"
}
}
},
"summary": "Get a code of conduct",
"description": "Get information about a specific code of conduct.",
"operationId": "GetCodeOfConduct",
"x-ms-visibility": "important",
"parameters": [
{
"$ref": "#/parameters/X-GitHub-Api-Version"
},
{
"$ref": "#/parameters/Code_Of_Conduct"
}
]
}
}
},
"definitions": {
"Code_Of_Conduct": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The key of the code of conduct.",
"title": "Code of conduct Key"
},
"name": {
"type": "string",
"description": "The name of the code of conduct.",
"title": "Code of Conduct Name"
},
"html_url": {
"type": "string",
"description": "The HTML URL of the code of conduct.",
"title": "Code of Conduct HTML URL"
},
"url": {
"type": "string",
"description": "The API URL of the code of conduct.",
"title": "Code of Conduct API URL"
},
"body": {
"type": "string",
"description": "The body in markdown of the code of conduct.",
"title": "Code of Conduct Body"
}
}
},
"Code_Of_Conducts": {
"type": "array",
"items": {
"$ref": "#/definitions/Code_Of_Conduct"
}
},
"License": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The key of the license.",
"title": "License Key"
},
"name": {
"type": "string",
"description": "Name of the license.",
"title": "License Name"
},
"spdx_id": {
"type": "string",
"description": "SPDX ID of the license.",
"title": "License SPDX ID"
},
"url": {
"type": "string",
"description": "URL of the license.",
"title": "License URL"
},
"node_id": {
"type": "string",
"description": "Node ID of the license.",
"title": "License Node ID"
}
}
},
"License_Advanced": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The key of the license.",
"title": "License Key"
},
"name": {
"type": "string",
"description": "The name of the license.",
"title": "License Name"
},
"spdx_id": {
"type": "string",
"description": "The SPDX ID of the license.",
"title": "License SPDX ID"
},
"node_id": {
"type": "string",
"description": "The node ID of the license.",
"title": "License Node ID"
},
"html_url": {
"type": "string",
"description": "The HTML URL of the license."
},
"description": {
"type": "string",
"description": "Short description of the license.",
"title": "License Description"
},
"implementation": {
"type": "string",
"description": "The implementation of the license.",
"title": "License Implementation"
},
"permissions": {
"type": "array",
"items": {
"type": "string"
},
"description": "The permissions of the license.",
"title": "License Permissions"
},
"conditions": {
"type": "array",
"items": {
"type": "string"
},
"description": "The conditions of the license.",
"title": "License Conditions"
},
"limitations": {
"type": "array",
"items": {
"type": "string"
},
"description": "The limitations of the license.",
"title": "License Limitations"
},
"body": {
"type": "string",
"description": "Long description of the license.",
"title": "License Long Description"
}
}
}
},
"parameters": {
"Code_Of_Conduct": {
"name": "code_of_conduct",
"in": "path",
"required": true,
"type": "string",
"x-ms-summary": "Code Of Conduct",
"description": "Select a code of conduct.",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "GetCodesOfConduct",
"value-path": "key",
"value-title": "name",
"parameters": {
"accept": "application/vnd.github\u002Bjson",
"X-GitHub-Api-Version": "2022-11-28"
}
}
},
"Featured": {
"name": "featured",
"in": "query",
"required": false,
"type": "boolean",
"x-ms-summary": "Featured",
"description": "Whether the license is featured or not."
},
"License": {
"name": "license",
"in": "path",
"required": true,
"type": "string",
"x-ms-summary": "License",
"description": "Select a license",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "GetLicenses",
"value-path": "key",
"value-title": "name",
"parameters": {
"accept": "application/vnd.github\u002Bjson",
"X-GitHub-Api-Version": "2022-11-28"
}
}
},
"Page": {
"name": "page",
"in": "query",
"required": false,
"type": "integer",
"default": 1,
"x-ms-summary": "Page",
"description": "Page number of the results to fetch.",
"x-ms-visibility": "important"
},
"Per-Page": {
"name": "per_page",
"in": "query",
"required": false,
"type": "integer",
"default": 30,
"description": "The number of results per page (max 100).",
"x-ms-summary": "Per Page",
"x-ms-visibility": "important"
},
"Accept": {
"name": "accept",
"in": "query",
"required": true,
"type": "string",
"x-ms-summary": "Accept",
"description": "Setting to application/vnd.github\u002Bjson is recommended.",
"default": "application/vnd.github\u002Bjson",
"x-ms-visibility": "internal"
},
"X-GitHub-Api-Version": {
"name": "X-GitHub-Api-Version",
"in": "header",
"required": false,
"type": "string",
"x-ms-dynamic-values": {
"operationId": "GetVersions"
},
"description": "The GitHub API version.",
"x-ms-summary": "X-GitHub-Api-Version",
"default": "2022-11-28",
"x-ms-visibility": "advanced"
}
},
"responses": {},
"securityDefinitions": {},
"security": [],
"tags": []
}

Просмотреть файл

@ -0,0 +1,10 @@
{
"properties": {
"connectionParameters": {},
"iconBrandColor": "#da3b01",
"capabilities": [],
"publisher": "Daniel Laskewitz",
"stackOwner": "GitHub",
"policyTemplateInstances": []
}
}