Skip to content
This repository was archived by the owner on Jan 10, 2021. It is now read-only.

Commit 2fea0ea

Browse files
committed
Added Swagger
1 parent 1c0d2d3 commit 2fea0ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5139
-10
lines changed

Gruntfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ module.exports = function (grunt) {
121121
'!bootstrap/docs',
122122
'1901/*',
123123
'js/*',
124-
'img/*.gif'
124+
'img/*.gif',
125+
'swagger/*'
125126
],
126127
dest: '<%= conf.dist %>'
127128
},

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To build:
3737
2. Make the changes you wish to make to the source files in this repository.
3838
3. Run `grunt` or `./node_modules/.bin/grunt` in the root of this repository.
3939
4. Check whether the output in the dist/ directory is looking as intended.
40-
5. cp -r api/ dist/api . (needed for https://github.com/duckduckgo/duckduckgo-privacy-extension)
40+
5. cp -r api/ dist/ . (needed for https://github.com/duckduckgo/duckduckgo-privacy-extension)
4141
5. Commit and push to github.
4242
7. To publish the new version of the website, assuming you have 5apps set up as a remote, run `git subtree push --prefix dist 5apps master`. But be careful: this updates the live site! Ask [@hugoroy] or [@michielbdejong] if you don't have permission
4343

api/swagger.json

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"description": "We encourage people to develop applications and other services integrating our ratings into their work. This page should help you use our data for your own app. Our source code is on Github.",
5+
"version": "1.0.0",
6+
"title": "Terms of Service; Didn't Read",
7+
"termsOfService": "https://tosdr.org/legal.html",
8+
"contact": {
9+
"email": "[email protected]"
10+
},
11+
"license": {
12+
"name": "Creative commons",
13+
"url": "http://creativecommons.org/licenses/by-sa/3.0/"
14+
}
15+
},
16+
"host": "tosdr.org",
17+
"basePath": "/api/",
18+
"tags": [
19+
{
20+
"name": "Service",
21+
"description": "Get the points, documents, links and ratings of a service",
22+
"externalDocs": {
23+
"description": "GitHub",
24+
"url": "https://github.com/tosdr/tosdr.org"
25+
}
26+
}
27+
],
28+
"schemes": [
29+
"https",
30+
"http"
31+
],
32+
"paths": {
33+
"/1/service/{serviceSlug}.json": {
34+
"get": {
35+
"tags": [
36+
"Service"
37+
],
38+
"summary": "Get a service by its Slug",
39+
"description": "Returns a service",
40+
"produces": [
41+
"application/json"
42+
],
43+
"parameters": [
44+
{
45+
"name": "serviceSlug",
46+
"in": "path",
47+
"description": "Slug of service to return",
48+
"required": true,
49+
"type": "string"
50+
}
51+
],
52+
"responses": {
53+
"200": {
54+
"description": "successful operation",
55+
"schema": {
56+
"$ref": "#/definitions/Service"
57+
}
58+
}
59+
}
60+
}
61+
}
62+
},
63+
"definitions": {
64+
"Service": {
65+
"properties": {
66+
"alexa": {
67+
"type": "integer",
68+
"format": "nullable"
69+
},
70+
"class": {
71+
"type": "string",
72+
"enum": [
73+
"A",
74+
"B",
75+
"C",
76+
"D",
77+
"F",
78+
"N/A"
79+
]
80+
},
81+
"links": {
82+
"type": "object",
83+
"properties": {
84+
"Document Title": {
85+
"type": "object",
86+
"properties": {
87+
"name": {
88+
"type": "string"
89+
},
90+
"url": {
91+
"type": "string"
92+
}
93+
}
94+
}
95+
}
96+
},
97+
"points": {
98+
"type": "array",
99+
"items": {
100+
"type": "integer"
101+
}
102+
},
103+
"pointsData": {
104+
"type": "object",
105+
"properties": {
106+
"point_id": {
107+
"type": "object",
108+
"properties": {
109+
"discussion": {
110+
"type": "string"
111+
},
112+
"id": {
113+
"type": "integer",
114+
"format": "int32"
115+
},
116+
"needsModeration": {
117+
"type": "boolean"
118+
},
119+
"quoteDoc": {
120+
"type": "string"
121+
},
122+
"quoteText": {
123+
"type": "string"
124+
},
125+
"quoteStart": {
126+
"type": "integer",
127+
"format": "int32"
128+
},
129+
"quoteEnd": {
130+
"type": "integer",
131+
"format": "int32"
132+
},
133+
"services": {
134+
"type": "array",
135+
"items": {
136+
"type": "string"
137+
}
138+
},
139+
"set": {
140+
"type": "string"
141+
},
142+
"slug": {
143+
"type": "string"
144+
},
145+
"title": {
146+
"type": "string"
147+
},
148+
"topics": {
149+
"type": "array",
150+
"items": {
151+
"type": "integer"
152+
}
153+
},
154+
"tosdr": {
155+
"type": "object",
156+
"properties": {
157+
"binding": {
158+
"type": "boolean"
159+
},
160+
"case": {
161+
"type": "string"
162+
},
163+
"point": {
164+
"type": "string"
165+
},
166+
"score": {
167+
"type": "integer",
168+
"format": "int32"
169+
},
170+
"tldr": {
171+
"type": "string"
172+
}
173+
}
174+
}
175+
}
176+
}
177+
}
178+
},
179+
"urls": {
180+
"type": "array",
181+
"items": {
182+
"type": "string"
183+
}
184+
}
185+
}
186+
}
187+
}
188+
}

api/swagger.yaml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
swagger: "2.0"
2+
info:
3+
description: "We encourage people to develop applications and other services integrating our ratings into their work. This page should help you use our data for your own app. Our source code is on Github."
4+
version: "1.0.0"
5+
title: "Terms of Service; Didn't Read"
6+
termsOfService: "https://tosdr.org/legal.html"
7+
contact:
8+
9+
license:
10+
name: "Creative commons"
11+
url: "http://creativecommons.org/licenses/by-sa/3.0/"
12+
host: "tosdr.org"
13+
basePath: "/api/"
14+
tags:
15+
- name: "Service"
16+
description: "Get the points, documents, links and ratings of a service"
17+
externalDocs:
18+
description: "GitHub"
19+
url: "https://github.com/tosdr/tosdr.org"
20+
schemes:
21+
- "https"
22+
- "http"
23+
paths:
24+
/1/service/{serviceSlug}.json:
25+
get:
26+
tags:
27+
- "Service"
28+
summary: "Get a service by its Slug"
29+
description: "Returns a service"
30+
produces:
31+
- "application/json"
32+
parameters:
33+
- name: "serviceSlug"
34+
in: "path"
35+
description: "Slug of service to return"
36+
required: true
37+
type: "string"
38+
responses:
39+
"200":
40+
description: "successful operation"
41+
schema:
42+
$ref: "#/definitions/Service"
43+
definitions:
44+
Service:
45+
properties:
46+
alexa:
47+
type: integer
48+
format: nullable
49+
class:
50+
type: string
51+
enum:
52+
- "A"
53+
- "B"
54+
- "C"
55+
- "D"
56+
- "F"
57+
- "N/A"
58+
links:
59+
type: object
60+
properties:
61+
"Document Title":
62+
type: object
63+
properties:
64+
name:
65+
type: string
66+
url:
67+
type: string
68+
points:
69+
type: array
70+
items:
71+
type: integer
72+
pointsData:
73+
type: object
74+
properties:
75+
point_id:
76+
type: object
77+
properties:
78+
discussion:
79+
type: string
80+
id:
81+
type: integer
82+
format: int32
83+
needsModeration:
84+
type: boolean
85+
quoteDoc:
86+
type: string
87+
quoteText:
88+
type: string
89+
quoteStart:
90+
type: integer
91+
format: int32
92+
quoteEnd:
93+
type: integer
94+
format: int32
95+
services:
96+
type: array
97+
items:
98+
type: string
99+
set:
100+
type: string
101+
slug:
102+
type: string
103+
title:
104+
type: string
105+
topics:
106+
type: array
107+
items:
108+
type: integer
109+
tosdr:
110+
type: object
111+
properties:
112+
binding:
113+
type: boolean
114+
case:
115+
type: string
116+
point:
117+
type: string
118+
score:
119+
type: integer
120+
format: int32
121+
tldr:
122+
type: string
123+
urls:
124+
type: array
125+
items:
126+
type: string

dist/api/1/service/academia-edu.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"alexa": 677,
3+
"class": false,
4+
"links": {
5+
"Privacy Policy": {
6+
"name": "Privacy Policy",
7+
"url": "https://www.academia.edu/privacy"
8+
},
9+
"Terms of Service": {
10+
"name": "Terms of Service",
11+
"url": "https://www.academia.edu/terms"
12+
}
13+
},
14+
"points": [
15+
"4248"
16+
],
17+
"pointsData": {
18+
"4248": {
19+
"id": "4248",
20+
"needModeration": false,
21+
"quoteDoc": "Privacy Policy",
22+
"quoteEnd": 2887,
23+
"quoteStart": 2775,
24+
"quoteText": "\nIt also enables us to serve you advertising and other relevant content on and off of the Academia.edu Services.",
25+
"services": [
26+
"academia-edu"
27+
],
28+
"title": "targeted third-party advertising",
29+
"topics": [],
30+
"tosdr": {
31+
"binding": true,
32+
"case": "The service uses your personal data to employ targeted third-party advertising",
33+
"point": "bad",
34+
"privacyRelated": true,
35+
"score": 40,
36+
"tldr": "targeted third-party advertising"
37+
}
38+
}
39+
},
40+
"urls": [
41+
"academia.edu"
42+
]
43+
}

0 commit comments

Comments
 (0)