index : license-api.git

ascending towards madness

Diff

 DOCUMENTATION.md | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 LICENSE.txt      |  21 +++++++-
 README.md        |  39 ++++++++++++-
 spec.yaml        | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 400 insertions(+)

diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md
new file mode 100644
index 0000000..f32a619
--- /dev/null
+++ b/DOCUMENTATION.md
@@ -0,0 +1,179 @@
# Open Source License API

[Download Swagger specification]spec.yaml

This API is for developers that want to add a plaintext license to their project but don't want to manually search the web for a copy.

All API requests are ``GET`` requests and all responses are strings to make consuming the API via terminal or console simple.
  
This API and its source code are licensed under the [MIT License]LICENSE.txt.
  
## Table of Contents (Ctrl+F to jump to section)
* List
  * List all available endpoints
  * List IDs of all available licenses
  * List IDs and names of all available licenses
* License
  * Retrieve a license using its ID
  
---
  
## List
  
### List all available endpoints
Returns a list of available endpoints.
  
#### Usage
cURL
  
```
curl http://YOUR_WEBSITE.tld/api/
```
  
PowerShell
  
```
Invoke-WebRequest 'http://YOUR_WEBSITE.tld/api/' | Select-Object -Expand Content
```  
### Responses
#### 200 Successful operation
Example:
  
```
===============================================================
                      Available Endpoints                      
===============================================================
   Endpoint: /api/
Description: List all available endpoints
-
   Endpoint: /api/list
Description: List all available open source licenses by id
===============================================================
```
  
#### 503 Service unavailable
Example:
  
```
ERROR - Endpoint list not found! Contact the site administrator if the problem persists.
```
  
---

### List IDs of all available licenses
Returns a list of all available license IDs. Limited to **5** licenses per row for readability.
  
#### Usage
cURL
  
```
curl http://YOUR_WEBSITE.tld/api/list
```
  
PowerShell
  
```
Invoke-WebRequest 'http://YOUR_WEBSITE.tld/api/list' | Select-Object -Expand Content
```
### Responses
#### 200 Successful operation
Example:
  
```
gpl-2.0, gpl-3.0, isc
```
  
#### 503 Service unavailable
Example:
  
```
ERROR - License database not found! Contact the site administrator if the problem persists.
```
  
---
  
### List IDs and names of all available licenses
Returns a detailed list of available licenses.
  
#### Usage
cURL
  
```
curl http://YOUR_WEBSITE.tld/api/list/full
```
  
PowerShell
  
```
Invoke-WebRequest 'http://YOUR_WEBSITE.tld/api/list/full' | Select-Object -Expand Content
```  
### Responses
#### 200 Successful operation
Example:
  
```
gpl-2.0             GNU General Public License v2.0
gpl-3.0             GNU General Public License v3.0
isc          
```
  
#### 503 Service unavailable
Example:
  
```
ERROR - License database not found! Contact the site administrator if the problem persists.
```
  
---
  
## License
  
### Retrieve a license using its ID
Returns a single license using its ID.

| parameter | type | description | required |
|-----------|------|-------------|----------|
| license | string | The name of the license to retrieve. | yes |
  
#### Usage
cURL
  
```
curl http://YOUR_WEBSITE.tld/api/{license}
```
  
PowerShell
  
```
Invoke-WebRequest 'http://YOUR_WEBSITE.tld/api/{license}' | Select-Object -Expand Content
```    
### Responses
#### 200 Successful operation
Example:
  
```
ISC License

Copyright (c) [year], [fullname]

Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
  
#### 404 Not found
Example:
  
```
ERROR - NonExistentLicense is undefined. Use the 'list' endpoint to see defined licenses.
```
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..046a2c9
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 holly sparkles

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6423d09
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
# Open Source License API
Version: **1.0**
  
The original PHP source for [https://licenses.holly.sh]https://licenses.holly.sh from 2018 when it was hosted on another domain.
  
[Documentation]DOCUMENTATION.md

## Transparency Notice

This project has been shared again for historical purposes. Due to privacy concerns, I have removed my full name and (now) dead company's links from the following files:

- `README.md`
- `DOCUMENTATION.md`
- `LICENSE.txt`
- `spec.yaml`

I have also updated the README to provide more information before archiving the project as well as used `git filter-repo` to update my information. Everything else remains untouched[^1].

[^1]: If any potential employers and copyright trolls are reading this, get in touch and I may give access to the full untouched repository as I retained a copy in order to verify ownership.

## Project Status

This version of the project is **DEPRECATED** and development is **ABANDONED**. This has been re-written in Rust as of 2023. The new version is found here and is still supported: [license-api-rs]https://git.holly.sh/license-api-rs.git/about.

## Breaking Issues

The [Fat-Free Framework]https://github.com/bcosca/fatfree seems mostly unchanged from 2018, and this project has a *LOT* of code smell. **I DO NOT RECOMMEND USING THIS IN NEW DEPLOYMENTS!!!** In fact, when probing the endpoints for the Rust re-write in order to compare output, I managed to crash the server by calling an invalid route!

## Disclaimer

As outlined in the **Breaking Issues** section of this readme, this has some serious issues. **I am not responsible for anything if you get pwned for using an out-of-date PHP project.**

## Licenses

- This project is licensed under the [MIT]LICENSE.txt license
- [Fat-Free Framework]https://github.com/bcosca/fatfree is licensed under the [GNU Public License (GPLv3)]https://www.gnu.org/licenses/gpl-3.0.html
- [Parsedown]https://github.com/erusev/parsedown is licensed under the [MIT]vendor/parsedown/LICENSE.txt license

## Footnotes
diff --git a/spec.yaml b/spec.yaml
new file mode 100644
index 0000000..34b140b
--- /dev/null
+++ b/spec.yaml
@@ -0,0 +1,161 @@
swagger: '2.0'
info:
  description: >
    This API is for developers that want to add a plaintext license to their 
    project but don't want to manually search the web for a copy.


    All API responses are strings, to make consuming the API via terminal or 
    console simple.
  version: 1.0.0
  title: Open Source Software License API
host: 'http://YOUR_WEBSITE.tld'
basePath: /
schemes:
  - http
paths:
  /api:
    get:
      tags:
        - List
      summary: List all available endpoints
      description: Returns a list of available endpoints
      produces:
        - text/plain
      responses:
        '200':
          description: Successful operation
          schema:
            $ref: '#/definitions/Endpoints'
          examples:
            text/plain: |
              ===============================================================
                                    Available Endpoints                      
              ===============================================================
                 Endpoint: /api/
              Description: List all available endpoints
              -
                 Endpoint: /api/list
              Description: List all available open source licenses by id
              ===============================================================
        '503':
          description: Service unavailable
          schema:
            $ref: '#/definitions/ErrorResponse'
          examples:
            text/plain: >
              ERROR - Endpoint list not found! Contact the site administrator if
              the problem persists.
  /api/list:
    get:
      tags:
        - List
      summary: List IDs of all available licenses
      description: >-
        Returns a list of available license IDs. Limited to **5** licenses per
        row for readability.
      produces:
        - text/plain
      responses:
        '200':
          description: Successful operation
          schema:
            $ref: '#/definitions/LicensesShort'
          examples:
            text/plain: |
              gpl-2.0, gpl-3.0, isc
        '503':
          description: Service unavailable
          schema:
            $ref: '#/definitions/ErrorResponse'
          examples:
            text/plain: >
              ERROR - License database not found! Contact the site administrator
              if the problem persists.
  /api/list/full:
    get:
      tags:
        - List
      summary: List IDs and names of all available licenses
      description: Returns a detailed list of available licenses
      produces:
        - text/plain
      responses:
        '200':
          description: Successful operation
          schema:
            $ref: '#/definitions/LicensesDetailed'
          examples:
            text/plain: |
              gpl-2.0             GNU General Public License v2.0
              gpl-3.0             GNU General Public License v3.0
              isc                 ISC License
        '503':
          description: Service unavailable
          schema:
            $ref: '#/definitions/ErrorResponse'
          examples:
            text/plain: >
              ERROR - License database not found! Contact the site administrator
              if the problem persists.
  '/api/{license}':
    get:
      tags:
        - License
      summary: Retrieve a license using its ID
      description: Returns a single license using its ID
      produces:
        - text/plain
      parameters:
        - name: license
          in: path
          description: The name of the license to retrieve
          required: true
          type: string
          format: string
      responses:
        '200':
          description: Successful operation
          schema:
            $ref: '#/definitions/LicenseText'
          examples:
            text/plain: >
              ISC License


              Copyright (c) [year], [fullname]


              Permission to use, copy, modify, and/or distribute this software
              for any purpose with or without fee is hereby granted, provided
              that the above copyright notice and this permission notice appear
              in all copies.


              THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
              WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
              WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
              AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
              CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
              LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
              NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
              CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/ErrorResponse'
          examples:
            text/plain: >
              ERROR - NonExistentLicense is undefined. Use the 'list' endpoint
              to see defined license types.
definitions:
  Endpoints:
    type: string
  LicensesShort:
    type: string
  LicensesDetailed:
    type: string
  LicenseText:
    type: string
  ErrorResponse:
    type: string