commit
stringlengths 40
40
| old_file
stringlengths 2
205
| new_file
stringlengths 2
205
| old_contents
stringlengths 0
32.9k
| new_contents
stringlengths 1
38.9k
| subject
stringlengths 3
9.4k
| message
stringlengths 6
9.84k
| lang
stringlengths 3
13
| license
stringclasses 13
values | repos
stringlengths 6
115k
|
---|---|---|---|---|---|---|---|---|---|
aebb88195e0e5de2b0f411682c5cb2e9c763c36d
|
src/antlr/PTP.g4
|
src/antlr/PTP.g4
|
grammar PTP;
@header {
package pt.up.fe.iart.proj1.parser;
}
map : stmt+ ;
stmt : node_stmt #node
| edge_stmt #edge
;
edge_stmt : 'Edge' '(' from=node_stmt ',' to=node_stmt ',' weight=(INT|REAL) ')';
node_stmt : 'GasStation' '(' position ')' #GasStation
| 'GenericLocation' '(' position ')' #GenericLocation
| 'PatientLocation' '(' position ')' #PatientLocation
| 'Filiation' '(' position ',' bool ')' #Filiation
;
position : '(' x=INT ',' y=INT ')' ;
bool : 'true' | 'false' ;
INT: [0-9]+ ;
REAL: [0-9]+ '.' [0-9]* ;
WS : [ \t\r\n]+ -> skip;
|
Create prolog/scala based ANTLR 4 grammar to use to parse input files.
|
Create prolog/scala based ANTLR 4 grammar to use to parse input files.
|
ANTLR
|
mit
|
migulorama/feup-iart-2014,migulorama/feup-iart-2014
|
|
c364d58c0cda9c6c78f4d91c570ba3f08ebe335b
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
String badEnds = inHeader ? "[\\.,)\"';:\\\\=-]" : "[\\.,)\"';:\\\\-]";
while((last + next).equals("//") || last.matches(badEnds)) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
// \L (when at the start) matches the start of a line.
ends[5] = "\\L*";
ends[6] = "\\L#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
public void doInLink() {
String txt = getText().trim();
int len = txt.length();
if(len > 2) {
String lastButTwo = txt.substring(len - 3, len - 2);
if(lastButTwo.equals("]") || lastButTwo.equals("}")) {
txt = txt.substring(0, len - 2);
seek(-2);
}
}
setText(txt);
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' {doHdr();} ;
HEnd : WS? '='* WS? (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1 && occurrencesBefore("**", "\n") % 2 == 0}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'file:/' | 'mailto:' ;
Attachment : ALNUM+ '.' ALNUM+ ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
EmptyLink : ('[[' WS? ']]' | '{{' WS? '}}' |'[[' WS? '|' WS? ']]' | '{{' WS? '|' WS? '}}') -> skip ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : (~('|'|'\r'|'\n'|']'|'}') | (']' ~']' | '}' ~'}'))+ {doInLink();};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') {seek(-1);} -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : (~' ' '}}}' | ' }}}' '\r'? '\n' {seek(-1);}) {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
String badEnds = inHeader ? "[\\.,)\"';:\\\\=-]" : "[\\.,)\"';:\\\\-]";
while((last + next).equals("//") || last.matches(badEnds)) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
// \L (when at the start) matches the start of a line.
ends[5] = "\\L*";
ends[6] = "\\L#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
public void doInLink() {
String txt = getText().trim();
int len = txt.length();
if(len > 2) {
String lastButTwo = txt.substring(len - 3, len - 2);
if(lastButTwo.equals("]") || lastButTwo.equals("}")) {
txt = txt.substring(0, len - 2);
seek(-2);
}
}
setText(txt);
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' {doHdr();} ;
HEnd : WS? '='* WS? (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START U {doList(1);} ;
U2 : START L U {listLevel >= 1 && occurrencesBefore("**", "\n") % 2 == 0}? {doList(2);} ;
U3 : START L L U {listLevel >= 2}? {doList(3);} ;
U4 : START L L L U {listLevel >= 3}? {doList(4);} ;
U5 : START L L L L U {listLevel >= 4}? {doList(5);} ;
U6 : START L L L L L U {listLevel >= 5}? {doList(6);} ;
U7 : START L L L L L L U {listLevel >= 6}? {doList(7);} ;
U8 : START L L L L L L L U {listLevel >= 7}? {doList(8);} ;
U9 : START L L L L L L L L U {listLevel >= 8}? {doList(9);} ;
U10 : START L L L L L L L L L U {listLevel >= 9}? {doList(10);} ;
O1 : START O {doList(1);} ;
O2 : START L O {listLevel >= 1}? {doList(2);} ;
O3 : START L L O {listLevel >= 2}? {doList(3);} ;
O4 : START L L L O {listLevel >= 3}? {doList(4);} ;
O5 : START L L L L O {listLevel >= 4}? {doList(5);} ;
O6 : START L L L L L O {listLevel >= 5}? {doList(6);} ;
O7 : START L L L L L L O {listLevel >= 6}? {doList(7);} ;
O8 : START L L L L L L L O {listLevel >= 7}? {doList(8);} ;
O9 : START L L L L L L L L O {listLevel >= 8}? {doList(9);} ;
O10 : START L L L L L L L L L O {listLevel >= 9}? {doList(10);} ;
fragment U : '*' ~'*' ;
fragment O : '#' ~'#' ;
fragment L : '*' | '#' ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'file:/' | 'mailto:' ;
Attachment : ALNUM+ '.' ALNUM+ ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
EmptyLink : ('[[' WS? ']]' | '{{' WS? '}}' |'[[' WS? '|' WS? ']]' | '{{' WS? '|' WS? '}}') -> skip ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : (~('|'|'\r'|'\n'|']'|'}') | (']' ~']' | '}' ~'}'))+ {doInLink();};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') {seek(-1);} -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : (~' ' '}}}' | ' }}}' '\r'? '\n' {seek(-1);}) {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
Allow sublists to be nested by a combination of *s and #s
|
Allow sublists to be nested by a combination of *s and #s
|
ANTLR
|
apache-2.0
|
ashirley/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,strr/reviki,ashirley/reviki,ashirley/reviki,CoreFiling/reviki,ashirley/reviki,CoreFiling/reviki,strr/reviki,ashirley/reviki,strr/reviki,CoreFiling/reviki,CoreFiling/reviki
|
b577a7136c65e767f312ce3c71bab0a23b3b4acb
|
src/smalltalk/compiler/Smalltalk.g4
|
src/smalltalk/compiler/Smalltalk.g4
|
grammar Smalltalk;
@header {import org.antlr.symtab.*;}
file: classDef* main EOF ;
classDef returns [STClass scope]
: 'class' ID (':' ID)? '[' instanceVars? classMethod* method* ']'
;
instanceVars : localVars ;
main returns [STClass classScope, STMethod scope] : body ;
classMethod
: 'class' method
;
method returns [STMethod scope]
: ID methodBlock # NamedMethod
| bop ID methodBlock # OperatorMethod
| (KEYWORD ID)+ methodBlock # KeywordMethod
;
methodBlock locals [String selector, List<String> args]
// listeners for rule method can set these locals, rule methodBlock listeners can read
// use locals not args so no antlr warnings.
: '[' body ']' # SmalltalkMethodBlock
| '<' 'primitive:' SYMBOL '>' # PrimitiveMethodBlock
;
localVars
: '|' ID+ '|'
;
block returns [STBlock scope]
: '[' (blockArgs '|')? body ']'
;
blockArgs : (':' ID)+ ;
body: localVars? stat ('.' stat)* '.'? # FullBody
| localVars? # EmptyBody
;
stat: lvalue ':=' messageExpression # Assign
| '^' messageExpression # Return
| messageExpression # SendMessage
;
lvalue returns [VariableSymbol sym] // set sym to ID if assignment
: ID
;
messageExpression
: keywordExpression
;
keywordExpression
: recv=binaryExpression ( KEYWORD args+=binaryExpression )* # KeywordSend
| 'super' ( KEYWORD args+=binaryExpression )+ # SuperKeywordSend
;
binaryExpression
: unaryExpression ( bop unaryExpression )*
;
/** "A binary message selector is composed of one or two nonalphanumeric characters.
The only restriction is that the second character cannot be a minus sign."
BlueBlook p 49 in pdf.
*/
bop : (opchar|'-') opchar? ;
opchar
: '+'
| '/' | '\\'
| '*' | '~'
| '<' | '>'
| '=' | '@' | '%' | '|' | '&' | '?' | ','
;
unaryExpression
: primary # UnaryIsPrimary
| unaryExpression ID # UnaryMsgSend
| 'super' ID # UnarySuperMsgSend
;
primary
: literal
| array
| id
| block
| '(' messageExpression ')'
;
id returns [Symbol sym] // could be class, field, arg ref etc...
: ID
;
literal
: NUMBER
| CHAR
| STRING
| 'nil' | 'self' | 'true' | 'false'
;
/** Like #(1 2 3) except we can have expressions in array not just literals */
array : '{' ( messageExpression ('.' messageExpression)* '.'? )? '}' ;
SELF : 'self' ;
SUPER : 'super' ;
NIL : 'nil' ;
TRUE : 'true' ;
FALSE : 'false' ;
KEYWORD
: ID ':' {getInputStream().LA(1)!='='}?
;
ID : [a-zA-Z_] [a-zA-Z_0-9]*
;
SYMBOL
: '#' ID
;
COMMENT
: '"' ('""' | ~'"')* '"' -> channel(HIDDEN)
;
CHAR: '$' ~('@'|'\n'|'\t'|' ') ;
WS : (' '|'\t'|'\n')+ -> channel(HIDDEN) ;
NUMBER
: '-' NUMBER
| [0-9]+
| [0-9]+ '.' [0-9]+
;
STRING : '\'' ('\'\'' | ~'\'')* '\'' ;
RETURN : '^' ;
LBRACK : '[' ;
RBRACK : ']' ;
|
add initial grammar
|
add initial grammar
|
ANTLR
|
bsd-3-clause
|
syuanivy/smalltalk-compiler-and-virtual-machine,syuanivy/smalltalk-compiler-and-virtual-machine
|
|
5f751e73e44e4183b5b76653f0a7efb8f27756b0
|
oberon_0/src/main/antlr4/Oberon_0.g4
|
oberon_0/src/main/antlr4/Oberon_0.g4
|
grammar Oberon_0;
// PARSER
selector
: ('.' Identifier | '[' expression ']')*
;
number
: Integer
;
factor
: Identifier selector
| number
| '(' expression ')'
| '~' factor
;
term
: factor (op=('*' | 'DIV' | 'MOD' | '&') factor)*
;
simpleExpression
: (sign=('+' | '-'))? term (op=('+' | '-' | 'OR') term)*
;
expression
: simpleExpression (op=('=' | '#' | '<' | '<=' | '>' | '>=') simpleExpression)?
;
assignment
: Identifier selector ':=' expression
;
actualParameters
: '(' (expression (',' expression)* )? ')'
;
procedureCall
: Identifier selector (actualParameters)?
;
ifStatement
: 'IF' expression 'THEN' statementSequence
('ELSEIF' expression 'THEN' statementSequence)*
('ELSE' statementSequence)? 'END'
;
whileStatement
: 'WHILE' expression 'DO' statementSequence 'END'
;
statement
: (assignment | procedureCall | ifStatement | whileStatement)?
;
statementSequence
: statement (';' statement)
;
identList
: Identifier (',' Identifier)*
;
arrayType
: 'ARRAY' expression 'OF' type
;
fieldList
: (identList ':' type)?
;
recordType
: 'RECORD' fieldList (';' fieldList) 'END'
;
type
: Identifier
| arrayType
| recordType
;
fpSection
: 'VAR'? identList ':' type
;
formalParameters
: '(' (fpSection (';' fpSection)* )? ')'
;
procedureHeading
: 'PROCEDURE' Identifier formalParameters?
;
procedureBody
: declarations ('BEGIN' statementSequence)? 'END' Identifier
;
procedureDeclaration
: procedureHeading ';' procedureBody
;
declarations
: ('CONST' (Identifier '=' expression ';')* )?
('TYPE' (Identifier '=' type ';')* )?
('VAR' (identList ':' type ';')* )?
(procedureDeclaration ';')*
;
module
: 'MODULE'
| Identifier ';' declarations ('BEGIN' statementSequence)? 'END' Identifier '.'
;
// LEXER
// keywords
DIV : 'DIV' ;
MOD : 'MOD' ;
OR : 'OR' ;
IF : 'IF' ;
THEN : 'THEN' ;
ELSEIF : 'ELSEIF' ;
ELSE : 'ELSE' ;
END : 'END' ;
BEGIN : 'BEGIN' ;
WHILE : 'WHILE' ;
DO : 'DO' ;
ARRAY : 'ARRAY' ;
OF : 'OF' ;
RECORD : 'RECORD' ;
VAR : 'VAR' ;
PROCEDURE : 'PROCEDURE' ;
CONST : 'CONST' ;
TYPE : 'TYPE' ;
MODULE : 'MODULE' ;
// Punctuations and operators
DOT : '.' ;
LBRACKET : '[' ;
RBRACKET : ']' ;
LPAREN : '(' ;
RPAREN : ')' ;
TILDA : '~' ;
MUL : '*' ;
AND : '&' ;
PLUS : '+' ;
MINUS : '-' ;
EQUAL : '=' ;
SHARP : '#' ;
LT : '<' ;
LE : '<=' ;
GT : '>' ;
GE : '>=' ;
ASSIGN : ':=' ;
COMA : ',' ;
SEMI : ';' ;
COLON : ':' ;
Identifier
: Letter (Letter | Digit)*
;
Integer
: Digit+
;
Digit
: [0-9]
;
Letter
: [a-zA-Z_]
;
|
Add the parser (ANTLR parser) for Oberon_0
|
Add the parser (ANTLR parser) for Oberon_0
|
ANTLR
|
bsd-3-clause
|
amanjpro/languages-a-la-carte,amanjpro/languages-a-la-carte
|
|
aa044c28bebb4f2fe44e14eeaa6190b6493757d9
|
SWN.g4
|
SWN.g4
|
/*
* MIT License
*
* Copyright (c) 2017 Dmitry Ustalov
*
* 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.
*/
grammar SWN;
sememe : lexeme (HASH sense)? (COLON frequency)? EOF ;
lexeme : span (UNDERSCORE span)* ;
span : lemma (HAT pos)? ;
lemma : STRING ;
pos : STRING ;
sense : id labels? ;
id : INTEGER ;
labels : (UNDERSCORE label)+ ;
label : STRING ;
frequency : INTEGER | DECIMAL ;
INTEGER : [0-9]+ ;
DECIMAL : [0-9]* DOT [0-9]+ ;
STRING : CHAR+ ;
CHAR : ~[^#:_\t\n\r ] ;
HAT : '^' ;
HASH : '#' ;
COLON : ':' ;
UNDERSCORE : '_' ;
DOT : '.' ;
|
Add SWN.g4
|
Add SWN.g4
|
ANTLR
|
mit
|
nlpub/mnogoznal,nlpub/mnogoznal,nlpub/mnogoznal
|
|
97acde86bff6624ac889d69e91054a5ea1eacde0
|
src/Hello.g4
|
src/Hello.g4
|
// Define a grammar called Hello
grammar hello;
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|
Create Hello.g4
|
Create Hello.g4
|
ANTLR
|
mit
|
hanwencheng/ConnectLang
|
|
f8a3e6185e92c365fc408000408f6b6668235b54
|
cmake/CMake.g4
|
cmake/CMake.g4
|
/*
Copyright (c) 2018 zbq.
License for use and distribution: Eclipse Public License
CMake language grammar reference:
https://cmake.org/cmake/help/v3.12/manual/cmake-language.7.html
*/
grammar CMake;
file
: command_invocation* EOF
;
command_invocation
: Identifier '(' argument* ')'
;
argument
: Identifier | Unquoted_argument | Bracket_argument | Quoted_argument
| '(' argument* ')'
;
Identifier
: [A-Za-z_][A-Za-z0-9_]*
;
Unquoted_argument
: (~[ \t\r\n()#"\\] | Escape_sequence)+
;
Escape_sequence
: Escape_identity | Escape_encoded | Escape_semicolon
;
fragment
Escape_identity
: '\\' ~[A-Za-z0-9;]
;
fragment
Escape_encoded
: '\\t' | '\\r' | '\\n'
;
fragment
Escape_semicolon
: '\\;'
;
Quoted_argument
: '"' (~[\\"] | Escape_sequence | Quoted_cont)* '"'
;
fragment
Quoted_cont
: '\\' ('\r' '\n'? | '\n')
;
Bracket_argument
: '[' Bracket_arg_nested ']'
;
fragment
Bracket_arg_nested
: '=' Bracket_arg_nested '='
| '[' .*? ']'
;
Bracket_comment
: '#[' Bracket_arg_nested ']'
-> skip
;
Line_comment
: '#' ( // #
| '[' '='* // #[==
| '[' '='* ~('=' | '[' | '\r' | '\n') ~('\r' | '\n')* // #[==xx
| ~('[' | '\r' | '\n') ~('\r' | '\n')* // #xx
) ('\r' '\n'? | '\n' | EOF)
-> skip
;
Newline
: ('\r' '\n'? | '\n')+
-> skip
;
Space
: [ \t]+
-> skip
;
|
Create CMake.g4
|
Create CMake.g4
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
abfeb8d7740a449b3ad4c112adce66fa5582e5a9
|
rust/rust.g4
|
rust/rust.g4
|
grammar rust
;
// lexer
// https://doc.rust-lang.org/reference/keywords.html strict
KW_AS: 'as';
KW_BREAK: 'break';
KW_CONST: 'const';
KW_CONTINUE: 'continue';
KW_CRATE: 'crate';
KW_ELSE: 'else';
KW_ENUM: 'enum';
KW_EXTERN: 'extern';
KW_FALSE: 'false';
KW_FN: 'fn';
KW_FOR: 'for';
KW_IF: 'if';
KW_IMPL: 'impl';
KW_IN: 'in';
KW_LET: 'let';
KW_LOOP: 'loop';
KW_MATCH: 'match';
KW_MOD: 'mod';
KW_MOVE: 'move';
KW_MUT: 'mut';
KW_PUB: 'pub';
KW_REF: 'ref';
KW_RETURN: 'return';
KW_SELFVALUE: 'self';
KW_SELFTYPE: 'Self';
KW_STATIC: 'static';
KW_STRUCT: 'struct';
KW_SUPER: 'super';
KW_TRAIT: 'trait';
KW_TRUE: 'true';
KW_TYPE: 'type';
KW_UNSAFE: 'unsafe';
KW_USE: 'use';
KW_WHERE: 'where';
KW_WHILE: 'while';
// 2018+
KW_ASYNC: 'async';
KW_AWAIT: 'await';
KW_DYN: 'dyn';
// reserved
KW_ABSTRACT: 'abstract';
KW_BECOME: 'become';
KW_BOX: 'box';
KW_DO: 'do';
KW_FINAL: 'final';
KW_MACRO: 'macro';
KW_OVERRIDE: 'override';
KW_PRIV: 'priv';
KW_TYPEOF: 'typeof';
KW_UNSIZED: 'unsized';
KW_VIRTUAL: 'virtual';
KW_YIELD: 'yield';
// reserved 2018+
KW_TRY: 'try';
// weak
KW_UNION: 'union';
KW_STATICLIFETIME: '\'static';
NON_KEYWORD_IDENTIFIER
: [a-zA-Z][a-zA-Z0-9_]*
| '_' [a-zA-Z0-9_]+
;
// comments https://doc.rust-lang.org/reference/comments.html TODO: remove xxx_DOC?
LINE_COMMENT: '//' (~[/!] | '//') ~[\n]* | '//';
BLOCK_COMMENT
: '/*' (~[*!] | '**' | BLOCK_COMMENT_OR_DOC)
(
BLOCK_COMMENT_OR_DOC
| ~[*]
)*? '*/'
| '/**/'
| '/***/'
;
INNER_LINE_DOC: '//!' ~[\n\r]*; // isolated cr
INNER_BLOCK_DOC
: '/*!' (BLOCK_COMMENT_OR_DOC | ~[*])*? '*/'
;
OUTER_LINE_DOC
: '///' (~[/] ~[\n\r]*)?
; // isolated cr
OUTER_BLOCK_DOC
: '/**' (~[*] | BLOCK_COMMENT_OR_DOC)
(
BLOCK_COMMENT_OR_DOC
| ~[*]
)*? '*/'
;
BLOCK_COMMENT_OR_DOC
: BLOCK_COMMENT
| INNER_BLOCK_DOC
| OUTER_BLOCK_DOC
;
//ISOLATED_CR
// : '\r' // not followed with \n ;
// whitespace https://doc.rust-lang.org/reference/whitespace.html
WHITESPACE: [\p{Zs}] -> channel(HIDDEN);
// tokens char and string TODO: needn't so much detail, it's just token at all
CHAR_LITERAL
: '\''
(
~['\\\n\r\t]
| QUOTE_ESCAPE
| ASCII_ESCAPE
| UNICODE_ESCAPE
) '\''
;
STRING_LITERAL
: '"'
(
~["]
| QUOTE_ESCAPE
| ASCII_ESCAPE
| UNICODE_ESCAPE
| ESC_NEWLINE
)* '"'
;
RAW_STRING_LITERAL: 'r' RAW_STRING_CONTENT;
fragment RAW_STRING_CONTENT
: '#' RAW_STRING_CONTENT '#'
| '#"' .*? '"#'
;
BYTE_LITERAL
: 'b\'' (. | QUOTE_ESCAPE | BYTE_ESCAPE) '\''
;
BYTE_STRING_LITERAL
: 'b"' (. | QUOTE_ESCAPE | BYTE_ESCAPE)*? '"'
;
RAW_BYTE_STRING_LITERAL: 'br' RAW_STRING_CONTENT;
fragment ASCII_ESCAPE
: '\\x' OCT_DIGIT HEX_DIGIT
| COMMON_ESCAPE
;
fragment BYTE_ESCAPE
: '\\x' HEX_DIGIT HEX_DIGIT
| COMMON_ESCAPE
;
fragment COMMON_ESCAPE: '\\' [nrt\\0];
fragment UNICODE_ESCAPE
: '\\u{' HEX_DIGIT HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? '}'
;
fragment QUOTE_ESCAPE: '\\' ['"];
fragment ESC_NEWLINE: '\\' '\n';
// number
INTEGER_LITERAL
:
(
DEC_LITERAL
| BIN_LITERAL
| OCT_LITERAL
| HEX_LITERAL
) INTEGER_SUFFIX?
;
DEC_LITERAL: DEC_DIGIT (DEC_DIGIT | '_')*;
HEX_LITERAL
: [+-]? '0x' '_'* HEX_DIGIT (HEX_DIGIT | '_')*
;
OCT_LITERAL
: [+-]? '0o' '_'* OCT_DIGIT (OCT_DIGIT | '_')*
;
BIN_LITERAL: [+-]? '0b' '_'* [01] [01_]*;
fragment INTEGER_SUFFIX
: 'u8'
| 'u16'
| 'u32'
| 'u64'
| 'u128'
| 'usize'
| 'i8'
| 'i16'
| 'i32'
| 'i64'
| 'i128'
| 'isize'
;
FLOAT_LITERAL
: DEC_LITERAL '.'
| DEC_LITERAL ('.' DEC_LITERAL)? FLOAT_EXPONENT? FLOAT_SUFFIX?
;
fragment FLOAT_SUFFIX: 'f32' | 'f64';
fragment FLOAT_EXPONENT
: [eE] [+-]? '_'* DEC_LITERAL
;
fragment OCT_DIGIT: [0-7];
fragment DEC_DIGIT: [0-9];
fragment HEX_DIGIT: [0-9a-fA-F];
// bool
BOOLEAN_LITERAL: 'true' | 'false';
SHEBANG
: '#!' ~'\n' // TODO
;
LIFETIME_OR_LABEL: '\'' NON_KEYWORD_IDENTIFIER;
emmmm: EOF;
identifierOrKeyword
: // only ascii
NON_KEYWORD_IDENTIFIER
| keyword
;
keyword
: KW_AS
| KW_BREAK
| KW_CONST
| KW_CONTINUE
| KW_CRATE
| KW_ELSE
| KW_ENUM
| KW_EXTERN
| KW_FALSE
| KW_FN
| KW_FOR
| KW_IF
| KW_IMPL
| KW_IN
| KW_LET
| KW_LOOP
| KW_MATCH
| KW_MOD
| KW_MOVE
| KW_MUT
| KW_PUB
| KW_REF
| KW_RETURN
| KW_SELFVALUE
| KW_SELFTYPE
| KW_STATIC
| KW_STRUCT
| KW_SUPER
| KW_TRAIT
| KW_TRUE
| KW_TYPE
| KW_UNSAFE
| KW_USE
| KW_WHERE
| KW_WHILE
// 2018+
| KW_ASYNC
| KW_AWAIT
| KW_DYN
// reserved
| KW_ABSTRACT
| KW_BECOME
| KW_BOX
| KW_DO
| KW_FINAL
| KW_MACRO
| KW_OVERRIDE
| KW_PRIV
| KW_TYPEOF
| KW_UNSIZED
| KW_VIRTUAL
| KW_YIELD
| KW_TRY
| KW_UNION
| KW_STATICLIFETIME
;
identifier: NON_KEYWORD_IDENTIFIER | rawIdentifier;
rawIdentifier
: 'r#' identifierOrKeyword
; // except crate self super Self
simplePath
: '::'? simplePathSegment
(
'::' simplePathSegment
)*
;
simplePathSegment
: identifier
| 'super'
| 'self'
| 'crate'
| '$crate'
;
pathInExpression
: '::'? pathExprSegment ('::' pathExprSegment)
;
pathExprSegment
: pathIdentSegment ('::' genericArgs)?
;
pathIdentSegment
: identifier
| 'super'
| 'self'
| 'Self'
| 'crate'
| '$crate'
;
genericArgs
: '<' '>'
| '<' genericArgsLifetimes (',' genericArgsTypes)?
(
',' genericArgsBindings
)? ','? '>'
| '<' genericArgsTypes (',' genericArgsBindings)? ','? '>'
| '<' genericArgsBindings ','? '>'
;
genericArgsLifetimes: lifetime (',' lifetime)*;
genericArgsTypes: type (',' type)*;
genericArgsBindings
: genericArgsBinding (',' genericArgsBinding)*
;
genericArgsBinding: identifier '=' type;
qualifiedPathInExpression
: qualifiedPathType ('::' pathExprSegment)+
;
qualifiedPathType: '<' type ('as' typePath)? '>';
qualifiedPathInType
: qualifiedPathType ('::' typePathSegment)+
;
typePath
: '::'? typePathSegment ('::' typePathSegment)*
;
typePathSegment
: pathIdentSegment '::'?
(
genericArgs
| typePathFn
)?
;
typePathFn: '(' typePathInputs? ')' ( '->' type)?;
typePathInputs: type (',' type)* ','?;
macroInvocation: simplePath '!' delimTokenTree;
delimTokenTree
: '(' tokenTree* ')'
| '[' tokenTree* ']'
| '{' tokenTree* '}'
;
tokenTree
: '::' // TODO: test, put all token except delim here...
| delimTokenTree
;
macroInvocationSemi
: simplePath '!' '(' tokenTree* ')' ';'
| simplePath '!' '[' tokenTree* ']' ';'
| simplePath '!' '{' tokenTree* '}'
;
macroRulesDefinition
: 'macro_rules' '!' identifier macroRulesDef
;
macroRulesDef
: '(' macroRules ')' ';'
| '[' macroRules ']' ';'
| '{' macroRules '}'
;
macroRules: macroRule (';' macroRule)* ';'?;
macroRule: macroMatcher '=>' macroTranscriber;
macroMatcher
: '(' macroMatch* ')'
| '[' macroMatch* ']'
| '{' macroMatch* '}'
;
macroMatch
: '::' // TODO: token except $ and delim
| macroMatcher
| '$' identifier ':' macroFragSpec
| '$' '(' macroMatch+ ')' macroRepSep? macroRepOp
;
macroFragSpec
: 'block'
| 'expr'
| 'ident'
| 'item'
| 'lifetime'
| 'literal'
| 'meta'
| 'pat'
| 'path'
| 'stmt'
| 'tt'
| 'ty'
| 'vis'
;
macroRepSep
: '::' //TODO: Tokenexcept delimiters and repetition operators
;
macroRepOp: '*' | '+' | '?';
macroTranscriber: delimTokenTree;
crate: innerAttribute* item*;
configurationPredicate
: configurationOption
| configurationAll
| configurationAny
| configurationNot
;
configurationOption
: identifier
(
'=' (STRING_LITERAL | RAW_STRING_LITERAL)
)?
;
configurationAll
: 'all' '(' configurationPredicateList? ')'
;
configurationAny
: 'any' '(' configurationPredicateList? ')'
;
configurationNot
: 'not' '(' configurationPredicate ')'
;
configurationPredicateList
: configurationPredicate
(
',' configurationPredicate
)* ','?
;
cfgAttribute: 'cfg' '(' configurationPredicate ')';
cfgAttrAttribute
: 'cfg_attr' '(' configurationPredicate ',' cfgAttrs? ')'
;
cfgAttrs: attr (',' attr)* ','?;
item: outerAttribute* visItem | macroItem;
visItem
: visibility?
(
module
| externCrate
| useDeclaration
| function
| typeAlias
| struct
| enumeration
| union
| constantItem
| staticItem
| trait
| implementation
| externBlock
)
;
macroItem
: macroInvocationSemi
| macroRulesDefinition
;
module
: 'mod' identifier ';'
| 'mod' identifier '{' innerAttribute* item* '}'
;
externCrate
: 'extern' 'crate' crateRef asClause? ';'
;
crateRef: identifier | 'self';
asClause: 'as' (identifier | '_');
useDeclaration: 'use' useTree;
useTree
: (simplePath? '::')? '*'
| (simplePath? '::')? '{'
(
useTree (',' useTree)* ','?
)? '}'
| simplePath ('as' (identifier | '_'))?
;
function
: functionQualifiers 'fn' identifier generics? '(' functionParameters? ')'
functionReturnType? whereClause '?' blockExpression
;
functionQualifiers
: asyncConstQualifiers? 'unsafe'? ('extern' abi?)?
;
asyncConstQualifiers: 'async' | 'const';
abi: STRING_LITERAL | RAW_STRING_LITERAL;
functionParameters
: functionParam (',' functionParam)* ','?
;
functionParam: outerAttribute* pattern ':' type;
functionReturnType: '->' type;
typeAlias
: 'type' identifier generics? whereClause? '=' type ';'
;
struct: structStruct | tupleStruct;
structStruct
: 'struct' identifier generics? whereClause?
(
'{' structFields? '}'
| ';'
)
;
tupleStruct
: 'struct' identifier generics? '(' tupleFields? ')' whereClause? ';'
;
structFields: structField (',' structField)* ','?;
structField
: outerAttribute* visibility? identifier ':' type
;
tupleFields: tupleField (',' tupleField)* ','?;
tupleField: outerAttribute* visibility? type;
enumeration
: 'enum' identifier generics? whereClause? '{' enumItems? '}'
;
enumItems: enumItem (',' enumItem)* ','?;
enumItem
: outerAttribute* visibility? identifier
(
enumItemTuple
| enumItemStruct
| enumItemDiscriminant
)?
;
enumItemTuple: '(' tupleFields? ')';
enumItemStruct: '{' structFields? '}';
enumItemDiscriminant: '=' expression;
union
: 'union' identifier generics? whereClause? '{' structFields '}'
;
constantItem
: 'const' (identifier | '_') ':' type '=' expression
;
staticItem
: 'static' 'mut'? identifier ':' type '=' expression
;
trait
: 'unsafe'? 'trait' identifier generics?
(
':' typeParamBounds?
)? whereClause? '{' innerAttribute* traitItem* '}'
;
traitItem
: outerAttribute* visibility?
(
traitFunc
| traitMethod
| traitConst
| traitType
| macroInvocationSemi
)
;
traitFunc
: traitFunctionDecl (';' | blockExpression)
;
traitMethod
: traitMethodDecl (';' | blockExpression)
;
traitFunctionDecl
: functionQualifiers 'fn' identifier generics? '(' traitFunctionParameters?
')' functionReturnType? whereClause?
;
traitMethodDecl
: functionQualifiers 'fn' identifier generics? '(' selfParam
(
',' traitFunctionParam
)* ',' ')' functionReturnType? whereClause?
;
traitFunctionParameters
: traitFunctionParam (',' traitFunctionParam)* ','?
;
traitFunctionParam
: outerAttribute* (pattern ':')? type
;
traitConst
: 'const' identifier ':' type ('=' expression)? ';'
;
traitType
: 'type' identifier (':' typeParamBounds?)? ';'
;
implementation: inherentImpl | traitImpl;
inherentImpl
: 'impl' generics? type whereClause? '{' innerAttribute* inherentImplItem*
'}'
;
inherentImplItem
: outerAttribute*
(
macroInvocationSemi
|
(
visibility?
(
constantItem
| function
| method
)
)
)
;
traitImpl
: 'unsafe'? 'impl' generics? '!'? typePath 'for' type whereClause? '{'
innerAttribute* traitImplItem* '}'
;
traitImplItem
: outerAttribute*
(
macroInvocationSemi
|
(
visibility?
(
typeAlias
| constantItem
| function
| method
)
)
)
;
externBlock
: 'extern' abi? '{' innerAttribute* externalItem* '}'
;
externalItem
: outerAttribute*
(
macroInvocationSemi
|
(
visibility?
(
externalStaticItem
| externalFunctionItem
)
)
)
;
externalStaticItem
: 'static' 'mut'? identifier ':' type ';'
;
externalFunctionItem
: 'fn' identifier generics? '('
(
namedFunctionParameters
| namedFunctionParametersWithVariadics
)? ')' functionReturnType? whereClause? ';'
;
namedFunctionParameters
: namedFunctionParam (',' namedFunctionParam)* ','?
;
namedFunctionParam
: outerAttribute* (identifier | '_') ':' type
;
namedFunctionParametersWithVariadics
: (namedFunctionParam ',')* namedFunctionParam ',' outerAttribute* '...'
;
generics: '<' genericParams '>';
genericParams
: lifetimeParams
| ( lifetimeParam ',')* typeParams
;
lifetimeParams
: (lifetimeParam ',')* lifetimeParam?
;
lifetimeParam
: outerAttribute? LIFETIME_OR_LABEL
(
':' lifetimeBounds
)?
;
typeParams: ( typeParam ',')* typeParam?;
typeParam
: outerAttribute? identifier
(
':' typeParamBounds?
)? ('=' type)?
;
whereClause
: 'where' (whereClauseItem ',')* whereClauseItem?
;
whereClauseItem
: lifetimeWhereClauseItem
| typeBoundWhereClauseItem
;
lifetimeWhereClauseItem
: lifetime ':' lifetimeBounds
;
typeBoundWhereClauseItem
: forLifetimes? type ':' typeParamBounds?
;
forLifetimes: 'for' '<' lifetimeParams '>';
method
: functionQualifiers 'fn' identifier generics?
(
selfParam (',' functionParam)* ','?
) functionReturnType? whereClause? blockExpression
;
selfParam
: outerAttribute* (shorthandSelf | typedSelf)
;
shorthandSelf: ('&' | '&' lifetime)? 'mut'? 'self';
typedSelf: 'mut'? 'self' ':' type;
visibility
: 'pub'
(
'('
(
'crate'
| 'self'
| 'super'
| 'in' simplePath
) ')'
)?
;
innerAttribute: '#' '!' '[' attr ']';
outerAttribute: '#' '[' attr ']';
attr: simplePath attrInput?;
attrInput
: delimTokenTree
| '=' literalExpression
; // w/o suffix
metaItem
: simplePath
(
'=' literalExpression //w
| '(' metaSeq ')'
)?
;
metaSeq: metaItemInner (',' metaItemInner)* ','?;
metaItemInner: metaItem | literalExpression; // w
metaWord: identifier;
metaNameValueStr
: identifier '='
(
STRING_LITERAL
| RAW_STRING_LITERAL
)
;
metaListPaths
: identifier '('
(
simplePath (',' simplePath)* ','?
)? ')'
;
metaListIdents
: identifier '('
(
identifier (',' identifier)* ','?
)? ')'
;
metaListNameValueStr
: identifier '('
(
metaNameValueStr (',' metaNameValueStr)* ','?
)? ')'
;
statement
: ';'
| item
| letStatement
| expressionStatement
| macroInvocationSemi
;
letStatement
: outerAttribute* 'let' pattern (':' type)?
(
'=' expression
)? ';'
;
expressionStatement
: expressionWithoutBlock ';'
| expressionWithBlock ';'?
;
expression
: expressionWithoutBlock
| expressionWithBlock
;
expressionWithoutBlock
: outerAttribute*
(
literalExpression
| pathExpression
| operatorExpression
| groupedExpression
| arrayExpression
| awaitExpression
| indexExpression
| tupleExpression
| tupleIndexingExpression
| structExpression
| enumerationVariantExpression
| callExpression
| methodCallExpression
| fieldExpression
| closureExpression
| continueExpression
| breakExpression
| rangeExpression
| returnExpression
| macroInvocation
)
;
expressionWithBlock
: outerAttribute*
(
blockExpression
| asyncBlockExpression
| unsafeBlockExpression
| loopExpression
| ifExpression
| ifLetExpression
| matchExpression
)
;
literalExpression
: CHAR_LITERAL
| STRING_LITERAL
| RAW_STRING_LITERAL
| BYTE_LITERAL
| BYTE_STRING_LITERAL
| RAW_BYTE_STRING_LITERAL
| INTEGER_LITERAL
| FLOAT_LITERAL
| BOOLEAN_LITERAL
;
pathExpression
: pathInExpression
| qualifiedPathInExpression
;
blockExpression
: '{' innerAttribute* statements? '}'
;
statements
: statement+ expressionWithoutBlock?
| expressionWithoutBlock
;
asyncBlockExpression
: 'async' 'move'? blockExpression
;
unsafeBlockExpression: 'unsafe' blockExpression;
operatorExpression
: borrowExpression
| dereferenceExpression
| errorPropagationExpression
| negationExpression
| arithmeticOrLogicalExpression
| comparisonExpression
| lazyBooleanExpression
| typeCastExpression
| assignmentExpression
| compoundAssignmentExpression
;
borrowExpression: ('&' | '&&') 'mut'? expression;
dereferenceExpression: '*' expression;
errorPropagationExpression: expression '?';
negationExpression: ('-' | '!') expression;
arithmeticOrLogicalExpression
: expression
(
'+'
| '-'
| '*'
| '/'
| '%'
| '&'
| '|'
| '^'
| '<<'
| '>>'
) expression
;
//lifetimeToken: '\'' identifierOrKeyword | '\'_';
comparisonExpression
: expression
(
'=='
| '!='
| '>'
| '<'
| '>='
| '<='
) expression
;
lazyBooleanExpression
: expression ('||' | '&&') expression
;
typeCastExpression: expression 'as' expression;
assignmentExpression: expression '=' expression;
compoundAssignmentExpression
: expression
(
'+='
| '-='
| '*='
| '/='
| '%='
| '&='
| '|='
| '^='
| '<<='
| '>>='
) expression
;
groupedExpression
: '(' innerAttribute* expression ')'
;
arrayExpression
: '[' innerAttribute* arrayElements? ']'
;
arrayElements
: expression (',' expression)* ','?
| expression ';' expression
;
indexExpression: expression '[' expression ']';
tupleExpression
: '(' innerAttribute* tupleElements? ')'
;
tupleElements: (expression ',')+ expression?;
tupleIndexingExpression: expression '.' tupleIndex;
tupleIndex: INTEGER_LITERAL;
structExpression
: structExprStruct
| structExprTuple
| structExprUnit
;
structExprStruct
: pathInExpression '{' innerAttribute*
(
structExprFields
| structBase
)? '}'
;
structExprFields
: structExprField (',' structExprField)*
(
',' structBase
| ','?
)
;
structExprField
: identifier
| (identifier | tupleIndex) ':' expression
;
structBase: '..' expression;
structExprTuple
: pathInExpression '(' innerAttribute*
(
expression (',' expression)* ','?
)? ')'
;
structExprUnit: pathInExpression;
enumerationVariantExpression
: enumExprStruct
| enumExprTuple
| enumExprFieldless
;
enumExprStruct
: pathInExpression '{' enumExprFields? '}'
;
enumExprFields
: enumExprField (',' enumExprField)* ','?
;
enumExprField
: identifier
| (identifier | tupleIndex) ':' expression
;
enumExprTuple
: pathInExpression '('
(
expression (',' expression)* ','?
)? ')'
;
enumExprFieldless: pathInExpression;
callExpression: expression '(' callParams? ')';
callParams: expression (',' expression)* ','?;
methodCallExpression
: expression '.' pathExprSegment '(' callParams? ')'
;
fieldExpression: expression '.' identifier;
closureExpression
: 'move'? ('||' | '|' closureParameters? '|')
(
expression
| '->' typeNoBounds blockExpression
)
;
closureParameters
: closureParam (',' closureParam)* ','?
;
closureParam: outerAttribute* pattern (':' type)?;
loopExpression
: loopLabel?
(
infiniteLoopExpression
| predicateLoopExpression
| predicatePatternLoopExpression
| iteratorLoopExpression
)
;
infiniteLoopExpression: 'loop' blockExpression;
predicateLoopExpression
: 'while' expression /*except structExpression*/ blockExpression
;
predicatePatternLoopExpression
: 'while' 'let' matchArmPatterns '=' expression blockExpression
;
iteratorLoopExpression
: 'for' pattern 'in' expression blockExpression
;
loopLabel: LIFETIME_OR_LABEL ':';
breakExpression
: 'break' LIFETIME_OR_LABEL? expression?
;
continueExpression
: 'continue' LIFETIME_OR_LABEL? expression?
;
rangeExpression
: rangeExpr
| rangeFromExpr
| rangeToExpr
| rangeFullExpr
| rangeInclusiveExpr
| rangeToInclusiveExpr
;
rangeExpr: expression '..' expression;
rangeFromExpr: expression '..';
rangeToExpr: '..' expression;
rangeFullExpr: '..';
rangeInclusiveExpr: expression '..=' expression;
rangeToInclusiveExpr: '..=' expression;
ifExpression
: 'if' expression blockExpression
(
'else'
(
blockExpression
| ifExpression
| ifLetExpression
)
)?
;
ifLetExpression
: 'if' 'let' matchArmPatterns '=' expression blockExpression
(
'else'
(
blockExpression
| ifExpression
| ifLetExpression
)
)?
;
matchExpression
: 'match' expression '{' innerAttribute* matchArms? '}'
;
matchArms
:
(
matchArm '=>'
(
expressionWithoutBlock ','
| expressionWithBlock ','?
)
)* matchArm '=>' expression ','?
;
matchArm
: outerAttribute* matchArmPatterns matchArmGuard?
;
matchArmPatterns: '|'? pattern ('|' pattern)*;
matchArmGuard: 'if' expression;
returnExpression: 'return' expression?;
awaitExpression: expression '.' 'await';
pattern: patternWithoutRange | rangePattern;
patternWithoutRange
: literalPattern
| identifierPattern
| wildcardPattern
| restPattern
| obsoleteRangePattern
| referencePattern
| structPattern
| tupleStructPattern
| groupedPattern
| slicePattern
| pathPattern
| macroInvocation
;
literalPattern
: BOOLEAN_LITERAL
| CHAR_LITERAL
| BYTE_LITERAL
| STRING_LITERAL
| RAW_STRING_LITERAL
| BYTE_STRING_LITERAL
| RAW_BYTE_STRING_LITERAL
| '-'? INTEGER_LITERAL
| '-'? FLOAT_LITERAL
;
identifierPattern
: 'ref'? 'mut'? identifier ('@' pattern)?
;
wildcardPattern: '_';
restPattern: '..';
rangePattern
: rangePatternBound '..=' rangePatternBound
;
obsoleteRangePattern
: rangePatternBound '...' rangePatternBound
;
rangePatternBound
: CHAR_LITERAL
| BYTE_LITERAL
| '-'? INTEGER_LITERAL
| '-'? FLOAT_LITERAL
| pathInExpression
| qualifiedPathInExpression
;
referencePattern
: ('&' | '&&') 'mut'? patternWithoutRange
;
structPattern
: pathInExpression '{' structPatternElements? '}'
;
structPatternElements
: structPatternFields
(
',' structPatternEtCetera?
)?
| structPatternEtCetera
;
structPatternFields
: structPatternField (',' structPatternField)*
;
structPatternField
: outerAttribute*
(
tupleIndex ':' pattern
| identifier ':' pattern
| 'ref'? 'mut'? identifier
)
;
structPatternEtCetera: outerAttribute* '..';
tupleStructPattern
: pathInExpression '(' tupleStructItems? ')'
;
tupleStructItems: pattern (',' pattern)* ','?;
tuplePattern: '(' tuplePatternItems? ')';
tuplePatternItems
: pattern ','
| restPattern
| pattern (',' pattern)+ ','?
;
groupedPattern: '(' pattern ')';
slicePattern: '[' slicePatternItems ']';
slicePatternItems: pattern (',' pattern)* ','?;
pathPattern
: pathInExpression
| qualifiedPathInExpression
;
type
: typeNoBounds
| implTraitType
| traitObjectType
;
typeNoBounds
: parenthesizedType
| implTraitTypeOneBound
| traitObjectTypeOneBound
| typePath
| tupleType
| neverType
| rawPointerType
| referenceType
| arrayType
| sliceType
| inferredType
| qualifiedPathInType
| bareFunctionType
| macroInvocation
;
parenthesizedType: '(' type ')';
neverType: '!';
tupleType: '(' ( (type ',')+ type?) ')';
arrayType: '[' type ';' expression ']';
sliceType: '[' type ']';
referenceType: '&' lifetime? 'mut'? typeNoBounds;
rawPointerType: '*' ('mut' | 'const') typeNoBounds;
bareFunctionType
: forLifetimes? functionQualifiers 'fn' '('
functionParametersMaybeNamedVariadic? ')' bareFunctionReturnType?
;
bareFunctionReturnType: '->' typeNoBounds;
functionParametersMaybeNamedVariadic
: maybeNamedFunctionParameters
| maybeNamedFunctionParametersVariadic
;
maybeNamedFunctionParameters
: maybeNamedParam (',' maybeNamedParam)* ','?
;
maybeNamedParam
: outerAttribute* ((identifier | '_') ':')? type
;
maybeNamedFunctionParametersVariadic
: (maybeNamedParam ',')* maybeNamedParam ',' outerAttribute* '...'
;
traitObjectType: 'dyn'? typeParamBounds;
traitObjectTypeOneBound: 'dyn'? traitBound;
implTraitType: 'impl' typeParamBounds;
implTraitTypeOneBound: 'impl' traitBound;
inferredType: '_';
typeParamBounds
: typeParamBound ('+' typeParamBound)* '+'?
;
typeParamBound: lifetime | traitBound;
traitBound
: '?'? forLifetimes? typePath
| '(' '?'? forLifetimes? typePath ')'
;
lifetimeBounds: (lifetime '+')* lifetime?;
lifetime: LIFETIME_OR_LABEL | '\'static' | '\'_';
|
copy paste from official document
|
rust: copy paste from official document
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
1d5338da4eaf2ce6d85a8b6b91189c1f29b99a47
|
src/antlr/literals.g4
|
src/antlr/literals.g4
|
/*
[The "BSD licence"]
Copyright (c) 2014 Terence Parr, Sam Harwell
Modified (c) 2014 Gregg Reynolds
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
clojure literal syntax. based on Java8 grammar
*/
grammar literals;
lit: literal+ EOF;
literal
: IntegerLiteral
| FloatingPointLiteral
| CharacterLiteral
| StringLiteral
| BooleanLiteral
| NilLiteral
;
// Java §3.10.1 Integer Literals
// http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.1
IntegerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
| BinaryIntegerLiteral
;
fragment
DecimalIntegerLiteral
: DecimalNumeral IntegerTypeSuffix?
;
fragment
HexIntegerLiteral
: HexNumeral IntegerTypeSuffix?
;
fragment
OctalIntegerLiteral
: OctalNumeral IntegerTypeSuffix?
;
fragment
BinaryIntegerLiteral
: BinaryNumeral IntegerTypeSuffix?
;
fragment
IntegerTypeSuffix
: [lL]
;
fragment
DecimalNumeral
: '0'
| NonZeroDigit (Digits? | Underscores Digits)
;
fragment
Digits
: Digit (DigitOrUnderscore* Digit)?
;
fragment
Digit
: '0'
| NonZeroDigit
;
fragment
NonZeroDigit
: [1-9]
;
fragment
DigitOrUnderscore
: Digit
| '_'
;
fragment
Underscores
: '_'+
;
fragment
HexNumeral
: '0' [xX] HexDigits
;
fragment
HexDigits
: HexDigit (HexDigitOrUnderscore* HexDigit)?
;
fragment
HexDigit
: [0-9a-fA-F]
;
fragment
HexDigitOrUnderscore
: HexDigit
| '_'
;
fragment
OctalNumeral
: '0' Underscores? OctalDigits
;
fragment
OctalDigits
: OctalDigit (OctalDigitOrUnderscore* OctalDigit)?
;
fragment
OctalDigit
: [0-7]
;
fragment
OctalDigitOrUnderscore
: OctalDigit
| '_'
;
fragment
BinaryNumeral
: '0' [bB] BinaryDigits
;
fragment
BinaryDigits
: BinaryDigit (BinaryDigitOrUnderscore* BinaryDigit)?
;
fragment
BinaryDigit
: [01]
;
fragment
BinaryDigitOrUnderscore
: BinaryDigit
| '_'
;
// §3.10.2 Floating-Point Literals
FloatingPointLiteral
: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
fragment
DecimalFloatingPointLiteral
: Digits '.' Digits? ExponentPart? FloatTypeSuffix?
| '.' Digits ExponentPart? FloatTypeSuffix?
| Digits ExponentPart FloatTypeSuffix?
| Digits FloatTypeSuffix
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedInteger
: Sign? Digits
;
fragment
Sign
: [+-]
;
fragment
FloatTypeSuffix
: [fFdD]
;
fragment
HexadecimalFloatingPointLiteral
: HexSignificand BinaryExponent FloatTypeSuffix?
;
fragment
HexSignificand
: HexNumeral '.'?
| '0' [xX] HexDigits? '.' HexDigits
;
fragment
BinaryExponent
: BinaryExponentIndicator SignedInteger
;
fragment
BinaryExponentIndicator
: [pP]
;
// §3.10.3 Boolean Literals
BooleanLiteral
: 'true'
| 'false'
;
// §3.10.4 Character Literals
CharacterLiteral
: '\\' SingleCharacter
| EscapeSequence
;
fragment
SingleCharacter
: ~['\\]
;
// §3.10.5 String Literals
StringLiteral
: '"' StringCharacters? '"'
;
fragment
StringCharacters
: StringCharacter+
;
fragment
StringCharacter
: ~["\\]
| EscapeSequence
;
// §3.10.6 Escape Sequences for Character and String Literals
fragment
EscapeSequence
: '\\space'
| '\\backspace'
| '\\tab'
| '\return'
| '\newline'
| '\formfeed'
| '\\'
| '\"'
| '\''
| OctalEscape
| UnicodeEscape
;
fragment
OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment
ZeroToThree
: [0-3]
;
NilLiteral
: 'nil'
;
//
// Whitespace and comments
//
WS : [ \t\r\n\u000C]+ -> skip
;
LINE_COMMENT
: ';' ~[\r\n]* -> skip
;
|
add lex grammar for clojure literals.gr
|
add lex grammar for clojure literals.gr
|
ANTLR
|
epl-1.0
|
mobileink/lab.clj.antlr,mobileink/lab.antlr
|
|
44c59b75ac534718291b5e2936de9828e9676fee
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
ends[5] = "\n*";
ends[6] = "\n#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+? {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|'+ WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().equals(":")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().equals(":")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'mailto:' ;
Attachment : UPPER ALNUM* ALPHA ALNUM+ '.' LOWER LOWNUM+ {checkBounds("[a-zA-Z0-9@\\./=-]", "[a-zA-Z0-9@/=-]")}? ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : ~(']'|'}'|'|'|'\r'|'\n')+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
ends[5] = "\n*";
ends[6] = "\n#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+? {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|'+ WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().equals(":")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().equals(":")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'mailto:' ;
Attachment : UPPER ALNUM* ALPHA ALNUM+ '.' LOWNUM+ {checkBounds("[a-zA-Z0-9@\\./=-]", "[a-zA-Z0-9@/=-]")}? ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : ~(']'|'}'|'|'|'\r'|'\n')+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
Allow attachment extensions to be entirely numeric
|
Allow attachment extensions to be entirely numeric
|
ANTLR
|
apache-2.0
|
ashirley/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,CoreFiling/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,CoreFiling/reviki,ashirley/reviki,CoreFiling/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,strr/reviki
|
75b518af7ef0773e3cf9daf7c82ee85377e70e2a
|
objc/ObjC.g4
|
objc/ObjC.g4
|
// Converted to ANTLR 4 by Terence Parr; added @property and a few others.
// Seems to handle stuff like this except for blocks:
// https://google-api-objectivec-client.googlecode.com/svn/trunk/Examples/ShoppingSample/ShoppingSampleWindowController.m
/**
* ObjectiveC version 2
* based on an LL ansic grammars and
* and ObjectiveC grammar found in Learning Object C
*
* It's a Work in progress, most of the .h file can be parsed
* June 2008 Cedric Cuche
**/
grammar ObjC;
translation_unit: external_declaration+ EOF;
external_declaration:
COMMENT | LINE_COMMENT | preprocessor_declaration
|function_definition
| declaration
| class_interface
| class_implementation
| category_interface
| category_implementation
| protocol_declaration
| protocol_declaration_list
| class_declaration_list;
preprocessor_declaration:
IMPORT
| INCLUDE
| '#define' macro_specification
| '#ifdef' expression
| '#if' expression
| '#undef' expression
| '#ifndef' expression
| '#endif';
macro_specification: '.+';
class_interface:
'@interface'
class_name (':' superclass_name)?
protocol_reference_list?
instance_variables?
interface_declaration_list?
'@end';
category_interface:
'@interface'
class_name '(' category_name? ')'
protocol_reference_list?
interface_declaration_list?
'@end';
class_implementation:
'@implementation'
(
class_name ( ':' superclass_name )?
( implementation_definition_list )?
)
'@end';
category_implementation:
'@implementation'(
class_name '(' category_name ')'
( implementation_definition_list )?
)'@end';
protocol_declaration:
'@protocol'(
protocol_name ( protocol_reference_list )?
( interface_declaration_list )?
)'@end';
protocol_declaration_list:
('@protocol' protocol_list';')
;
class_declaration_list:
('@class' class_list';')
;
class_list:
class_name (',' class_name)*;
protocol_reference_list:
('<' protocol_list '>');
protocol_list:
protocol_name (',' protocol_name)*;
property_declaration
: '@property' property_attributes_declaration? struct_declaration
;
property_attributes_declaration
: '(' property_attributes_list ')'
;
property_attributes_list
: property_attribute (',' property_attribute)*
;
property_attribute
: IDENTIFIER
| IDENTIFIER '=' IDENTIFIER // getter
| IDENTIFIER '=' IDENTIFIER ':' // setter
;
class_name:
IDENTIFIER;
superclass_name:
IDENTIFIER;
category_name:
IDENTIFIER;
protocol_name:
IDENTIFIER;
instance_variables
: '{' struct_declaration* '}'
| '{' visibility_specification struct_declaration+ '}'
| '{' struct_declaration+ instance_variables '}'
| '{' visibility_specification struct_declaration+ instance_variables '}'
;
visibility_specification:
'@private'
| '@protected'
| '@package'
| '@public';
interface_declaration_list:
(declaration | class_method_declaration | instance_method_declaration | property_declaration)+
;
class_method_declaration:
('+' method_declaration)
;
instance_method_declaration:
('-' method_declaration)
;
method_declaration:
( method_type )? method_selector ';';
implementation_definition_list
: ( function_definition
| declaration
| class_method_definition
| instance_method_definition
| property_implementation
)+
;
class_method_definition:
('+' method_definition)
;
instance_method_definition:
('-' method_definition)
;
method_definition:
(method_type)? method_selector (init_declarator_list)? compound_statement;
method_selector:
selector |(keyword_declarator+ (parameter_list)? )
;
keyword_declarator:
selector? ':' method_type* IDENTIFIER;
selector:
IDENTIFIER;
method_type: '(' type_name ')';
property_implementation
: '@synthesize' property_synthesize_list ';'
| '@dynamic' property_synthesize_list ';'
;
property_synthesize_list
: property_synthesize_item (',' property_synthesize_item)*
;
property_synthesize_item
: IDENTIFIER | IDENTIFIER '=' IDENTIFIER
;
type_specifier:
'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned'
| ('id' ( protocol_reference_list )? )
| (class_name ( protocol_reference_list )?)
| struct_or_union_specifier
| enum_specifier
| IDENTIFIER;
type_qualifier:
'const' | 'volatile' | protocol_qualifier;
protocol_qualifier:
'in' | 'out' | 'inout' | 'bycopy' | 'byref' | 'oneway';
primary_expression:
IDENTIFIER
| constant
| STRING_LITERAL
| ('(' expression ')')
| 'self'
| message_expression
| selector_expression
| protocol_expression
| encode_expression;
message_expression:
'[' receiver message_selector ']'
;
receiver:
expression
| class_name
| 'super';
message_selector:
selector
| keyword_argument+;
keyword_argument:
selector? ':' expression;
selector_expression:
'@selector' '(' selector_name ')';
selector_name:
selector
| (selector? ':')+;
protocol_expression:
'@protocol' '(' protocol_name ')';
encode_expression:
'@encode' '(' type_name ')';
exception_declarator:
declarator;
try_statement:
'@trystatement';
catch_statement:
'@catch' '('exception_declarator')'statement;
finally_statement:
'@finally' statement;
throw_statement:
'@throw' '('IDENTIFIER')';
try_block:
try_statement
catch_statement
( finally_statement )?;
synchronized_statement:
'@synchronized' '(' IDENTIFIER ')' statement;
function_definition : declaration_specifiers? declarator compound_statement ;
declaration : declaration_specifiers init_declarator_list? ';';
declaration_specifiers
: (storage_class_specifier | type_specifier | type_qualifier)+ ;
storage_class_specifier: 'auto' | 'register' | 'static' | 'extern' | 'typedef';
init_declarator_list : init_declarator (',' init_declarator)* ;
init_declarator : declarator ('=' initializer)? ;
struct_or_union_specifier: ('struct' | 'union')
( IDENTIFIER | IDENTIFIER? '{' struct_declaration+ '}') ;
struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;
specifier_qualifier_list : (type_specifier | type_qualifier)+ ;
struct_declarator_list : struct_declarator (',' struct_declarator)* ;
struct_declarator : declarator | declarator? ':' constant;
enum_specifier : 'enum'
( identifier ('{' enumerator_list '}')?
| '{' enumerator_list '}') ;
enumerator_list : enumerator (',' enumerator)* ;
enumerator : identifier ('=' constant_expression)?;
declarator : '*' type_qualifier* declarator | direct_declarator ;
direct_declarator : identifier declarator_suffix*
| '(' declarator ')' declarator_suffix* ;
declarator_suffix : '[' constant_expression? ']'
| '(' parameter_list? ')';
parameter_list : parameter_declaration_list ( ',' '...' )? ;
parameter_declaration
: declaration_specifiers (declarator? | abstract_declarator) ;
initializer : assignment_expression
| '{' initializer (',' initializer)* '}' ;
type_name : specifier_qualifier_list abstract_declarator ;
abstract_declarator : '*' type_qualifier* abstract_declarator
| '(' abstract_declarator ')' abstract_declarator_suffix+
| ('[' constant_expression? ']')+
| ;
abstract_declarator_suffix
: '[' constant_expression? ']'
| '(' parameter_declaration_list? ')' ;
parameter_declaration_list
: parameter_declaration ( ',' parameter_declaration )* ;
statement_list : statement+ ;
statement
: labeled_statement
| expression ';'
| compound_statement
| selection_statement
| iteration_statement
| jump_statement
| ';' ;
labeled_statement
: identifier ':' statement
| 'case' constant_expression ':' statement
| 'default' ':' statement ;
compound_statement : '{' (declaration|statement_list)* '}' ;
selection_statement
: 'if' '(' expression ')' statement ('else' statement)?
| 'switch' '(' expression ')' statement ;
iteration_statement
: 'while' '(' expression ')' statement
| 'do' statement 'while' '(' expression ')' ';'
| 'for' '(' expression? ';' expression? ';' expression? ')' statement ;
jump_statement
: 'goto' identifier ';'
| 'continue' ';'
| 'break' ';'
| 'return' expression? ';'
;
expression : assignment_expression (',' assignment_expression)* ;
assignment_expression : conditional_expression
( assignment_operator assignment_expression)? ;
assignment_operator:
'=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=';
conditional_expression : logical_or_expression
('?' logical_or_expression ':' logical_or_expression)? ;
constant_expression : conditional_expression ;
logical_or_expression : logical_and_expression
('||' logical_and_expression)* ;
logical_and_expression : inclusive_or_expression
('&&' inclusive_or_expression)* ;
inclusive_or_expression : exclusive_or_expression
('|' exclusive_or_expression)* ;
exclusive_or_expression : and_expression ('^' and_expression)* ;
and_expression : equality_expression ('&' equality_expression)* ;
equality_expression : relational_expression
(('!=' | '==') relational_expression)* ;
relational_expression : shift_expression
(('<' | '>' | '<=' | '>=') shift_expression)* ;
shift_expression : additive_expression (('<<' | '>>') additive_expression)* ;
additive_expression : multiplicative_expression
(('+' | '-') multiplicative_expression)* ;
multiplicative_expression : cast_expression
(('*' | '/' | '%') cast_expression)* ;
cast_expression : '(' type_name ')' cast_expression | unary_expression ;
unary_expression
: postfix_expression
| '++' unary_expression
| '--' unary_expression
| unary_operator cast_expression
| 'sizeof' ('(' type_name ')' | unary_expression) ;
unary_operator : '&' | '*' | '-' | '~' | '!' ;
postfix_expression : primary_expression
('[' expression ']'
| '(' argument_expression_list? ')'
| '.' identifier
| '->' identifier
| '++'
| '--'
)* ;
argument_expression_list
: assignment_expression (',' assignment_expression)* ;
identifier : IDENTIFIER;
constant : DECIMAL_LITERAL | HEX_LITERAL | OCTAL_LITERAL | CHARACTER_LITERAL | FLOATING_POINT_LITERAL;
IDENTIFIER
: LETTER (LETTER|'0'..'9')*
;
fragment
LETTER
: '$'
| 'A'..'Z'
| 'a'..'z'
| '_'
;
CHARACTER_LITERAL
: '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
;
/*
s_char = [[[any_char - '"'] - '\'] - nl] | escape_sequence;
string_literal = ('L' | '@') '"' s_char* '"';
*/
STRING_LITERAL
: [L@] STRING
;
fragment
STRING : '"' ( EscapeSequence | ~('\\'|'"') )* '"' ;
HEX_LITERAL : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
DECIMAL_LITERAL : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
OCTAL_LITERAL : '0' ('0'..'7')+ IntegerTypeSuffix? ;
fragment
HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment
IntegerTypeSuffix
: ('u'|'U'|'l'|'L')
;
FLOATING_POINT_LITERAL
: ('0'..'9')+ ('.' ('0'..'9')*)? Exponent? FloatTypeSuffix?
;
fragment
Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
fragment
FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| OctalEscape
;
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
IMPORT : '#import' [ \t]* (STRING|ANGLE_STRING) WS -> channel(HIDDEN) ;
INCLUDE: '#include'[ \t]* (STRING|ANGLE_STRING) WS -> channel(HIDDEN) ;
PRAGMA : '#pragma' ~[\r\n]* -> channel(HIDDEN) ;
fragment
ANGLE_STRING
: '<' .*? '>'
;
WS : [ \r\n\t\u000C] -> channel(HIDDEN) ;
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
LINE_COMMENT
: '//' ~[\r\n]* -> channel(HIDDEN)
;
|
add ObjC grammar
|
add ObjC grammar
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
cc919e1c0a9083047d41b2c94e0c5c72ec5736e5
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"';:]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
ends[5] = "\n*";
ends[6] = "\n#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'mailto:' ;
Attachment : UPPER ALNUM* ALPHA ALNUM+ '.' LOWNUM ALNUM+ {checkBounds("[a-zA-Z0-9@\\./=\\-_]", "[a-zA-Z0-9@/=-_]")}? ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : ~(']'|'}'|'|'|'\r'|'\n')+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"';:]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
ends[5] = "\n*";
ends[6] = "\n#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'file:/' | 'mailto:' ;
Attachment : UPPER ALNUM* ALPHA ALNUM+ '.' LOWNUM ALNUM+ {checkBounds("[a-zA-Z0-9@\\./=\\-_]", "[a-zA-Z0-9@/=-_]")}? ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : ~(']'|'}'|'|'|'\r'|'\n')+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
Allow URLs to start with file:/
|
Allow URLs to start with file:/
|
ANTLR
|
apache-2.0
|
ashirley/reviki,CoreFiling/reviki,strr/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,strr/reviki,CoreFiling/reviki,strr/reviki,CoreFiling/reviki,strr/reviki,CoreFiling/reviki,CoreFiling/reviki,strr/reviki,ashirley/reviki
|
d5bc4f6a8202f7735f4095e341ad8cccd0be38a3
|
parser/SystemRDL.g4
|
parser/SystemRDL.g4
|
/*
Copyright 2009 The SPIRIT Consortium.
This work forms part of a deliverable of The SPIRIT Consortium.
Use of these materials are governed by the legal terms and conditions
outlined in the disclaimer available from www.spiritconsortium.org.
This source file is provided on an AS IS basis. The SPIRIT
Consortium disclaims any warranty express or implied including
any warranty of merchantability and fitness for use for a
particular purpose.
The user of the source file shall indemnify and hold The SPIRIT
Consortium and its members harmless from any damages or liability.
Users are requested to provide feedback to The SPIRIT Consortium
using either mailto:[email protected] or the forms at
http://www.spiritconsortium.org/about/contact_us/
This file may be copied, and distributed, WITHOUT
modifications; this notice must be included on any copy.
The following code is derived, directly or indirectly, from
source code (C) COPYRIGHT 2009 Denali Software Inc. and is used by
permission under the terms described above.
*/
grammar SystemRDL;
tokens { INST_ID, PROPERTY }
root
: ( component_def
| enum_def
| explicit_component_inst
| property_assign
| property_definition
)* EOF
;
property_definition
: 'property'
id
LBRACE
property_body
RBRACE
SEMI
;
property_body
: property_type ( property_usage (property_default)?
| property_default property_usage
)
| property_usage ( property_type (property_default)?
| property_default property_type
)
| property_default ( property_type property_usage
| property_usage property_type
)
;
property_type
:
'type' EQ
( property_string_type
| property_number_type
| property_boolean_type
| property_ref_type
) SEMI
;
property_default
:
(
'default' EQ (str | num | 'true' | 'false')
SEMI
)
;
property_usage
:
'component' EQ property_component (OR property_component)* SEMI
;
property_component
: ('signal' | 'addrmap' | 'reg' | 'regfile' | 'field' | 'all')
;
property_boolean_type
: 'boolean'
;
property_string_type
: 'string'
;
property_number_type
: 'number'
;
property_ref_type
: ('addrmap' | 'reg' | 'regfile' | 'field' | 'ref')
;
component_def
: ( 'addrmap' | 'regfile' | 'reg' | 'field' | 'signal' )
( id
|
)
LBRACE
( component_def
| explicit_component_inst
| property_assign
| enum_def
)*
RBRACE
( anonymous_component_inst_elems )?
SEMI
;
explicit_component_inst
: ( 'external' )?
( 'internal' )?
( 'alias' id )?
id
component_inst_elem
(COMMA component_inst_elem)*
SEMI
;
anonymous_component_inst_elems
: ('external')?
component_inst_elem
(COMMA component_inst_elem)*
;
component_inst_elem
: id
(array)?
(EQ num)? // reset
(AT num)? // address
(INC num)? //addr inc
(MOD num)? //addr mod
;
array
: LSQ num
(COLON num)?
RSQ
;
instance_ref
: instance_ref_elem
(DOT instance_ref_elem)*
( DREF property )?
;
instance_ref_elem
: id
(LSQ num RSQ)?
;
property_assign
: default_property_assign SEMI
| explicit_property_assign SEMI
| post_property_assign SEMI
;
default_property_assign
: 'default'
explicit_property_assign
;
explicit_property_assign
: property_modifier
property
| property
( EQ property_assign_rhs )
;
post_property_assign
: instance_ref
( EQ property_assign_rhs )
;
property_assign_rhs
: property_rvalue_constant
| 'enum' enum_body
| instance_ref
| concat
;
concat
: LBRACE
concat_elem
(COMMA concat_elem)*
RBRACE
;
concat_elem
: instance_ref
| num
;
property
: 'name'
| 'desc'
| 'arbiter'
| 'rset'
| 'rclr'
| 'woclr'
| 'woset'
| 'we'
| 'wel'
| 'swwe'
| 'swwel'
| 'hwset'
| 'hwclr'
| 'swmod'
| 'swacc'
| 'sticky'
| 'stickybit'
| 'intr'
| 'anded'
| 'ored'
| 'xored'
| 'counter'
| 'overflow'
| 'sharedextbus'
| 'errextbus'
| 'reset'
| 'littleendian'
| 'bigendian'
| 'rsvdset'
| 'rsvdsetX'
| 'bridge'
| 'shared'
| 'msb0'
| 'lsb0'
| 'sync'
| 'async'
| 'cpuif_reset'
| 'field_reset'
| 'activehigh'
| 'activelow'
| 'singlepulse'
| 'underflow'
| 'incr'
| 'decr'
| 'incrwidth'
| 'decrwidth'
| 'incrvalue'
| 'decrvalue'
| 'saturate'
| 'decrsaturate'
| 'threshold'
| 'decrthreshold'
| 'dontcompare'
| 'donttest'
| 'internal'
| 'alignment'
| 'regwidth'
| 'fieldwidth'
| 'signalwidth'
| 'accesswidth'
| 'sw'
| 'hw'
| 'addressing'
| 'precedence'
| 'encode'
| 'resetsignal'
| 'clock'
| 'mask'
| 'enable'
| 'hwenable'
| 'hwmask'
| 'haltmask'
| 'haltenable'
| 'halt'
| 'next'
| PROPERTY
;
property_rvalue_constant
: 'true'
| 'false'
| 'rw'
| 'wr'
| 'r'
| 'w'
| 'na'
| 'compact'
| 'regalign'
| 'fullalign'
| 'hw'
| 'sw'
| num
| str
;
property_modifier
: 'posedge'
| 'negedge'
| 'bothedge'
| 'level'
| 'nonsticky'
;
id
: ID
| INST_ID
;
num
: NUM
;
str
: STR
;
enum_def
: 'enum' id
enum_body
SEMI
;
enum_body
: LBRACE (enum_entry)* RBRACE
;
enum_entry
: id
EQ num
( LBRACE (enum_property_assign)* RBRACE )?
SEMI
;
enum_property_assign
: ( 'name'
| 'desc'
)
EQ str
SEMI
;
fragment LETTER : ('a'..'z'|'A'..'Z') ;
WS : [ \t\r\n]+ -> skip;
COMMENT
: '/*' .*? '*/' -> skip
;
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
ID
: ('\\')?
(LETTER | '_')(LETTER | '_' | '0'..'9')*
;
fragment VNUM
: '\'' ( 'b' ('0' | '1' | '_')+
| 'd' ('0'..'9' | '_')+
| 'o' ('0'..'7' | '_')+
| 'h' ('0'..'9' | 'a'..'f' | 'A'..'F' | '_')+
)
;
NUM
: ('0'..'9')* (VNUM | ('0'..'9'))
| '0x' ('0'..'9' | 'a'..'f' | 'A'..'F')+
;
fragment ESC_DQUOTE
: '\\\"'
;
STR
: '"'
( ~('"' | '\n' | '\\')
| ESC_DQUOTE
| '\n'
)*
'"' // "
;
LBRACE : '{' ;
RBRACE : '}' ;
LSQ : '[' ;
RSQ : ']' ;
LPAREN : '(' ;
RPAREN : ')' ;
AT : '@' ;
OR : '|' ;
SEMI : ';' ;
COLON : ':' ;
COMMA : ',' ;
DOT : '.' ;
DREF : '->';
EQ : '=' ;
INC : '+=';
MOD : '%=';
|
Add SystemRDL grammar file
|
Add SystemRDL grammar file
|
ANTLR
|
apache-2.0
|
robinkjoy/systemrdl-compiler,robinkjoy/systemrdl-compiler
|
|
0d31016edf82befa359726d83d52a6ce79e3ef71
|
sharding-jdbc-ddl-parser/src/main/antlr4/io/shardingsphere/parser/antlr/sqlserver/SQLServerDDL.g4
|
sharding-jdbc-ddl-parser/src/main/antlr4/io/shardingsphere/parser/antlr/sqlserver/SQLServerDDL.g4
|
grammar SQLServerDDL;
import SQLServerKeyword, DataType, Keyword, BaseRule,DDLBase,MySQLDQL,DQLBase,Symbol;
createTable:
createTableOpWithName
(
createMemoryTable
|createDiskTable
)
;
createTableOpWithName:
CREATE TABLE tableName
;
createDiskTable:
(AS FILETABLE)?
LEFT_PAREN
createTableDefinition (COMMA createTableDefinition)*
periodClause?
RIGHT_PAREN
(ON ( schemeName LEFT_PAREN columnName RIGHT_PAREN
| fileGroup
| STRING ) )?
(TEXTIMAGE_ON (fileGroup | STRING) )?
((FILESTREAM_ON (schemeName)
| fileGroup
| STRING) )?
(WITH LEFT_PAREN tableOption (COMMA tableOption)* RIGHT_PAREN)?
;
periodClause:
COMMA PERIOD FOR SYSTEM_TIME LEFT_PAREN systemStartTimeColumnName
COMMA systemEndTimeColumnName RIGHT_PAREN
;
systemStartTimeColumnName:
ID
;
systemEndTimeColumnName:
ID
;
schemeName:
ID
;
fileGroup:
ID
;
groupName:
ID
;
constraintName:
ID
;
keyName:
ID
;
typeName:
ID
;
xmlSchemaCollection:
ID
;
columnSetName:
ID
;
directoryName:
ID
;
createTableDefinition:
columnDefinition
| computedColumnDefinition
| columnSetDefinition
| tableConstraint
| tableIndex
;
columnDefinition:
columnName dataType
columnDefinitionOption*
(columnConstraint (COMMA columnConstraint)*)?
columnIndex?
;
columnDefinitionOption:
FILESTREAM
|(COLLATE collationName )
|SPARSE
|( MASKED WITH LEFT_PAREN FUNCTION EQ_OR_ASSIGN STRING RIGHT_PAREN )
|((CONSTRAINT constraintName)? DEFAULT expr)
|(IDENTITY (LEFT_PAREN NUMBER COMMA NUMBER RIGHT_PAREN )? )
|(NOT FOR REPLICATION)
|(GENERATED ALWAYS AS ROW (START | END) HIDDEN_? )
|(NOT? NULL)
|ROWGUIDCOL
|( ENCRYPTED WITH
LEFT_PAREN
COLUMN_ENCRYPTION_KEY EQ_OR_ASSIGN keyName COMMA
ENCRYPTION_TYPE EQ_OR_ASSIGN ( DETERMINISTIC | RANDOMIZED ) COMMA
ALGORITHM EQ_OR_ASSIGN STRING
RIGHT_PAREN
)
|(columnConstraint (COMMA columnConstraint)*)
|columnIndex
;
dataType:
typeName
(
LEFT_PAREN
(
(NUMBER ( COMMA NUMBER )?)
| MAX
|((CONTENT | DOCUMENT)? xmlSchemaCollection)
)
RIGHT_PAREN
)?
;
columnConstraint :
(CONSTRAINT constraintName )?
( primaryKeyConstraint
| columnForeignKeyConstraint
| checkConstraint
)
;
primaryKeyConstraint:
(PRIMARY KEY | UNIQUE) (CLUSTERED | NONCLUSTERED)?
primaryKeyWithClause?
primaryKeyOnClause?
;
primaryKeyWithClause:
WITH
((FILLFACTOR EQ_OR_ASSIGN NUMBER)
| (LEFT_PAREN indexOption (COMMA indexOption)* RIGHT_PAREN)
)
;
primaryKeyOnClause:
ON (
(schemeName LEFT_PAREN columnName RIGHT_PAREN)
| fileGroup
| STRING
)
;
columnForeignKeyConstraint:
(FOREIGN KEY)?
REFERENCES tableName LEFT_PAREN columnName RIGHT_PAREN
foreignKeyOnAction
;
tableForeignKeyConstraint:
(FOREIGN KEY)? columnList
REFERENCES tableName columnList
foreignKeyOnAction
;
foreignKeyOnAction:
( ON DELETE foreignKeyOn )?
( ON UPDATE foreignKeyOn )?
( NOT FOR REPLICATION )?
;
foreignKeyOn:
NO ACTION
| CASCADE
| SET NULL
| SET DEFAULT
;
checkConstraint:
CHECK(NOT FOR REPLICATION)? LEFT_PAREN expr RIGHT_PAREN
;
columnIndex:
INDEX indexName ( CLUSTERED | NONCLUSTERED )?
( WITH LEFT_PAREN indexOption (COMMA indexOption)* RIGHT_PAREN )?
( ON (
(schemeName LEFT_PAREN columnName RIGHT_PAREN)
| fileGroup
| DEFAULT
)
)?
( FILESTREAM_ON ( fileGroup | schemeName | STRING ) )?
;
computedColumnDefinition :
columnName AS expr
(PERSISTED( NOT NULL )?)?
columnConstraint?
;
columnSetDefinition :
columnSetName ID COLUMN_SET FOR ALL_SPARSE_COLUMNS
;
tableConstraint:
(CONSTRAINT constraintName )?
(
tablePrimaryConstraint
| tableForeignKeyConstraint
| checkConstraint
)
;
tablePrimaryConstraint:
primaryKeyUnique
( CLUSTERED | NONCLUSTERED )?
columnNameWithSortsWithParen
primaryKeyWithClause?
primaryKeyOnClause?
;
primaryKeyUnique:
(PRIMARY KEY)
| UNIQUE
;
columnNameWithSortsWithParen:
LEFT_PAREN columnNameWithSort (COMMA columnNameWithSort)* RIGHT_PAREN
;
columnNameWithSort:
columnName ( ASC | DESC )?
;
tableIndex:
(
(
INDEX indexName
(
((CLUSTERED | NONCLUSTERED )? columnNameWithSortsWithParen)
| (CLUSTERED COLUMNSTORE)
| (( NONCLUSTERED )? COLUMNSTORE columnList)
)
)
(WHERE expr)?
(WITH LEFT_PAREN indexOption ( COMMA indexOption)* RIGHT_PAREN)?
( ON
(
(schemeName LEFT_PAREN columnName RIGHT_PAREN)
| groupName
| DEFAULT
)
)?
( FILESTREAM_ON ( groupName | schemeName | STRING ) )?
)
;
tableOption:
(DATA_COMPRESSION EQ_OR_ASSIGN ( NONE | ROW | PAGE ) (ON PARTITIONS LEFT_PAREN partitionExpressions RIGHT_PAREN )?)
|( FILETABLE_DIRECTORY EQ_OR_ASSIGN directoryName )
|( FILETABLE_COLLATE_FILENAME EQ_OR_ASSIGN ( collationName | DATABASE_DEAULT ) )
|( FILETABLE_PRIMARY_KEY_CONSTRAINT_NAME EQ_OR_ASSIGN constraintName )
|( FILETABLE_STREAMID_UNIQUE_CONSTRAINT_NAME EQ_OR_ASSIGN constraintName )
|( FILETABLE_FULLPATH_UNIQUE_CONSTRAINT_NAME EQ_OR_ASSIGN constraintName )
|( SYSTEM_VERSIONING EQ_OR_ASSIGN ON ( LEFT_PAREN HISTORY_TABLE EQ_OR_ASSIGN tableName
(COMMA DATA_CONSISTENCY_CHECK EQ_OR_ASSIGN ( ON | OFF ) )? RIGHT_PAREN)? )
|(
REMOTE_DATA_ARCHIVE EQ_OR_ASSIGN
(
(ON (LEFT_PAREN tableStretchOptions (COMMA tableStretchOptions)* RIGHT_PAREN )?)
| (OFF LEFT_PAREN MIGRATION_STATE EQ_OR_ASSIGN PAUSED RIGHT_PAREN)
)
)
|tableOptOption
;
tableStretchOptions:
( FILTER_PREDICATE EQ_OR_ASSIGN ( NULL | functionCall ) COMMA )?
MIGRATION_STATE EQ_OR_ASSIGN ( OUTBOUND | INBOUND | PAUSED )
;
indexOption :
(PAD_INDEX EQ_OR_ASSIGN ( ON | OFF ) )
| (FILLFACTOR EQ_OR_ASSIGN NUMBER)
| (IGNORE_DUP_KEY EQ_OR_ASSIGN ( ON | OFF ))
| (STATISTICS_NORECOMPUTE EQ_OR_ASSIGN ( ON | OFF ))
| (STATISTICS_INCREMENTAL EQ_OR_ASSIGN ( ON | OFF ))
| (ALLOW_ROW_LOCKS EQ_OR_ASSIGN ( ON | OFF))
| (ALLOW_PAGE_LOCKS EQ_OR_ASSIGN( ON | OFF))
| (COMPRESSION_DELAY EQ_OR_ASSIGN NUMBER MINUTES?)
| (DATA_COMPRESSION EQ_OR_ASSIGN ( NONE | ROW | PAGE | COLUMNSTORE | COLUMNSTORE_ARCHIVE )
( ON PARTITIONS LEFT_PAREN partitionExpressions RIGHT_PAREN )?)
;
partitionExpressions:
partitionExpression (COMMA partitionExpression)*
;
partitionExpression:
NUMBER
|partitionRange
;
partitionRange:
NUMBER TO NUMBER
;
createMemoryTable:
LEFT_PAREN
columnOption (COMMA columnOption)*
periodClause?
RIGHT_PAREN
(WITH LEFT_PAREN tableOptOption ( COMMA tableOptOption)* RIGHT_PAREN)?
;
columnOption:
columnOptDefinition
| (tableOptConstraint (COMMA tableOptConstraint)*)?
| tableIndex?
;
columnOptDefinition :
columnName dataType
columnOptDefinitionOpt*
;
columnOptDefinitionOpt:
(COLLATE collationName )
| (GENERATED ALWAYS AS ROW (START | END) HIDDEN_? )
| (NOT? NULL)
| ((CONSTRAINT constraintName )? DEFAULT expr )
| ( IDENTITY ( LEFT_PAREN NUMBER COMMA NUMBER RIGHT_PAREN ) )
| columnOptConstraint
| columnOptIndex
;
columnOptConstraint :
(CONSTRAINT constraintName )?
(
primaryKeyOptConstaint
| foreignKeyOptConstaint
| (CHECK LEFT_PAREN expr RIGHT_PAREN)
)
;
primaryKeyOptConstaint:
primaryKeyUnique
(
(NONCLUSTERED columnNameWithSortsWithParen)
| (NONCLUSTERED HASH WITH LEFT_PAREN BUCKET_COUNT EQ_OR_ASSIGN NUMBER RIGHT_PAREN)
)
;
foreignKeyOptConstaint:
(FOREIGN KEY )? REFERENCES tableName ( LEFT_PAREN columnName RIGHT_PAREN )?
;
tableOptConstraint:
( CONSTRAINT constraintName )?
(
(primaryKeyUnique
(
(NONCLUSTERED columnNameWithSortsWithParen)
| (NONCLUSTERED HASH columnList WITH LEFT_PAREN BUCKET_COUNT EQ_OR_ASSIGN NUMBER RIGHT_PAREN)
))
| (FOREIGN KEY columnList REFERENCES tableName columnList? )
| (CHECK LEFT_PAREN expr RIGHT_PAREN )
)
;
columnOptIndex:
INDEX indexName
(NONCLUSTERED? (HASH WITH LEFT_PAREN BUCKET_COUNT EQ_OR_ASSIGN NUMBER RIGHT_PAREN)? )
;
tableOptIndex :
INDEX indexName
(
( NONCLUSTERED ? HASH columnList WITH LEFT_PAREN BUCKET_COUNT EQ_OR_ASSIGN NUMBER RIGHT_PAREN )
| ( NONCLUSTERED ? columnNameWithSortsWithParen ( ON groupName | DEFAULT )? )
| (CLUSTERED COLUMNSTORE (WITH LEFT_PAREN COMPRESSION_DELAY EQ_OR_ASSIGN (NUMBER MINUTES?) RIGHT_PAREN)? ( ON groupName | DEFAULT )?)
)
;
tableOptOption :
(MEMORY_OPTIMIZED EQ_OR_ASSIGN ON)
| (DURABILITY EQ_OR_ASSIGN (SCHEMA_ONLY | SCHEMA_AND_DATA))
| (SYSTEM_VERSIONING EQ_OR_ASSIGN ON ( LEFT_PAREN HISTORY_TABLE EQ_OR_ASSIGN tableName
(COMMA DATA_CONSISTENCY_CHECK EQ_OR_ASSIGN ( ON | OFF ) )? RIGHT_PAREN )?)
;
privateExprOfDb:
windowedFunction
|atTimeZoneExpr
|castExpr
|convertExpr
;
atTimeZoneExpr:
ID (WITH TIME ZONE)? STRING
;
castExpr:
CAST LEFT_PAREN expr AS dataType (LEFT_PAREN NUMBER RIGHT_PAREN )? RIGHT_PAREN
;
convertExpr:
CONVERT ( dataType (LEFT_PAREN NUMBER RIGHT_PAREN )? COMMA expr (COMMA NUMBER)?)
;
windowedFunction:
functionCall overClause
;
overClause:
OVER
LEFT_PAREN
partitionByClause?
orderByClause?
rowRangeClause?
RIGHT_PAREN
;
partitionByClause:
PARTITION BY expr (COMMA expr)*
;
orderByClause:
ORDER BY orderByExpr (COMMA orderByExpr)*
;
orderByExpr:
expr (COLLATE collationName)? (ASC | DESC)?
;
rowRangeClause:
(ROWS | RANGE) windowFrameExtent
;
windowFrameExtent:
windowFramePreceding
| windowFrameBetween
;
windowFrameBetween:
BETWEEN windowFrameBound AND windowFrameBound
;
windowFrameBound:
windowFramePreceding
| windowFrameFollowing
;
windowFramePreceding:
(UNBOUNDED PRECEDING)
| NUMBER PRECEDING
| CURRENT ROW
;
windowFrameFollowing:
UNBOUNDED FOLLOWING
| NUMBER FOLLOWING
| CURRENT ROW
;
|
add sqlserver create table
|
add sqlserver create table
|
ANTLR
|
apache-2.0
|
apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,apache/incubator-shardingsphere,apache/incubator-shardingsphere
|
|
e145e306d9b8f3dfcadcf416838088a17b5e5c66
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if((last + next).equals("//") || last.equals(".") || last.equals(",")) {
seek(-1);
setText(url.substring(0, url.length() - 1));
}
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[4];
if(inHeader || intr || listLevel > 0) {
ends[0] = "\n";
} else {
ends[0] = null;
}
if(intr) {
ends[1] = "|";
} else {
ends[1] = null;
}
ends[2] = "\n\n";
ends[3] = "\r\n\r\n";
return ends;
}
public boolean checkWW() {
String ww = getText();
String prior = get(-ww.length() - 1);
String next = next();
return !(prior.matches("\\w") || next.matches("\\w"));
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+? {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|' {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|' {intr}? {breakOut(); intr=true;} ;
ThStart : '|=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : (('http' 's'? | 'ftp') '://' | 'mailto:') (~(' '|'\t'|'\r'|'\n'|'/'|'|'|'['|']')+ '/'?)+ {doUrl();};
WikiWords : (ALNUM+ ':' UPNUM ((LOWNUM|'.')* LOWNUM)+ (UPNUM ((LOWNUM|'.')* LOWNUM)*)+
|UPPER ((LOWNUM|'.')* LOWNUM)+ (UPNUM ((LOWNUM|'.')* LOWNUM)*)+) {checkWW()}?;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : ']]' -> mode(DEFAULT_MODE) ;
ImEnd : '}}' -> mode(DEFAULT_MODE) ;
Sep : '|' ;
InLink : ~(']'|'}'|'|')+ ;
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' (~'}' {seek(-1);} | EOF) {nowiki}? -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if((last + next).equals("//") || last.equals(".") || last.equals(",")) {
seek(-1);
setText(url.substring(0, url.length() - 1));
}
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[4];
if(inHeader || intr || listLevel > 0) {
ends[0] = "\n";
} else {
ends[0] = null;
}
if(intr) {
ends[1] = "|";
} else {
ends[1] = null;
}
ends[2] = "\n\n";
ends[3] = "\r\n\r\n";
return ends;
}
public boolean checkWW() {
String ww = getText();
String prior = get(-ww.length() - 1);
String next = next();
return !(prior.matches("\\w") || next.matches("\\w"));
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' WS? {doHdr();} ;
HEnd : ' '* '='* (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+? {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|' {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|' {intr}? {breakOut(); intr=true;} ;
ThStart : '|=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : (('http' 's'? | 'ftp') '://' | 'mailto:') (~(' '|'\t'|'\r'|'\n'|'/'|'|'|'['|']')+ '/'?)+ {doUrl();};
WikiWords : ((INTERWIKI UPNUM | UPPER) (ABBR | CAMEL) | INTERWIKI UPNUM+) {checkWW()}? ;
fragment INTERWIKI : ALPHA+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : ']]' -> mode(DEFAULT_MODE) ;
ImEnd : '}}' -> mode(DEFAULT_MODE) ;
Sep : '|' ;
InLink : ~(']'|'}'|'|')+ ;
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' (~'}' {seek(-1);} | EOF) {nowiki}? -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : ~' ' '}}}' {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
Simplify WikiWords rule
|
Simplify WikiWords rule
|
ANTLR
|
apache-2.0
|
CoreFiling/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,CoreFiling/reviki,CoreFiling/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,strr/reviki,CoreFiling/reviki,ashirley/reviki,strr/reviki,strr/reviki
|
a85e77d48be318c77201736d87429dbf39eebde3
|
sharding-jdbc-ddl-parser/src/main/antlr4/imports/SQLServerTableBase.g4
|
sharding-jdbc-ddl-parser/src/main/antlr4/imports/SQLServerTableBase.g4
|
grammar SQLServerTableBase;
import SQLServerKeyword,Keyword,Symbol,SQLServerBase,BaseRule,DataType;
columnDefinition:
columnName dataType
columnDefinitionOption*
(columnConstraint(COMMA columnConstraint)*)?
columnIndex?
;
columnDefinitionOption:
FILESTREAM
|(COLLATE collationName )
|SPARSE
|( MASKED WITH LEFT_PAREN FUNCTION EQ_OR_ASSIGN STRING RIGHT_PAREN )
|((CONSTRAINT constraintName)? DEFAULT expr)
|(IDENTITY (LEFT_PAREN NUMBER COMMA NUMBER RIGHT_PAREN )? )
|(NOT FOR REPLICATION)
|(GENERATED ALWAYS AS ROW (START | END) HIDDEN_? )
|(NOT? NULL)
|ROWGUIDCOL
|( ENCRYPTED WITH
LEFT_PAREN
COLUMN_ENCRYPTION_KEY EQ_OR_ASSIGN keyName COMMA
ENCRYPTION_TYPE EQ_OR_ASSIGN ( DETERMINISTIC | RANDOMIZED ) COMMA
ALGORITHM EQ_OR_ASSIGN STRING
RIGHT_PAREN
)
|(columnConstraint (COMMA columnConstraint)*)
|columnIndex
;
columnConstraint :
(CONSTRAINT constraintName)?
( primaryKeyConstraint
| columnForeignKeyConstraint
| checkConstraint
)
;
primaryKeyConstraint:
(primaryKey | UNIQUE)
(diskTablePrimaryKeyConstraintOption | memoryTablePrimaryKeyConstraintOption)
;
diskTablePrimaryKeyConstraintOption:
(CLUSTERED | NONCLUSTERED)?
primaryKeyWithClause?
primaryKeyOnClause?
;
columnForeignKeyConstraint:
(FOREIGN KEY)?
REFERENCES tableName LEFT_PAREN columnName RIGHT_PAREN
foreignKeyOnAction
;
foreignKeyOnAction:
( ON DELETE foreignKeyOn )?
( ON UPDATE foreignKeyOn )?
( NOT FOR REPLICATION )?
;
foreignKeyOn:
NO ACTION
| CASCADE
| SET NULL
| SET DEFAULT
;
memoryTablePrimaryKeyConstraintOption:
CLUSTERED withBucket?
;
hashWithBucket:
HASH columnList withBucket
;
withBucket:
WITH LEFT_PAREN BUCKET_COUNT EQ_OR_ASSIGN NUMBER RIGHT_PAREN
;
primaryKeyWithClause:
WITH
((FILLFACTOR EQ_OR_ASSIGN NUMBER)
| (LEFT_PAREN indexOption (COMMA indexOption)* RIGHT_PAREN)
)
;
primaryKeyOnClause:
onSchemaColumn
|onFileGroup
|onString
;
onSchemaColumn:
ON schemaName LEFT_PAREN columnName RIGHT_PAREN
;
onFileGroup:
ON fileGroup
;
onString:
ON STRING
;
checkConstraint:
CHECK(NOT FOR REPLICATION)? LEFT_PAREN expr RIGHT_PAREN
;
columnIndex:
INDEX indexName ( CLUSTERED | NONCLUSTERED )?
( WITH LEFT_PAREN indexOption (COMMA indexOption)* RIGHT_PAREN )?
indexOnClause?
( FILESTREAM_ON ( fileGroup | schemaName | STRING ) )?
;
indexOnClause:
onSchemaColumn
|onFileGroup
|onDefault
;
onDefault:
ON DEFAULT
;
tableConstraint:
(CONSTRAINT constraintName )?
(
tablePrimaryConstraint
| tableForeignKeyConstraint
| checkConstraint
)
;
tablePrimaryConstraint:
primaryKeyUnique
(diskTablePrimaryConstraintOption | memoryTablePrimaryConstraintOption)
;
primaryKeyUnique:
primaryKey
| UNIQUE
;
primaryKey:
PRIMARY KEY
;
diskTablePrimaryConstraintOption:
( CLUSTERED | NONCLUSTERED )?
columnNameWithSortsWithParen
primaryKeyWithClause?
primaryKeyOnClause?
;
memoryTablePrimaryConstraintOption:
NONCLUSTERED
(columnNameWithSortsWithParen
| hashWithBucket)
;
tableForeignKeyConstraint:
(FOREIGN KEY)? columnList
REFERENCES tableName columnList
foreignKeyOnAction
;
computedColumnDefinition :
columnName AS expr
(PERSISTED( NOT NULL )?)?
columnConstraint?
;
columnSetDefinition :
columnSetName ID COLUMN_SET FOR ALL_SPARSE_COLUMNS
;
|
Add SQLServerTableBase rule
|
Add SQLServerTableBase rule
|
ANTLR
|
apache-2.0
|
leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,apache/incubator-shardingsphere,apache/incubator-shardingsphere,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc
|
|
a910e5f0536eb6c3b400e351966a8398fc0661ea
|
res/Java.g4
|
res/Java.g4
|
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** A Java 1.7 grammar for ANTLR v4 derived from ANTLR v3 Java grammar.
* Uses ANTLR v4's left-recursive expression notation.
* It parses ECJ, Netbeans, JDK etc...
*
* Sam Harwell cleaned this up significantly and updated to 1.7!
*
* You can test with
*
* $ antlr4 Java.g4
* $ javac *.java
* $ grun Java compilationUnit *.java
*/
grammar Java;
// starting point for parsing a java file
compilationUnit
: packageDeclaration? importDeclaration* typeDeclaration* EOF
;
packageDeclaration
: annotation* 'package' qualifiedName ';'
;
importDeclaration
: 'import' 'static'? qualifiedName ('.' '*')? ';'
;
typeDeclaration
: classOrInterfaceModifier* classDeclaration
| classOrInterfaceModifier* enumDeclaration
| classOrInterfaceModifier* interfaceDeclaration
| classOrInterfaceModifier* annotationTypeDeclaration
| ';'
;
modifier
: classOrInterfaceModifier
| ( 'native'
| 'synchronized'
| 'transient'
| 'volatile'
)
;
classOrInterfaceModifier
: annotation // class or interface
| ( 'public' // class or interface
| 'protected' // class or interface
| 'private' // class or interface
| 'static' // class or interface
| 'abstract' // class or interface
| 'final' // class only -- does not apply to interfaces
| 'strictfp' // class or interface
)
;
variableModifier
: 'final'
| annotation
;
classDeclaration
: 'class' Identifier typeParameters?
('extends' type)?
('implements' typeList)?
classBody
;
typeParameters
: '<' typeParameter (',' typeParameter)* '>'
;
typeParameter
: Identifier ('extends' typeBound)?
;
typeBound
: type ('&' type)*
;
enumDeclaration
: ENUM Identifier ('implements' typeList)?
'{' enumConstants? ','? enumBodyDeclarations? '}'
;
enumConstants
: enumConstant (',' enumConstant)*
;
enumConstant
: annotation* Identifier arguments? classBody?
;
enumBodyDeclarations
: ';' classBodyDeclaration*
;
interfaceDeclaration
: 'interface' Identifier typeParameters? ('extends' typeList)? interfaceBody
;
typeList
: type (',' type)*
;
classBody
: '{' classBodyDeclaration* '}'
;
interfaceBody
: '{' interfaceBodyDeclaration* '}'
;
classBodyDeclaration
: ';'
| 'static'? block
| modifier* memberDeclaration
;
memberDeclaration
: methodDeclaration
| genericMethodDeclaration
| fieldDeclaration
| constructorDeclaration
| genericConstructorDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
/* We use rule this even for void methods which cannot have [] after parameters.
This simplifies grammar and we can consider void to be a type, which
renders the [] matching as a context-sensitive issue or a semantic check
for invalid return type after parsing.
*/
methodDeclaration
: (type|'void') Identifier formalParameters ('[' ']')*
('throws' qualifiedNameList)?
( methodBody
| ';'
)
;
genericMethodDeclaration
: typeParameters methodDeclaration
;
constructorDeclaration
: Identifier formalParameters ('throws' qualifiedNameList)?
constructorBody
;
genericConstructorDeclaration
: typeParameters constructorDeclaration
;
fieldDeclaration
: type variableDeclarators ';'
;
interfaceBodyDeclaration
: modifier* interfaceMemberDeclaration
| ';'
;
interfaceMemberDeclaration
: constDeclaration
| interfaceMethodDeclaration
| genericInterfaceMethodDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
constDeclaration
: type constantDeclarator (',' constantDeclarator)* ';'
;
constantDeclarator
: Identifier ('[' ']')* '=' variableInitializer
;
// see matching of [] comment in methodDeclaratorRest
interfaceMethodDeclaration
: (type|'void') Identifier formalParameters ('[' ']')*
('throws' qualifiedNameList)?
';'
;
genericInterfaceMethodDeclaration
: typeParameters interfaceMethodDeclaration
;
variableDeclarators
: variableDeclarator (',' variableDeclarator)*
;
variableDeclarator
: variableDeclaratorId ('=' variableInitializer)?
;
variableDeclaratorId
: Identifier ('[' ']')*
;
variableInitializer
: arrayInitializer
| expression
;
arrayInitializer
: '{' (variableInitializer (',' variableInitializer)* (',')? )? '}'
;
enumConstantName
: Identifier
;
type
: classOrInterfaceType ('[' ']')*
| primitiveType ('[' ']')*
;
classOrInterfaceType
: Identifier typeArguments? ('.' Identifier typeArguments? )*
;
primitiveType
: 'boolean'
| 'char'
| 'byte'
| 'short'
| 'int'
| 'long'
| 'float'
| 'double'
;
typeArguments
: '<' typeArgument (',' typeArgument)* '>'
;
typeArgument
: type
| '?' (('extends' | 'super') type)?
;
qualifiedNameList
: qualifiedName (',' qualifiedName)*
;
formalParameters
: '(' formalParameterList? ')'
;
formalParameterList
: formalParameter (',' formalParameter)* (',' lastFormalParameter)?
| lastFormalParameter
;
formalParameter
: variableModifier* type variableDeclaratorId
;
lastFormalParameter
: variableModifier* type '...' variableDeclaratorId
;
methodBody
: block
;
constructorBody
: block
;
qualifiedName
: Identifier ('.' Identifier)*
;
literal
: IntegerLiteral
| FloatingPointLiteral
| CharacterLiteral
| StringLiteral
| BooleanLiteral
| 'null'
;
// ANNOTATIONS
annotation
: '@' annotationName ( '(' ( elementValuePairs | elementValue )? ')' )?
;
annotationName : qualifiedName ;
elementValuePairs
: elementValuePair (',' elementValuePair)*
;
elementValuePair
: Identifier '=' elementValue
;
elementValue
: expression
| annotation
| elementValueArrayInitializer
;
elementValueArrayInitializer
: '{' (elementValue (',' elementValue)*)? (',')? '}'
;
annotationTypeDeclaration
: '@' 'interface' Identifier annotationTypeBody
;
annotationTypeBody
: '{' (annotationTypeElementDeclaration)* '}'
;
annotationTypeElementDeclaration
: modifier* annotationTypeElementRest
| ';' // this is not allowed by the grammar, but apparently allowed by the actual compiler
;
annotationTypeElementRest
: type annotationMethodOrConstantRest ';'
| classDeclaration ';'?
| interfaceDeclaration ';'?
| enumDeclaration ';'?
| annotationTypeDeclaration ';'?
;
annotationMethodOrConstantRest
: annotationMethodRest
| annotationConstantRest
;
annotationMethodRest
: Identifier '(' ')' defaultValue?
;
annotationConstantRest
: variableDeclarators
;
defaultValue
: 'default' elementValue
;
// STATEMENTS / BLOCKS
block
: '{' blockStatement* '}'
;
blockStatement
: localVariableDeclarationStatement
| statement
| typeDeclaration
;
localVariableDeclarationStatement
: localVariableDeclaration ';'
;
localVariableDeclaration
: variableModifier* type variableDeclarators
;
statement
: block
| ASSERT expression (':' expression)? ';'
| 'if' parExpression statement ('else' statement)?
| 'for' '(' forControl ')' statement
| 'while' parExpression statement
| 'do' statement 'while' parExpression ';'
| 'try' block (catchClause+ finallyBlock? | finallyBlock)
| 'try' resourceSpecification block catchClause* finallyBlock?
| 'switch' parExpression '{' switchBlockStatementGroup* switchLabel* '}'
| 'synchronized' parExpression block
| 'return' expression? ';'
| 'throw' expression ';'
| 'break' Identifier? ';'
| 'continue' Identifier? ';'
| ';'
| statementExpression ';'
| Identifier ':' statement
;
catchClause
: 'catch' '(' variableModifier* catchType Identifier ')' block
;
catchType
: qualifiedName ('|' qualifiedName)*
;
finallyBlock
: 'finally' block
;
resourceSpecification
: '(' resources ';'? ')'
;
resources
: resource (';' resource)*
;
resource
: variableModifier* classOrInterfaceType variableDeclaratorId '=' expression
;
/** Matches cases then statements, both of which are mandatory.
* To handle empty cases at the end, we add switchLabel* to statement.
*/
switchBlockStatementGroup
: switchLabel+ blockStatement+
;
switchLabel
: 'case' constantExpression ':'
| 'case' enumConstantName ':'
| 'default' ':'
;
forControl
: enhancedForControl
| forInit? ';' expression? ';' forUpdate?
;
forInit
: localVariableDeclaration
| expressionList
;
enhancedForControl
: variableModifier* type variableDeclaratorId ':' expression
;
forUpdate
: expressionList
;
// EXPRESSIONS
parExpression
: '(' expression ')'
;
expressionList
: expression (',' expression)*
;
statementExpression
: expression
;
constantExpression
: expression
;
expression
: primary
| expression '.' Identifier
| expression '.' 'this'
| expression '.' 'new' nonWildcardTypeArguments? innerCreator
| expression '.' 'super' superSuffix
| expression '.' explicitGenericInvocation
| expression '[' expression ']'
| expression '(' expressionList? ')'
| 'new' creator
| '(' type ')' expression
| expression ('++' | '--')
| ('+'|'-'|'++'|'--') expression
| ('~'|'!') expression
| expression ('*'|'/'|'%') expression
| expression ('+'|'-') expression
| expression ('<' '<' | '>' '>' '>' | '>' '>') expression
| expression ('<=' | '>=' | '>' | '<') expression
| expression 'instanceof' type
| expression ('==' | '!=') expression
| expression '&' expression
| expression '^' expression
| expression '|' expression
| expression '&&' expression
| expression '||' expression
| expression '?' expression ':' expression
| <assoc=right> expression
( '='
| '+='
| '-='
| '*='
| '/='
| '&='
| '|='
| '^='
| '>>='
| '>>>='
| '<<='
| '%='
)
expression
;
primary
: '(' expression ')'
| 'this'
| 'super'
| literal
| Identifier
| type '.' 'class'
| 'void' '.' 'class'
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | 'this' arguments)
;
creator
: nonWildcardTypeArguments createdName classCreatorRest
| createdName (arrayCreatorRest | classCreatorRest)
;
createdName
: Identifier typeArgumentsOrDiamond? ('.' Identifier typeArgumentsOrDiamond?)*
| primitiveType
;
innerCreator
: Identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
;
arrayCreatorRest
: '['
( ']' ('[' ']')* arrayInitializer
| expression ']' ('[' expression ']')* ('[' ']')*
)
;
classCreatorRest
: arguments classBody?
;
explicitGenericInvocation
: nonWildcardTypeArguments explicitGenericInvocationSuffix
;
nonWildcardTypeArguments
: '<' typeList '>'
;
typeArgumentsOrDiamond
: '<' '>'
| typeArguments
;
nonWildcardTypeArgumentsOrDiamond
: '<' '>'
| nonWildcardTypeArguments
;
superSuffix
: arguments
| '.' Identifier arguments?
;
explicitGenericInvocationSuffix
: 'super' superSuffix
| Identifier arguments
;
arguments
: '(' expressionList? ')'
;
// LEXER
// §3.9 Keywords
ABSTRACT : 'abstract';
ASSERT : 'assert';
BOOLEAN : 'boolean';
BREAK : 'break';
BYTE : 'byte';
CASE : 'case';
CATCH : 'catch';
CHAR : 'char';
CLASS : 'class';
CONST : 'const';
CONTINUE : 'continue';
DEFAULT : 'default';
DO : 'do';
DOUBLE : 'double';
ELSE : 'else';
ENUM : 'enum';
EXTENDS : 'extends';
FINAL : 'final';
FINALLY : 'finally';
FLOAT : 'float';
FOR : 'for';
IF : 'if';
GOTO : 'goto';
IMPLEMENTS : 'implements';
IMPORT : 'import';
INSTANCEOF : 'instanceof';
INT : 'int';
INTERFACE : 'interface';
LONG : 'long';
NATIVE : 'native';
NEW : 'new';
PACKAGE : 'package';
PRIVATE : 'private';
PROTECTED : 'protected';
PUBLIC : 'public';
RETURN : 'return';
SHORT : 'short';
STATIC : 'static';
STRICTFP : 'strictfp';
SUPER : 'super';
SWITCH : 'switch';
SYNCHRONIZED : 'synchronized';
THIS : 'this';
THROW : 'throw';
THROWS : 'throws';
TRANSIENT : 'transient';
TRY : 'try';
VOID : 'void';
VOLATILE : 'volatile';
WHILE : 'while';
// §3.10.1 Integer Literals
IntegerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
| BinaryIntegerLiteral
;
fragment
DecimalIntegerLiteral
: DecimalNumeral IntegerTypeSuffix?
;
fragment
HexIntegerLiteral
: HexNumeral IntegerTypeSuffix?
;
fragment
OctalIntegerLiteral
: OctalNumeral IntegerTypeSuffix?
;
fragment
BinaryIntegerLiteral
: BinaryNumeral IntegerTypeSuffix?
;
fragment
IntegerTypeSuffix
: [lL]
;
fragment
DecimalNumeral
: '0'
| NonZeroDigit (Digits? | Underscores Digits)
;
fragment
Digits
: Digit (DigitOrUnderscore* Digit)?
;
fragment
Digit
: '0'
| NonZeroDigit
;
fragment
NonZeroDigit
: [1-9]
;
fragment
DigitOrUnderscore
: Digit
| '_'
;
fragment
Underscores
: '_'+
;
fragment
HexNumeral
: '0' [xX] HexDigits
;
fragment
HexDigits
: HexDigit (HexDigitOrUnderscore* HexDigit)?
;
fragment
HexDigit
: [0-9a-fA-F]
;
fragment
HexDigitOrUnderscore
: HexDigit
| '_'
;
fragment
OctalNumeral
: '0' Underscores? OctalDigits
;
fragment
OctalDigits
: OctalDigit (OctalDigitOrUnderscore* OctalDigit)?
;
fragment
OctalDigit
: [0-7]
;
fragment
OctalDigitOrUnderscore
: OctalDigit
| '_'
;
fragment
BinaryNumeral
: '0' [bB] BinaryDigits
;
fragment
BinaryDigits
: BinaryDigit (BinaryDigitOrUnderscore* BinaryDigit)?
;
fragment
BinaryDigit
: [01]
;
fragment
BinaryDigitOrUnderscore
: BinaryDigit
| '_'
;
// §3.10.2 Floating-Point Literals
FloatingPointLiteral
: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
fragment
DecimalFloatingPointLiteral
: Digits '.' Digits? ExponentPart? FloatTypeSuffix?
| '.' Digits ExponentPart? FloatTypeSuffix?
| Digits ExponentPart FloatTypeSuffix?
| Digits FloatTypeSuffix
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedInteger
: Sign? Digits
;
fragment
Sign
: [+-]
;
fragment
FloatTypeSuffix
: [fFdD]
;
fragment
HexadecimalFloatingPointLiteral
: HexSignificand BinaryExponent FloatTypeSuffix?
;
fragment
HexSignificand
: HexNumeral '.'?
| '0' [xX] HexDigits? '.' HexDigits
;
fragment
BinaryExponent
: BinaryExponentIndicator SignedInteger
;
fragment
BinaryExponentIndicator
: [pP]
;
// §3.10.3 Boolean Literals
BooleanLiteral
: 'true'
| 'false'
;
// §3.10.4 Character Literals
CharacterLiteral
: '\'' SingleCharacter '\''
| '\'' EscapeSequence '\''
;
fragment
SingleCharacter
: ~['\\]
;
// §3.10.5 String Literals
StringLiteral
: '"' StringCharacters? '"'
;
fragment
StringCharacters
: StringCharacter+
;
fragment
StringCharacter
: ~["\\]
| EscapeSequence
;
// §3.10.6 Escape Sequences for Character and String Literals
fragment
EscapeSequence
: '\\' [btnfr"'\\]
| OctalEscape
| UnicodeEscape
;
fragment
OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment
ZeroToThree
: [0-3]
;
// §3.10.7 The Null Literal
NullLiteral
: 'null'
;
// §3.11 Separators
LPAREN : '(';
RPAREN : ')';
LBRACE : '{';
RBRACE : '}';
LBRACK : '[';
RBRACK : ']';
SEMI : ';';
COMMA : ',';
DOT : '.';
// §3.12 Operators
ASSIGN : '=';
GT : '>';
LT : '<';
BANG : '!';
TILDE : '~';
QUESTION : '?';
COLON : ':';
EQUAL : '==';
LE : '<=';
GE : '>=';
NOTEQUAL : '!=';
AND : '&&';
OR : '||';
INC : '++';
DEC : '--';
ADD : '+';
SUB : '-';
MUL : '*';
DIV : '/';
BITAND : '&';
BITOR : '|';
CARET : '^';
MOD : '%';
ADD_ASSIGN : '+=';
SUB_ASSIGN : '-=';
MUL_ASSIGN : '*=';
DIV_ASSIGN : '/=';
AND_ASSIGN : '&=';
OR_ASSIGN : '|=';
XOR_ASSIGN : '^=';
MOD_ASSIGN : '%=';
LSHIFT_ASSIGN : '<<=';
RSHIFT_ASSIGN : '>>=';
URSHIFT_ASSIGN : '>>>=';
// §3.8 Identifiers (must appear after all keywords in the grammar)
Identifier
: JavaLetter JavaLetterOrDigit*
;
fragment
JavaLetter
: [a-zA-Z$_] // these are the "java letters" below 0xFF
| // covers all characters above 0xFF which are not a surrogate
~[\u0000-\u00FF\uD800-\uDBFF]
{Character.isJavaIdentifierStart(_input.LA(-1))}?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
fragment
JavaLetterOrDigit
: [a-zA-Z0-9$_] // these are the "java letters or digits" below 0xFF
| // covers all characters above 0xFF which are not a surrogate
~[\u0000-\u00FF\uD800-\uDBFF]
{Character.isJavaIdentifierPart(_input.LA(-1))}?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
//
// Additional symbols not defined in the lexical specification
//
AT : '@';
ELLIPSIS : '...';
//
// Whitespace and comments
//
WS : [ \t\r\n\u000C]+ -> skip
;
COMMENT
: '/*' .*? '*/' -> skip
;
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
|
add ANTLR 4 grammar for Java
|
add ANTLR 4 grammar for Java
|
ANTLR
|
apache-2.0
|
zmughal/oop-analysis,zmughal/oop-analysis
|
|
6bd9ab796e6b1d834fe892dae830e5fe0a3f64c4
|
sharding-core/src/main/antlr4/imports/PostgreSQLDCLStatement.g4
|
sharding-core/src/main/antlr4/imports/PostgreSQLDCLStatement.g4
|
grammar PostgreSQLDCLStatement;
import PostgreSQLKeyword, Keyword, PostgreSQLBase, BaseRule, DataType, Symbol;
grant
: GRANT privType columnList? (COMMA privType columnList?)*
privOnClause
TO roleSpecifications
(WITH GRANT OPTION)?
;
privType
: ALL PRIVILEGES?
| SELECT
| INSERT
| UPDATE
| DELETE
| TRUNCATE
| REFERENCES
| TRIGGER
| CREATE
| CONNECT
| TEMPORARY
| TEMP
| EXECUTE
| USAGE
;
privOnClause
: ON (
TABLE? tableNames
| ALL TABLES IN SCHEMA schemaNames
| SEQUENCE sequenceNames
| ALL SEQUENCES IN SCHEMA schemaNames
| DATABASE databaseNames
| DOMAIN domainNames
| FOREIGN DATA WRAPPER fdwNames
| FOREIGN SERVER serverNames
| (FUNCTION | PROCEDURE | ROUTINE) routineName (LP_ (argMode? argName? dataType (COMMA argMode? argName? dataType)*)? RP_)?
(COMMA (FUNCTION | PROCEDURE | ROUTINE) routineName (LP_ (argMode? argName? dataType (COMMA argMode? argName? dataType)*)? RP_)?)*
| ALL (FUNCTION | PROCEDURE | ROUTINE) IN SCHEMA schemaNames
| LANGUAGE langNames
| LARGE OBJECT loids
| SCHEMA schemaNames
| TABLESPACE tablespaceNames
| TYPE typeNames
)
;
fdwName
: ID
;
fdwNames
: fdwName (COMMA fdwName)*
;
argMode
: IN | OUT | INOUT | VARIADIC
;
argName
: ID
;
langName
: ID
;
langNames
: langName (COMMA langName)*
;
loid
: ID
;
loids
: loid (COMMA loid)*
;
roleSpecification
: GROUP? roleName | PUBLIC | CURRENT_USER | SESSION_USER
;
roleSpecifications
: roleSpecification (COMMA roleSpecification)*
;
grantRole
: GRANT roleNames TO roleNames (WITH ADMIN OPTION)?
;
revoke
: REVOKE (GRANT OPTION FOR)?
privType columnList? (COMMA privType columnList?)*
privOnClause
FROM roleSpecifications
(CASCADE | RESTRICT)
;
revokeRole
: REVOKE (ADMIN OPTION FOR)?
roleNames FROM roleNames
(CASCADE | RESTRICT)
;
createUser
: CREATE USER roleName (WITH? roleOptions)?
;
roleOption
: SUPERUSER
| NOSUPERUSER
| CREATEDB
| NOCREATEDB
| CREATEROLE
| NOCREATEROLE
| INHERIT
| NOINHERIT
| LOGIN
| NOLOGIN
| REPLICATION
| NOREPLICATION
| BYPASSRLS
| NOBYPASSRLS
| CONNECTION LIMIT NUMBER
| ENCRYPTED? PASSWORD STRING
| VALID UNTIL STRING
| IN ROLE roleNames
| IN GROUP roleNames
| ROLE roleNames
| ADMIN roleNames
| USER roleNames
| SYSID STRING
;
roleOptions
: roleOption (COMMA roleOption)*
;
alterUser
: ALTER USER roleSpecification WITH roleOptions
;
renameUser
: ALTER USER roleName RENAME TO roleName
;
alterUserSetConfig
: ALTER USER (roleSpecification | ALL) (IN DATABASE databaseName)? SET STRING ((TO | EQ) (STRING | ID | NUMBER | DEFAULT) | FROM CURRENT)
;
alterUserResetConfig
: ALTER USER (roleSpecification | ALL) (IN DATABASE databaseName)? RESET (STRING | ALL)
;
dropUser
: DROP USER (IF EXISTS)? roleNames
;
createRole
: CREATE ROLE roleName (WITH? roleOptions)?
;
alterRole
: ALTER ROLE roleSpecification WITH roleOptions
;
renameRole
: ALTER ROLE roleName RENAME TO roleName
;
alterRoleSetConfig
: ALTER ROLE (roleSpecification | ALL) (IN DATABASE databaseName)? SET STRING ((TO | EQ) (STRING | ID | NUMBER | DEFAULT) | FROM CURRENT)
;
alterRoleResetConfig
: ALTER ROLE (roleSpecification | ALL) (IN DATABASE databaseName)? RESET (STRING | ALL)
;
dropRole
: DROP ROLE (IF EXISTS)? roleNames
;
|
grammar PostgreSQLDCLStatement;
import PostgreSQLKeyword, Keyword, PostgreSQLBase, BaseRule, DataType, Symbol;
grant
: GRANT privType columnList? (COMMA privType columnList?)*
privOnClause
TO roleSpecifications
(WITH GRANT OPTION)?
;
privType
: ALL PRIVILEGES?
| SELECT
| INSERT
| UPDATE
| DELETE
| TRUNCATE
| REFERENCES
| TRIGGER
| CREATE
| CONNECT
| TEMPORARY
| TEMP
| EXECUTE
| USAGE
;
privOnClause
: ON (
TABLE? tableNames
| ALL TABLES IN SCHEMA schemaNames
| SEQUENCE sequenceNames
| ALL SEQUENCES IN SCHEMA schemaNames
| DATABASE databaseNames
| DOMAIN domainNames
| FOREIGN DATA WRAPPER fdwNames
| FOREIGN SERVER serverNames
| (FUNCTION | PROCEDURE | ROUTINE) routineName (LP_ (argMode? argName? dataType (COMMA argMode? argName? dataType)*)? RP_)?
(COMMA (FUNCTION | PROCEDURE | ROUTINE) routineName (LP_ (argMode? argName? dataType (COMMA argMode? argName? dataType)*)? RP_)?)*
| ALL (FUNCTION | PROCEDURE | ROUTINE) IN SCHEMA schemaNames
| LANGUAGE langNames
| LARGE OBJECT loids
| SCHEMA schemaNames
| TABLESPACE tablespaceNames
| TYPE typeNames
)
;
fdwName
: ID
;
fdwNames
: fdwName (COMMA fdwName)*
;
argMode
: IN | OUT | INOUT | VARIADIC
;
argName
: ID
;
langName
: ID
;
langNames
: langName (COMMA langName)*
;
loid
: ID
;
loids
: loid (COMMA loid)*
;
roleSpecification
: GROUP? roleName | PUBLIC | CURRENT_USER | SESSION_USER
;
roleSpecifications
: roleSpecification (COMMA roleSpecification)*
;
grantRole
: GRANT roleNames TO roleNames (WITH ADMIN OPTION)?
;
revoke
: REVOKE (GRANT OPTION FOR)?
privType columnList? (COMMA privType columnList?)*
privOnClause
FROM roleSpecifications
(CASCADE | RESTRICT)
;
revokeRole
: REVOKE (ADMIN OPTION FOR)?
roleNames FROM roleNames
(CASCADE | RESTRICT)
;
createUser
: CREATE USER userName (WITH? roleOptions)?
;
roleOption
: SUPERUSER
| NOSUPERUSER
| CREATEDB
| NOCREATEDB
| CREATEROLE
| NOCREATEROLE
| INHERIT
| NOINHERIT
| LOGIN
| NOLOGIN
| REPLICATION
| NOREPLICATION
| BYPASSRLS
| NOBYPASSRLS
| CONNECTION LIMIT NUMBER
| ENCRYPTED? PASSWORD STRING
| VALID UNTIL STRING
| IN ROLE roleNames
| IN GROUP roleNames
| ROLE roleNames
| ADMIN roleNames
| USER roleNames
| SYSID STRING
;
roleOptions
: roleOption (COMMA roleOption)*
;
alterUser
: ALTER USER roleSpecification WITH roleOptions
;
renameUser
: ALTER USER userName RENAME TO userName
;
alterUserSetConfig
: alterRoleConfigOp SET STRING ((TO | EQ) (STRING | ID | NUMBER | DEFAULT) | FROM CURRENT)
;
alterRoleConfigOp
: ALTER USER (roleSpecification | ALL) (IN DATABASE databaseName)?
;
alterUserResetConfig
: alterRoleConfigOp RESET (STRING | ALL)
;
dropUser
: DROP USER (IF EXISTS)? roleNames
;
createRole
: CREATE ROLE roleName (WITH? roleOptions)?
;
alterRole
: ALTER ROLE roleSpecification WITH roleOptions
;
renameRole
: ALTER ROLE roleName RENAME TO roleName
;
alterRoleSetConfig
: alterRoleConfigOp SET STRING ((TO | EQ) (STRING | ID | NUMBER | DEFAULT) | FROM CURRENT)
;
alterRoleResetConfig
: alterRoleConfigOp RESET (STRING | ALL)
;
dropRole
: DROP ROLE (IF EXISTS)? roleNames
;
|
fix postgre user role
|
fix postgre user role
|
ANTLR
|
apache-2.0
|
apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc
|
31f88984a024ea59de29e2eca900249e3f3b2111
|
ooj/src/main/antlr4/Java1.g4
|
ooj/src/main/antlr4/Java1.g4
|
/*
Copyright (c) <2015>, Amanj Sherwany, Terence Parr, Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** A Java 1.0 grammar for ANTLR v4, it is taken from ``The Java Language
* Specification 1.0'', and adapted to work with ANTLR v4.
*
* The LEXER part is almost completely taken from Java 7's lexer by Terence
* Parr and Sam Harwell.
*
* The uses ANTLR v4's left-recursive expression notation.
* It parses all standard Java 1.0 class, and also TTY
* class from sun.tools.ttydebug pacakge.
*
* You can test with
*
* $ antlr4 Java1.g4
* $ javac *.java
* $ grun Java1 compilationUnit *.java
*/
grammar Java1;
// 19.2 Starting point
compilationUnit
: packageDeclaration? importDeclaration* typeDeclaration* EOF
;
// 19.3 Literals
literal
: IntegerLiteral # IntLit
| FloatingPointLiteral # DoubleLit
| BooleanLiteral # BoolLit
| CharacterLiteral # CharLit
| StringLiteral # StringLit
| NullLiteral # NullLit
;
// 19.4 Types
type
: primitiveType
| referenceType
;
primitiveType
: 'byte'
| 'short'
| 'int'
| 'long'
| 'char'
| 'float'
| 'double'
| 'boolean'
;
referenceType
: classOrInterfaceType
| arrayType
;
classOrInterfaceType
: name
;
arrayType
: primitiveType '[' ']'
| name '[' ']'
| arrayType '[' ']'
;
// 19.5 Names
name
: Identifier ('.' Identifier)*
;
packageDeclaration
: 'package' Identifier ('.' Identifier)* ';'
;
importDeclaration
: singleTypeImportDeclaration
| typeImportOnDemandDeclaration
;
singleTypeImportDeclaration
: 'import' name ';'
;
typeImportOnDemandDeclaration
: 'import' name '.' '*' ';'
;
typeDeclaration
: classDeclaration
| interfaceDeclaration
;
// 19.7 LALR(1) Productions
modifier
: 'public'
| 'protected'
| 'private'
| 'static'
| 'abstract'
| 'final'
| 'native'
| 'synchronized'
| 'transient'
| 'volatile'
;
// 19.8 Classes
// 19.8.1 Class Declaration
classDeclaration
: modifier* 'class' Identifier parent? interfaces? classBody
;
parent
: 'extends' classOrInterfaceType
;
interfaces
: 'implements' classOrInterfaceTypeList
;
classBody
: '{' classBodyDeclaration* '}'
;
classBodyDeclaration
: classMemberDeclaration
| staticInitializer
| constructorDeclaration
;
classMemberDeclaration
: fieldDeclaration
| methodDeclaration
;
// 19.8.2 Field Declaration
fieldDeclaration
: modifier* type variableDeclarators ';'
;
variableDeclarators
: variableDeclarator (',' variableDeclarator)*
;
variableDeclarator
: variableDeclaratorId ('=' variableInitializer)?
;
variableDeclaratorId
: Identifier dims?
;
variableInitializer
: expression
| arrayInitializer
;
// 19.8.3 Methods
methodDeclaration
: methodHeader methodBody
;
methodHeader
: modifier* type methodDeclarator throwsClause? # TypedMethodHeader
| modifier* 'void' methodDeclaratorNoDims throwsClause? # VoidMethodHeader
;
methodDeclarator
: methodDeclaratorNoDims dims?
;
methodDeclaratorNoDims
: Identifier '(' formalParameterList? ')'
;
formalParameterList
: formalParameter (',' formalParameter)*
;
formalParameter
: type variableDeclaratorId
;
throwsClause
: 'throws' classOrInterfaceTypeList
;
classOrInterfaceTypeList
: classOrInterfaceType (',' classOrInterfaceType)*
;
methodBody
: block
| emptyStatement
;
// 19.8.4 Static Initializers
staticInitializer
: 'static' block
;
// 19.8.5 Constructor Declaration
constructorDeclaration
: modifier* constructorDeclarator throwsClause? constructorBody
;
constructorDeclarator
: methodDeclaratorNoDims
;
constructorBody
: '{' explicitConstructorInvocation? blockStatement* '}'
;
explicitConstructorInvocation
: qual=('this' | 'super') '(' argumentList? ')' ';'
;
// 19.9 Interfaces
interfaceDeclaration
: modifier* 'interface' Identifier extendsInterfaces? interfaceBody
;
extendsInterfaces
: 'extends' classOrInterfaceTypeList
;
interfaceBody
: '{' interfaceMemberDeclaration* '}'
;
interfaceMemberDeclaration
: constantDeclaration
| abstractMethodDeclaration
;
constantDeclaration
: fieldDeclaration
;
abstractMethodDeclaration
: methodHeader ';'
;
// 19.10 Productions from §10: Arrays
arrayInitializer
: '{' variableInitializers? ','? '}'
;
variableInitializers
: variableInitializer (',' variableInitializer)*
;
// 19.11 Productions from §14: Blocks and Statements
block
: '{' blockStatement* '}'
;
blockStatement
: localVariableDeclarationStatement
| statement
;
localVariableDeclarationStatement
: localVariableDeclaration ';'
;
localVariableDeclaration
: type variableDeclarators
;
statement
: statementWithoutTrailingSubstatement
| labeledStatement
| ifThenStatement
| ifThenElseStatement
| whileStatement
| forStatement
;
statementNoShortIf
: statementWithoutTrailingSubstatement
| labeledStatementNoShortIf
| ifThenElseStatementNoShortIf
| whileStatementNoShortIf
| forStatementNoShortIf
;
statementWithoutTrailingSubstatement
: block
| emptyStatement
| expressionStatement
| switchStatement
| doStatement
| breakStatement
| continueStatement
| returnStatement
| synchronizedStatement
| throwStatement
| tryStatement
;
emptyStatement
: ';'
;
labeledStatement
: Identifier ':' statement
;
labeledStatementNoShortIf
: Identifier ':' statementNoShortIf
;
expressionStatement
: statementExpression ';'
;
statementExpression
: expression
;
ifThenStatement
: 'if' '(' expression ')' statement
;
ifThenElseStatement
: 'if' '(' expression ')' statementNoShortIf 'else' statement
;
ifThenElseStatementNoShortIf
: 'if' '(' expression ')' statementNoShortIf 'else' statementNoShortIf
;
switchStatement
: 'switch' '(' expression ')' switchBlock
;
switchBlock
: '{' switchBlockStatementGroups? switchLabel* '}'
;
switchBlockStatementGroups
: switchBlockStatementGroup+
;
switchBlockStatementGroup
: switchLabel+ blockStatement*
;
switchLabel
: caseLabel
| defaultCase
;
caseLabel
: 'case' constantExpression ':'
;
defaultCase
: 'default' ':'
;
whileStatement
: 'while' '(' expression ')' statement
;
whileStatementNoShortIf
: 'while' '(' expression ')' statementNoShortIf
;
doStatement
: 'do' statement 'while' '(' expression ')' ';'
;
forStatement
: 'for' '(' forInit? ';' expression? ';' forUpdate? ')' statement
;
forStatementNoShortIf
: 'for' '(' forInit? ';' expression? ';' forUpdate? ')'
statementNoShortIf
;
forInit
: statementExpressionList
| localVariableDeclaration
;
forUpdate
: statementExpressionList
;
statementExpressionList
: statementExpression (',' statementExpression)*
;
breakStatement
: 'break' Identifier? ';'
;
continueStatement
: 'continue' Identifier? ';'
;
returnStatement
: 'return' expression? ';'
;
throwStatement
: 'throw' expression ';'
;
synchronizedStatement
: 'synchronized' '(' expression ')' block
;
tryStatement
: 'try' block catches
| 'try' block catches? finallyClause
;
catches
: catchClause+
;
catchClause
: 'catch' '(' formalParameter ')' block
;
finallyClause
: 'finally' block
;
// 19.12 Productions from §15: Expressions
primary
: primaryNoNewArray
| arrayCreationExpression
;
arrayAccess
: name '[' expression ']'
| primaryNoNewArray '[' expression ']'
;
primaryNoNewArray
: literal # PrimaryLit
| 'this' # PrimaryThis
| '(' expression ')' # PrimaryExpr
| classInstanceCreationExpression # PrimaryNew
| arrayCreationExpression '.' Identifier # PrimaryNewArray
| primaryNoNewArray '.' Identifier # PrimarySelect
| 'super' '.' Identifier # PrimarySuperSelect
| name '(' argumentList? ')' # PrimaryApply
| primaryNoNewArray '.' Identifier '(' argumentList? ')' # PrimaryQualApply
| arrayCreationExpression '.' Identifier
'(' argumentList? ')' # PrimaryArrayApply
| 'super' '.' Identifier '(' argumentList? ')' # PrimarySuperApply
| name '[' expression ']' # PrimaryArrayAccess
| primaryNoNewArray '[' expression ']' # PrimaryArrayAccess2
;
classInstanceCreationExpression
: 'new' classOrInterfaceType '(' argumentList? ')'
;
argumentList
: expression (',' expression)*
;
arrayCreationExpression
: 'new' primitiveType dimExpr+ dims?
| 'new' classOrInterfaceType dimExpr+ dims?
;
dimExpr
: '[' expression ']'
;
dims
: dim+
;
dim
: '[' ']'
;
fieldAccess
: primary '.' Identifier # QualifiedFieldAccess
| 'super' '.' Identifier # SuperFieldAccess
;
methodInvocation
: name '(' argumentList? ')' # SimpleMethodInvocation
| primary '.' Identifier '(' argumentList? ')' # QualifiedMethodInvocation
| 'super' '.' Identifier '(' argumentList? ')' # SuperMethodInvocation
;
assignment
: leftHandSide op=('='
| '*='
| '/='
| '%='
| '+='
| '-='
| '>>='
| '<<='
| '>>>='
| '&='
| '|='
| '^=') expression
;
leftHandSide
: name
| fieldAccess
| arrayAccess
;
expression
: primary # PrimaryExpression
| name # NameExpression
| '(' type ')' expression # CastExpression
| expression op=('++' | '--') # PostfixExpression
| op=('++' | '--' | '-' | '+') expression # UnaryExpression
| op=('~' | '!') expression # BitwiseUnaryExpression
| expression op=('*' | '/' | '%') expression # MulBinaryExpression
| expression op=('+' | '-') expression # AddBinaryExpression
| expression op=('>>' | '<<' | '>>>') expression # ShiftBinaryExpression
| expression op=('<' | '>' | '<=' | '>=') expression # RelBinaryExpression
| expression 'instanceof' type # InstanceOfExpression
| expression op=('==' | '!=') expression # EquBinaryExpression
| expression '&' expression # BitAndBinaryExpression
| expression '|' expression # BitOrBinaryExpression
| expression '^' expression # BitXOrBinaryExpression
| expression '&&' expression # AndBinaryExpression
| expression '||' expression # OrBinaryExpression
| expression '?' expression ':' expression # TernaryExpression
| leftHandSide
op=('=' | '*=' | '/=' | '%=' | '+=' |
'-=' | '<<=' | '>>=' | '>>>=' |
'&=' | '^=' | '|=') expression # AssignExpression
;
constantExpression
: expression
;
// LEXER
// §3.9 Keywords
ABSTRACT : 'abstract';
BOOLEAN : 'boolean';
BREAK : 'break';
BYTE : 'byte';
CASE : 'case';
CATCH : 'catch';
CHAR : 'char';
CLASS : 'class';
CONST : 'const';
CONTINUE : 'continue';
DEFAULT : 'default';
DO : 'do';
DOUBLE : 'double';
ELSE : 'else';
EXTENDS : 'extends';
FINAL : 'final';
FINALLY : 'finally';
FLOAT : 'float';
FOR : 'for';
GOTO : 'goto';
IF : 'if';
IMPLEMENTS : 'implements';
IMPORT : 'import';
INSTANCEOF : 'instanceof';
INT : 'int';
INTERFACE : 'interface';
LONG : 'long';
NATIVE : 'native';
NEW : 'new';
PACKAGE : 'package';
PRIVATE : 'private';
PROTECTED : 'protected';
PUBLIC : 'public';
RETURN : 'return';
SHORT : 'short';
STATIC : 'static';
SUPER : 'super';
SWITCH : 'switch';
SYNCHRONIZED : 'synchronized';
THIS : 'this';
THROW : 'throw';
THROWS : 'throws';
TRANSIENT : 'transient';
TRY : 'try';
VOID : 'void';
VOLATILE : 'volatile';
WHILE : 'while';
// §3.10.1 Integer Literals
IntegerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
| BinaryIntegerLiteral
;
fragment
DecimalIntegerLiteral
: DecimalNumeral IntegerTypeSuffix?
;
fragment
HexIntegerLiteral
: HexNumeral IntegerTypeSuffix?
;
fragment
OctalIntegerLiteral
: OctalNumeral IntegerTypeSuffix?
;
fragment
BinaryIntegerLiteral
: BinaryNumeral IntegerTypeSuffix?
;
fragment
IntegerTypeSuffix
: [lL]
;
fragment
DecimalNumeral
: '0'
| NonZeroDigit Digits?
;
fragment
Digits
: Digit+
;
fragment
Digit
: '0'
| NonZeroDigit
;
fragment
NonZeroDigit
: [1-9]
;
fragment
HexNumeral
: '0' [xX] HexDigits
;
fragment
HexDigits
: HexDigit+
;
fragment
HexDigit
: [0-9a-fA-F]
;
fragment
OctalNumeral
: '0' OctalDigit+
;
fragment
OctalDigit
: [0-7]
;
fragment
BinaryNumeral
: '0' [bB] BinaryDigit+
;
fragment
BinaryDigit
: [01]
;
// §3.10.2 Floating-Point Literals
FloatingPointLiteral
: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
fragment
DecimalFloatingPointLiteral
: Digits '.' Digits? ExponentPart? FloatTypeSuffix?
| '.' Digits ExponentPart? FloatTypeSuffix?
| Digits ExponentPart FloatTypeSuffix?
| Digits FloatTypeSuffix
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedInteger
: Sign? Digits
;
fragment
Sign
: [+-]
;
fragment
FloatTypeSuffix
: [fFdD]
;
fragment
HexadecimalFloatingPointLiteral
: HexSignificand BinaryExponent FloatTypeSuffix?
;
fragment
HexSignificand
: HexNumeral '.'?
| '0' [xX] HexDigits? '.' HexDigits
;
fragment
BinaryExponent
: BinaryExponentIndicator SignedInteger
;
fragment
BinaryExponentIndicator
: [pP]
;
// §3.10.3 Boolean Literals
BooleanLiteral
: 'true'
| 'false'
;
// §3.10.4 Character Literals
CharacterLiteral
: '\'' SingleCharacter '\''
| '\'' EscapeSequence '\''
;
fragment
SingleCharacter
: ~['\\]
;
// §3.10.5 String Literals
StringLiteral
: '"' StringCharacters? '"'
;
fragment
StringCharacters
: StringCharacter+
;
fragment
StringCharacter
: ~["\\]
| EscapeSequence
;
// §3.10.6 Escape Sequences for Character and String Literals
fragment
EscapeSequence
: '\\' [btnfr"'\\]
| OctalEscape
| UnicodeEscape
;
fragment
OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment
ZeroToThree
: [0-3]
;
// §3.10.7 The Null Literal
NullLiteral
: 'null'
;
// §3.11 Separators
LPAREN : '(';
RPAREN : ')';
LBRACE : '{';
RBRACE : '}';
LBRACK : '[';
RBRACK : ']';
SEMI : ';';
COMMA : ',';
DOT : '.';
// §3.12 Operators
ASSIGN : '=';
GT : '>';
LT : '<';
BANG : '!';
TILDE : '~';
QUESTION : '?';
COLON : ':';
EQUAL : '==';
LE : '<=';
GE : '>=';
NOTEQUAL : '!=';
AND : '&&';
OR : '||';
INC : '++';
DEC : '--';
ADD : '+';
SUB : '-';
MUL : '*';
DIV : '/';
BITAND : '&';
BITOR : '|';
CARET : '^';
MOD : '%';
ADD_ASSIGN : '+=';
SUB_ASSIGN : '-=';
MUL_ASSIGN : '*=';
DIV_ASSIGN : '/=';
AND_ASSIGN : '&=';
OR_ASSIGN : '|=';
XOR_ASSIGN : '^=';
MOD_ASSIGN : '%=';
LSHIFT_ASSIGN : '<<=';
RSHIFT_ASSIGN : '>>=';
URSHIFT_ASSIGN : '>>>=';
// §3.8 Identifiers (must appear after all keywords in the grammar)
Identifier
: JavaLetter JavaLetterOrDigit*
;
fragment
JavaLetter
: [a-zA-Z$_] // these are the "java letters" below 0xFF
| // covers all characters above 0xFF which are not a surrogate
~[\u0000-\u00FF\uD800-\uDBFF]
{Character.isJavaIdentifierStart(_input.LA(-1))}?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
fragment
JavaLetterOrDigit
: [a-zA-Z0-9$_] // these are the "java letters or digits" below 0xFF
| // covers all characters above 0xFF which are not a surrogate
~[\u0000-\u00FF\uD800-\uDBFF]
{Character.isJavaIdentifierPart(_input.LA(-1))}?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
//
// Additional symbols not defined in the lexical specification
//
AT : '@';
ELLIPSIS : '...';
//
// Whitespace and comments
//
WS : [ \t\r\n\u000C]+ -> skip
;
COMMENT
: '/*' .*? '*/' -> skip
;
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
|
Add OOJ's parser
|
Add OOJ's parser
|
ANTLR
|
bsd-3-clause
|
amanjpro/languages-a-la-carte,amanjpro/languages-a-la-carte
|
|
e3069a8ee3fd5e57b2c1789674690deebc957aa6
|
idl/IDL.g4
|
idl/IDL.g4
|
/*
[The "BSD licence"]
Copyright (c) 2014 AutoTest Technologies, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** CORBA IDL v3.5 grammar built from the OMG IDL language spec 'ptc-13-02-02'
http://www.omg.org/spec/IDL35/Beta1/PDF/
Initial IDL spec implementation in ANTLR v3 by Dong Nguyen.
Migrated to ANTLR v4 by Steve Osselton.
Current revision prepared by Nikita Visnevski.
*/
grammar IDL;
specification
: import_decl* definition+
;
definition
: type_decl SEMICOLON
| const_decl SEMICOLON
| except_decl SEMICOLON
| interface_or_forward_decl SEMICOLON
| module SEMICOLON
| value SEMICOLON
| type_id_decl SEMICOLON
| type_prefix_decl SEMICOLON
| event SEMICOLON
| component SEMICOLON
| home_decl SEMICOLON
;
module
: KW_MODULE ID LEFT_BRACE definition+ RIGHT_BRACE
;
interface_or_forward_decl
: interface_decl
| forward_decl
;
interface_decl
: interface_header LEFT_BRACE interface_body RIGHT_BRACE
;
forward_decl
: ( KW_ABSTRACT | KW_LOCAL )? KW_INTERFACE ID
;
interface_header
: ( KW_ABSTRACT | KW_LOCAL )? KW_INTERFACE ID ( interface_inheritance_spec )?
;
interface_body
: export*
;
export
: type_decl SEMICOLON
| const_decl SEMICOLON
| except_decl SEMICOLON
| attr_decl SEMICOLON
| op_decl SEMICOLON
| type_id_decl SEMICOLON
| type_prefix_decl SEMICOLON
;
interface_inheritance_spec
: COLON interface_name ( COMA interface_name )*
;
interface_name
: scoped_name
;
scoped_name
: ( DOUBLE_COLON )? ID ( DOUBLE_COLON ID )*
;
value
: ( value_decl | value_abs_decl | value_box_decl | value_forward_decl )
;
value_forward_decl
: ( KW_ABSTRACT )? KW_VALUETYPE ID
;
value_box_decl
: KW_VALUETYPE ID type_spec
;
value_abs_decl
: KW_ABSTRACT KW_VALUETYPE ID value_inheritance_spec LEFT_BRACE export* RIGHT_BRACE
;
value_decl
: value_header LEFT_BRACE value_element* RIGHT_BRACE
;
value_header
: ( KW_CUSTOM )? KW_VALUETYPE ID value_inheritance_spec
;
value_inheritance_spec
: ( COLON ( KW_TRUNCATABLE )? value_name ( COMA value_name )* )? ( KW_SUPPORTS interface_name ( COMA interface_name )* )?
;
value_name
: scoped_name
;
value_element
: ( export | state_member | init_decl )
;
state_member
: ( KW_PUBLIC | KW_PRIVATE ) type_spec declarators SEMICOLON
;
init_decl
: KW_FACTORY ID LEFT_BRACKET ( init_param_decls )? RIGHT_BRACKET ( raises_expr )? SEMICOLON
;
init_param_decls
: init_param_decl ( COMA init_param_decl )*
;
init_param_decl
: init_param_attribute param_type_spec simple_declarator
;
init_param_attribute
: KW_IN
;
const_decl
: KW_CONST const_type ID EQUAL const_exp
;
const_type
: integer_type
| char_type
| wide_char_type
| boolean_type
| floating_pt_type
| string_type
| wide_string_type
| fixed_pt_const_type
| scoped_name
| octet_type
;
const_exp
: or_expr
;
or_expr
: xor_expr ( PIPE xor_expr )*
;
xor_expr
: and_expr ( CARET and_expr )*
;
and_expr
: shift_expr ( AMPERSAND shift_expr )*
;
shift_expr
: add_expr ( ( RIGHT_SHIFT | LEFT_SHIFT ) add_expr )*
;
add_expr
: mult_expr ( ( PLUS | MINUS ) mult_expr )*
;
mult_expr
: unary_expr ( ( '*' | SLASH | PERCENT ) unary_expr )*
;
unary_expr
: unary_operator primary_expr
| primary_expr
;
unary_operator
: ( MINUS | PLUS | TILDE )
;
primary_expr
: scoped_name
| literal
| LEFT_BRACKET const_exp RIGHT_BRACKET
;
literal
: ( HEX_LITERAL | INTEGER_LITERAL | STRING_LITERAL | WIDE_STRING_LITERAL | CHARACTER_LITERAL | WIDE_CHARACTER_LITERAL | FIXED_PT_LITERAL | FLOATING_PT_LITERAL | BOOLEAN_LITERAL )
;
positive_int_const
: const_exp
;
type_decl
: KW_TYPEDEF type_declarator
| struct_type
| union_type
| enum_type
| KW_NATIVE simple_declarator
| constr_forward_decl
;
type_declarator
: type_spec declarators
;
type_spec
: simple_type_spec
| constr_type_spec
;
simple_type_spec
: base_type_spec
| template_type_spec
| scoped_name
;
base_type_spec
: floating_pt_type
| integer_type
| char_type
| wide_char_type
| boolean_type
| octet_type
| any_type
| object_type
| value_base_type
;
template_type_spec
: sequence_type
| string_type
| wide_string_type
| fixed_pt_type
;
constr_type_spec
: struct_type
| union_type
| enum_type
;
declarators
: declarator ( COMA declarator )*
;
declarator
: simple_declarator
| complex_declarator
;
simple_declarator
: ID
;
complex_declarator
: array_declarator
;
floating_pt_type
: ( KW_FLOAT | KW_DOUBLE | KW_LONG KW_DOUBLE )
;
integer_type
: signed_int
| unsigned_int
;
signed_int
: signed_short_int
| signed_long_int
| signed_longlong_int
;
signed_short_int
: KW_SHORT
;
signed_long_int
: KW_LONG
;
signed_longlong_int
: KW_LONG KW_LONG
;
unsigned_int
: unsigned_short_int
| unsigned_long_int
| unsigned_longlong_int
;
unsigned_short_int
: KW_UNSIGNED KW_SHORT
;
unsigned_long_int
: KW_UNSIGNED KW_LONG
;
unsigned_longlong_int
: KW_UNSIGNED KW_LONG KW_LONG
;
char_type
: KW_CHAR
;
wide_char_type
: KW_WCHAR
;
boolean_type
: KW_BOOLEAN
;
octet_type
: KW_OCTET
;
any_type
: KW_ANY
;
object_type
: KW_OBJECT
;
struct_type
: KW_STRUCT ID LEFT_BRACE member_list RIGHT_BRACE
;
member_list
: member+
;
member
: type_spec declarators SEMICOLON
;
union_type
: KW_UNION ID KW_SWITCH LEFT_BRACKET switch_type_spec RIGHT_BRACKET LEFT_BRACE switch_body RIGHT_BRACE
;
switch_type_spec
: integer_type
| char_type
| boolean_type
| enum_type
| scoped_name
;
switch_body
: case_stmt+
;
case_stmt
: case_label+ element_spec SEMICOLON
;
case_label
: KW_CASE const_exp COLON
| KW_DEFAULT COLON
;
element_spec
: type_spec declarator
;
enum_type
: KW_ENUM ID LEFT_BRACE enumerator ( COMA enumerator )* RIGHT_BRACE
;
enumerator
: ID
;
sequence_type
: KW_SEQUENCE LEFT_ANG_BRACKET simple_type_spec COMA positive_int_const RIGHT_ANG_BRACKET
| KW_SEQUENCE LEFT_ANG_BRACKET simple_type_spec RIGHT_ANG_BRACKET
;
string_type
: KW_STRING LEFT_ANG_BRACKET positive_int_const RIGHT_ANG_BRACKET
| KW_STRING
;
wide_string_type
: KW_WSTRING LEFT_ANG_BRACKET positive_int_const RIGHT_ANG_BRACKET
| KW_WSTRING
;
array_declarator
: ID fixed_array_size+
;
fixed_array_size
: LEFT_SQUARE_BRACKET positive_int_const RIGHT_SQUARE_BRACKET
;
attr_decl
: readonly_attr_spec
| attr_spec
;
except_decl
: KW_EXCEPTION ID LEFT_BRACE member* RIGHT_BRACE
;
op_decl
: ( op_attribute )? op_type_spec ID parameter_decls ( raises_expr )? ( context_expr )?
;
op_attribute
: KW_ONEWAY
;
op_type_spec
: param_type_spec
| KW_VOID
;
parameter_decls
: LEFT_BRACKET param_decl ( COMA param_decl )* RIGHT_BRACKET
| LEFT_BRACKET RIGHT_BRACKET
;
param_decl
: param_attribute param_type_spec
simple_declarator
;
param_attribute
: KW_IN
| KW_OUT
| KW_INOUT
;
raises_expr
: KW_RAISES LEFT_BRACKET scoped_name ( COMA scoped_name )* RIGHT_BRACKET
;
context_expr
: KW_CONTEXT LEFT_BRACKET STRING_LITERAL ( COMA STRING_LITERAL )* RIGHT_BRACKET
;
param_type_spec
: base_type_spec
| string_type
| wide_string_type
| scoped_name
;
fixed_pt_type
: KW_FIXED LEFT_ANG_BRACKET positive_int_const COMA positive_int_const RIGHT_ANG_BRACKET
;
fixed_pt_const_type
: KW_FIXED
;
value_base_type
: KW_VALUEBASE
;
constr_forward_decl
: KW_STRUCT ID
| KW_UNION ID
;
import_decl
: KW_IMPORT imported_scope SEMICOLON
;
imported_scope
: scoped_name | STRING_LITERAL
;
type_id_decl
: KW_TYPEID scoped_name STRING_LITERAL
;
type_prefix_decl
: KW_TYPEPREFIX scoped_name STRING_LITERAL
;
readonly_attr_spec
: KW_READONLY KW_ATTRIBUTE param_type_spec readonly_attr_declarator
;
readonly_attr_declarator
: simple_declarator raises_expr
| simple_declarator ( COMA simple_declarator )*
;
attr_spec
: KW_ATTRIBUTE param_type_spec attr_declarator
;
attr_declarator
: simple_declarator attr_raises_expr
| simple_declarator ( COMA simple_declarator )*
;
attr_raises_expr
: get_excep_expr ( set_excep_expr )?
| set_excep_expr
;
get_excep_expr
: KW_GETRAISES exception_list
;
set_excep_expr
: KW_SETRAISES exception_list
;
exception_list
: LEFT_BRACKET scoped_name ( COMA scoped_name )* RIGHT_BRACKET
;
component
: component_decl
| component_forward_decl
;
component_forward_decl
: KW_COMPONENT ID
;
component_decl
: component_header LEFT_BRACE component_body RIGHT_BRACE
;
component_header
: KW_COMPONENT ID ( component_inheritance_spec )? ( supported_interface_spec )?
;
supported_interface_spec
: KW_SUPPORTS scoped_name ( COMA scoped_name )*
;
component_inheritance_spec
: COLON scoped_name
;
component_body
: component_export*
;
component_export
: provides_decl SEMICOLON
| uses_decl SEMICOLON
| emits_decl SEMICOLON
| publishes_decl SEMICOLON
| consumes_decl SEMICOLON
| attr_decl SEMICOLON
;
provides_decl
: KW_PROVIDES interface_type ID
;
interface_type
: scoped_name
| KW_OBJECT
;
uses_decl
: KW_USES ( KW_MULTIPLE )? interface_type ID
;
emits_decl
: KW_EMITS scoped_name ID
;
publishes_decl
: KW_PUBLISHES scoped_name ID
;
consumes_decl
: KW_CONSUMES scoped_name ID
;
home_decl
: home_header home_body
;
home_header
: KW_HOME ID ( home_inheritance_spec )? ( supported_interface_spec )? KW_MANAGES scoped_name ( primary_key_spec )?
;
home_inheritance_spec
: COLON scoped_name
;
primary_key_spec
: KW_PRIMARYKEY scoped_name
;
home_body
: LEFT_BRACE home_export* RIGHT_BRACE
;
home_export
: export
| factory_decl SEMICOLON
| finder_decl SEMICOLON
;
factory_decl
: KW_FACTORY ID LEFT_BRACKET ( init_param_decls )? RIGHT_BRACKET ( raises_expr )?
;
finder_decl
: KW_FINDER ID LEFT_BRACKET ( init_param_decls )? RIGHT_BRACKET ( raises_expr )?
;
event
: ( event_decl | event_abs_decl | event_forward_decl)
;
event_forward_decl
: ( KW_ABSTRACT )? KW_EVENTTYPE ID
;
event_abs_decl
: KW_ABSTRACT KW_EVENTTYPE ID value_inheritance_spec LEFT_BRACE export* RIGHT_BRACE
;
event_decl
: event_header LEFT_BRACE value_element* RIGHT_BRACE
;
event_header
: ( KW_CUSTOM )? KW_EVENTTYPE ID value_inheritance_spec
;
INTEGER_LITERAL : ('0' | '1'..'9' '0'..'9'*) INTEGER_TYPE_SUFFIX? ;
OCTAL_LITERAL : '0' ('0'..'7')+ INTEGER_TYPE_SUFFIX? ;
HEX_LITERAL : '0' ('x' | 'X') HEX_DIGIT+ INTEGER_TYPE_SUFFIX? ;
fragment
HEX_DIGIT : ( '0'..'9' | 'a'..'f' | 'A'..'F' ) ;
fragment
INTEGER_TYPE_SUFFIX : ('l' | 'L') ;
FLOATING_PT_LITERAL
: ('0'..'9')+ '.' ('0'..'9')* EXPONENT? FLOAT_TYPE_SUFFIX?
| '.' ('0'..'9')+ EXPONENT? FLOAT_TYPE_SUFFIX?
| ('0'..'9')+ EXPONENT FLOAT_TYPE_SUFFIX?
| ('0'..'9')+ EXPONENT? FLOAT_TYPE_SUFFIX
;
FIXED_PT_LITERAL
: FLOATING_PT_LITERAL
;
fragment
EXPONENT : ('e' | 'E') (PLUS|MINUS)? ('0'..'9')+ ;
fragment
FLOAT_TYPE_SUFFIX : ('f' | 'F' | 'd' | 'D') ;
WIDE_CHARACTER_LITERAL
: 'L' CHARACTER_LITERAL
;
CHARACTER_LITERAL
: '\'' ( ESCAPE_SEQUENCE | ~('\'' | '\\') ) '\''
;
WIDE_STRING_LITERAL
: 'L' STRING_LITERAL
;
STRING_LITERAL
: '"' ( ESCAPE_SEQUENCE | ~('\\' | '"') )* '"'
;
BOOLEAN_LITERAL
: 'TRUE'
| 'FALSE'
;
fragment
ESCAPE_SEQUENCE
: '\\' ('b' | 't' | 'n' | 'f' | 'r' | '\"' | '\'' | '\\')
| UNICODE_ESCAPE
| OCTAL_ESCAPE
;
fragment
OCTAL_ESCAPE
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UNICODE_ESCAPE
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;
fragment
LETTER
: '\u0024'
| '\u0041'..'\u005a'
| '\u005f'
| '\u0061'..'\u007a'
| '\u00c0'..'\u00d6'
| '\u00d8'..'\u00f6'
| '\u00f8'..'\u00ff'
| '\u0100'..'\u1fff'
| '\u3040'..'\u318f'
| '\u3300'..'\u337f'
| '\u3400'..'\u3d2d'
| '\u4e00'..'\u9fff'
| '\uf900'..'\ufaff'
;
fragment
ID_DIGIT
: '\u0030'..'\u0039'
| '\u0660'..'\u0669'
| '\u06f0'..'\u06f9'
| '\u0966'..'\u096f'
| '\u09e6'..'\u09ef'
| '\u0a66'..'\u0a6f'
| '\u0ae6'..'\u0aef'
| '\u0b66'..'\u0b6f'
| '\u0be7'..'\u0bef'
| '\u0c66'..'\u0c6f'
| '\u0ce6'..'\u0cef'
| '\u0d66'..'\u0d6f'
| '\u0e50'..'\u0e59'
| '\u0ed0'..'\u0ed9'
| '\u1040'..'\u1049'
;
SEMICOLON: ';';
COLON: ':';
COMA: ',';
LEFT_BRACE: '{';
RIGHT_BRACE: '}';
LEFT_BRACKET: '(';
RIGHT_BRACKET: ')';
LEFT_SQUARE_BRACKET: '[';
RIGHT_SQUARE_BRACKET: ']';
TILDE: '~';
SLASH: '/';
LEFT_ANG_BRACKET: '<';
RIGHT_ANG_BRACKET: '>';
STAR: '*';
PLUS: '+';
MINUS: '-';
CARET: '^';
AMPERSAND: '&';
PIPE: '|';
EQUAL: '=';
PERCENT: '%';
DOUBLE_COLON: '::';
RIGHT_SHIFT: '>>';
LEFT_SHIFT: '<<';
KW_SETRAISES: 'setraises';
KW_OUT: 'out';
KW_EMITS: 'emits';
KW_STRING: 'string';
KW_SWITCH: 'switch';
KW_PUBLISHES: 'publishes';
KW_TYPEDEF: 'typedef';
KW_USES: 'uses';
KW_PRIMARYKEY: 'primarykey';
KW_CUSTOM: 'custom';
KW_OCTET: 'octet';
KW_SEQUENCE: 'sequence';
KW_IMPORT: 'import';
KW_STRUCT: 'struct';
KW_NATIVE: 'native';
KW_READONLY: 'readonly';
KW_FINDER: 'finder';
KW_RAISES: 'raises';
KW_VOID: 'void';
KW_PRIVATE: 'private';
KW_EVENTTYPE: 'eventtype';
KW_WCHAR: 'wchar';
KW_IN: 'in';
KW_DEFAULT: 'default';
KW_PUBLIC: 'public';
KW_SHORT: 'short';
KW_LONG: 'long';
KW_ENUM: 'enum';
KW_WSTRING: 'wstring';
KW_CONTEXT: 'context';
KW_HOME: 'home';
KW_FACTORY: 'factory';
KW_EXCEPTION: 'exception';
KW_GETRAISES: 'getraises';
KW_CONST: 'const';
KW_VALUEBASE: 'ValueBase';
KW_VALUETYPE: 'valuetype';
KW_SUPPORTS: 'supports';
KW_MODULE: 'module';
KW_OBJECT: 'Object';
KW_TRUNCATABLE: 'truncatable';
KW_UNSIGNED: 'unsigned';
KW_FIXED: 'fixed';
KW_UNION: 'union';
KW_ONEWAY: 'oneway';
KW_ANY: 'any';
KW_CHAR: 'char';
KW_CASE: 'case';
KW_FLOAT: 'float';
KW_BOOLEAN: 'boolean';
KW_MULTIPLE: 'multiple';
KW_ABSTRACT: 'abstract';
KW_INOUT: 'inout';
KW_PROVIDES: 'provides';
KW_CONSUMES: 'consumes';
KW_DOUBLE: 'double';
KW_TYPEPREFIX: 'typeprefix';
KW_TYPEID: 'typeid';
KW_ATTRIBUTE: 'attribute';
KW_LOCAL: 'local';
KW_MANAGES: 'manages';
KW_INTERFACE: 'interface';
KW_COMPONENT: 'component';
ID
: LETTER (LETTER|ID_DIGIT)*
;
WS
: (' ' | '\r' | '\t' | '\u000C' | '\n') -> channel(HIDDEN)
;
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
LINE_COMMENT
: '//' ~('\n' | '\r')* '\r'? '\n' -> channel(HIDDEN)
;
// [EOF] IDL.g4
|
Add IDL
|
Add IDL
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
9e6602681b4db67b944e0a75059362d44321707f
|
sharding-core/src/main/antlr4/imports/SQLServerDCLStatement.g4
|
sharding-core/src/main/antlr4/imports/SQLServerDCLStatement.g4
|
grammar SQLServerDCLStatement;
import SQLServerKeyword, DataType, Keyword, SQLServerBase, BaseRule, Symbol;
permissions
: ID *?
;
|
add permissions
|
add permissions
|
ANTLR
|
apache-2.0
|
leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,apache/incubator-shardingsphere,apache/incubator-shardingsphere
|
|
5af05c8e6bc1585dcdebf7e8abf05a63c4bd5eb2
|
src/gr/uoi/cs/daintiness/hecate/parser/DDL.g4
|
src/gr/uoi/cs/daintiness/hecate/parser/DDL.g4
|
grammar DDL;
options { language = Java; }
start : ( sql_statement SQ? )+ EOF ;
sql_statement
: ddl_statement
| other_statement
;
ddl_statement
: drop_statement
| create_statement
| alter_statement
| update_statement
;
other_statement
: insert_statement
| namespace
| commit
;
namespace : USE ident ;
commit : COMMIT ;
drop_statement
: DROP ( TABLE | DATABASE ) IF EXISTS nameList PURGE?
| DROP ( TABLE | DATABASE ) nameList PURGE? ( IF EXISTS )?
;
insert_statement : INSERT IGNORE? INTO table_name parNameList? VALUES parValueList (CO parValueList)* ;
create_statement : CREATE ( database | table | index | view | triger | pl_sql) ;
alter_statement : ALTER TABLE table_name ( ADD constraint )+ ;
update_statement
: UPDATE table_name SET col_name EQ value ( CO col_name EQ value)*
;
database
: ( DATABASE | SCHEMA ) ( IF NOT EXISTS )? schema_name create_option*
;
create_option
: DEFAULT? CHARACTER SET EQ? charset_name
| DEFAULT? COLLATE EQ? collation_name
;
index
: ( ( UNIQUE | FULLTEXT | SPATIAL )? ) INDEX
index_name index_type? ON table_name parNameList index_option?
;
index_type : USING ( BTREE | HASH )? ;
index_option : KEY_BSIZE '='? value | index_type ;
view : VIEW ident parNameList AS LP ~RP* RP ;
triger : ( OR REPLACE )? TRIGGER triger_name consume_until_end ;
pl_sql : ( OR REPLACE )? ( FUNCTION | PROCEDURE ) ident consume_until_end ;
consume_until_end : ( ~(END) | END ~(SQ) )* END ;
table
: TEMPORARY? TABLE ( IF NOT EXISTS )?
table_name LP ( table_definition ( CO | SQ )? )* RP
table_option*
;
table_definition : column | constraint ;
table_option
: DEFAULT? CHARACTER SET EQ? ident
| DEFAULT? ident ( EQ? ( ident | INT ) )? ;
column
: col_name data_type data_option? create_option?
( column_option | constraint | reference_definition )*
( ON UPDATE ident )?
;
column_option : NOT? NULL | AUTO_INC | DEFAULT ( value | NULL ) ;
constraint
: CONSTRAINT? PRIMARY KEY constr_name? index_type? parNameList? index_option*
| ( INDEX | KEY ) index_name? ( ON col_name )? index_type? parNameList index_option*
| CONSTRAINT? UNIQUE ( INDEX | KEY )? index_name? index_type? parNameList? index_option*
| ( FULLTEXT | SPATIAL ) ( INDEX | KEY )? index_name? parNameList index_option*
| CONSTRAINT? constr_name? FOREIGN KEY index_name? parNameList reference_definition
| CONSTRAINT constr_name CHECK consume_par
;
consume_par : LP ( ~(LP|RP) | consume_par )* RP ;
reference_definition : REFERENCES table_name parNameList reference_option* ;
reference_option : ON ( UPDATE | DELETE ) refs ;
refs : ( ( RESTRICT | CASCADE ) DEFERRABLE? ) | ( SET NULL ) | ( NO ACTION ) ;
data_type
: ident+ size? ( ENUM parValueList )?
| ENUM parValueList
| SET parValueList
;
data_option : SIGNED | UNSIGNED | ZEROFILL | BINARY ;
schema_name : ident ;
table_name : ident ;
col_name : ident ;
index_name : ident ;
charset_name : ident ;
collation_name: ident ;
constr_name : ident ;
triger_name : ident ;
nameList : ident ( LP value RP )? ( CO ident ( LP value RP )? )* ;
parNameList : LP nameList RP ;
valueList : value ( CO value )* ;
parValueList: LP valueList RP ;
valuesList : LP parValueList* RP ;
size : LP INT ( CO INT )? RP ;
order : ASC | DESC ;
value : number | NULL | ident | function ;
ident : ID | restricted | quoted_rest | string ;
number : INT | ( quote INT quote ) ;
quote : QO | DQ | GR ;
quoted_rest: quote restricted quote ;
string : STRING_G | STRING_D | STRING_Q ;
function : ident consume_par ;
special_char
: EQ | LP | RP | SQ | CO | QO | US | AT | DA | HA | SL | ST | DQ | GR | CL
| DO | SP | CA | VB | PL
;
restricted
: ACTION | ADD | ALTER | ASC | BIGINT | BINARY | BIT | BTREE | CASCADE
| CHARACTER | CHAR | CHECK | COLLATE | COL_FORMAT | COMMIT | CONSTRAINT
| CREATE | DATABASE | DECIMAL | DELETE | DESC | DISK | DOUBLE
| DYNAMIC | ENUM | EXISTS | FIXED | FOREIGN | FULLTEXT | HASH | IF | INSERT
| INTEGER | INTO | IS | NUMERIC | REAL | REFERENCES | RESTRICT | SCHEMA
| SET | SMALLINT | SPATIAL | STORAGE | TABLE | TEMPORARY | UNSIGNED
| UPDATE | USE | USING | VALUES | VARBINARY | VARCHAR | YEAR | ZEROFILL
| REPLACE | AUTO_INC | IGNORE | END | FUNCTION
;
STRING_G : '`' ( '\\' '`' | . )*? '`' ;
STRING_Q : '"' ( '\\' '"' | . )*? '"' ;
STRING_D : '\'' ( '\\' '\'' | . )*? '\'' ;
WS : [ \r\t\u000C\n]+ -> skip ;
COMMENT : CommentStart .*? CommentStop -> skip ;
LINE_COMMENT: CommentLineStart ~[\r\n]* ('\r'? '\n' | EOF) -> skip ;
EQ : '=' ; LP : '(' ; RP : ')' ; SQ : ';' ; CO : ',' ; QO : '\'' ; US : '_' ;
AT : '@' ; DA : '-' ; HA : '#' ; SL : '/' ; ST : '*' ; DQ : '"' ; GR : '`' ;
CL : ':' ; DO : '.' ; SP : ' ' ; CA : '$' ; VB : '|' ; PL : '+' ;
CONFLICT_START : '<<<<<<<' ;
CONFLICT_END : '>>>>>>>' ;
CONFLICT : CONFLICT_START .*? CONFLICT_END ~[\r\n]* ('\r'? '\n' | EOF) -> skip ;
ACTION : A C T I O N ;
ADD : A D D ;
ALTER : A L T E R ;
AS : A S ;
ASC : A S C ;
AUTO_INC : A U T O US I N C R E M E N T ;
BIGINT : B I G I N T ;
BINARY : B I N A R Y ;
BIT : B I T ;
BTREE : B T R E E ;
CASCADE : C A S C A D E ;
CHARACTER : C H A R A C T E R ;
CHAR : C H A R ;
CHECK : C H E C K ;
COLLATE : C O L L A T E ;
COL_FORMAT: C O L U M N US F O R M A T ;
COMMIT : C O M M I T ;
CONSTRAINT: C O N S T R A I N T ;
CREATE : C R E A T E ;
DATABASE : D A T A B A S E ;
DECIMAL : D E M I C A L ;
DEFAULT : D E F A U L T ;
DEFERRABLE: D E F E R R A B L E ;
DELETE : D E L E T E ;
DESC : D E S C ;
DISK : D I S K ;
DOUBLE : D O U B L E ;
DROP : D R O P ;
DYNAMIC : D Y N A M I C ;
END : E N D ;
ENUM : E N U M ;
EXISTS : E X I S T S ;
FIXED : F I X E D ;
FOREIGN : F O R E I G N ;
FULLTEXT : F U L L T E X T ;
FUNCTION : F U N C T I O N ;
HASH : H A S H ;
IF : I F ;
IGNORE : I G N O R E ;
INDEX : I N D E X ;
INSERT : I N S E R T ;
INTEGER : ( I N T E G E R ) | ( I N T ) ;
INTO : I N T O ;
IS : I S ;
KEY : K E Y ;
KEY_BSIZE : K E Y US B L O C K US S I Z E ;
MEMORY : M E M O R Y ;
NO : N O ;
NOT : N O T ;
NULL : N U L L ;
NUMERIC : N U M E R I C ;
ON : O N ;
OR : O R ;
PRECISION : P R E C I S I O N ;
PROCEDURE : P R O C E D U R E ;
PRIMARY : P R I M A R Y ;
PURGE : P U R G E ;
REAL : R E A L ;
REFERENCES: R E F E R E N C E S ;
REPLACE : R E P L A C E ;
RESTRICT : R E S T R I C T ;
SCHEMA : S C H E M A ;
SET : S E T ;
SIGNED : S I G N E D ;
SMALLINT : S M A L L I N T ;
SPATIAL : S P A T I A L ;
STORAGE : S T O R A G E ;
TABLE : T A B L E ;
TEMPORARY : T E M P O R A R Y ;
TRIGGER : T R I G G E R ;
UNIQUE : U N I Q U E ;
UNSIGNED : U N S I G N E D ;
UPDATE : U P D A T E ;
USE : U S E ;
USING : U S I N G ;
VALUES : V A L U E S? ;
VARBINARY : V A R B I N A R Y ;
VARCHAR : V A R C H A R ;
VIEW : V I E W ;
WHERE : W H E R E ;
YEAR : Y E A R ;
ZEROFILL : Z E R O F I L L ;
INT : ( DA? POS_DIGIT DIGIT* ( DO DIGIT* )? ) | ZERO+ DO? ZERO* ;
ID : ID_FIRST ID_REST* ;
OTHER : . ;
fragment ID_FIRST : AnyLetter | US | DA | AT | HA | CL | DO ;
fragment ID_REST : AnyLetter | DIGIT | US | DA | AT | HA | CL | DO ;
fragment DIGIT : [0-9] ;
fragment POS_DIGIT : [1-9] ;
fragment ZERO : '0' ;
fragment AnyLetter : LowerCase | UpperCase ;
fragment LowerCase : [a-z] ;
fragment UpperCase : [A-Z] ;
fragment CommentLineStart : ( SL SL ) | ( DA DA ) | HA ;
fragment CommentStart : SL ST ;
fragment CommentStop : ST SL ;
fragment A : [Aa] ; fragment B : [Bb] ; fragment C : [Cc] ; fragment D : [Dd] ;
fragment E : [Ee] ; fragment F : [Ff] ; fragment G : [Gg] ; fragment H : [Hh] ;
fragment I : [Ii] ; fragment J : [Jj] ; fragment K : [Kk] ; fragment L : [Ll] ;
fragment M : [Mm] ; fragment N : [Nn] ; fragment O : [Oo] ; fragment P : [Pp] ;
fragment Q : [Qq] ; fragment R : [Rr] ; fragment S : [Ss] ; fragment T : [Tt] ;
fragment U : [Uu] ; fragment V : [Vv] ; fragment W : [Ww] ; fragment X : [Xx] ;
fragment Y : [Yy] ; fragment Z : [Zz] ;
|
migrate grammar to ANTLR 4
|
migrate grammar to ANTLR 4
|
ANTLR
|
mit
|
thanospappas/Hecate,DAINTINESS-Group/Hecate,apapamichail/Hecate,giskou/Hecate
|
|
d16c1f11ac6bd66efb420512a5759ea18c3ae924
|
src/grammar/setlx.g4
|
src/grammar/setlx.g4
|
grammar SetlXgrammar;
initBlock
: ( statement )+
;
initExpr
: expr[false]
;
block
: ( statement )*
;
statement
: 'class' ID '(' procedureParameters[true] ')' '{' b1 = block ('static' '{' b2 = block '}')? '}'
| 'if' '(' c1 = condition ')' '{' b1 = block '}'
(
'else' 'if' '(' c2 = condition ')' '{' b2 = block '}'
)*
(
'else' '{' b3 = block '}'
)?
| 'switch' '{'
(
'case' c1 = condition ':' b1 = block
)*
(
'default' ':' b2 = block
)?
'}'
| match
| scan
| 'for' '(' iteratorChain[false] ('|' condition )? ')' '{' block '}'
| 'while' '(' condition ')' '{' block '}'
| 'do' '{' block '}' 'while' '(' condition ')' ';'
| 'try' '{' b1 = block '}'
(
'catchLng' '(' v1 = variable ')' '{' b2 = block '}'
| 'catchUsr' '(' v1 = variable ')' '{' b2 = block '}'
)*
(
'catch' '(' v2 = variable ')' '{' b3 = block '}'
)?
| 'check' '{' b1 = block '}' ('afterBacktrack' '{' b2 = block '}')?
| 'backtrack' ';'
| 'break' ';'
| 'continue' ';'
| 'exit' ';'
| 'return' (expr[false])? ';'
| 'assert' '(' condition ',' expr[false] ')' ';' }
| assignmentOther ';'
| assignmentDirect ';'
| expr[false] ';'
;
match
: 'match' '(' expr[false] ')' '{'
('case' exprList[true] ('|' c1 = condition)? ':' b1 = block | regexBranch )+
('default' ':' b4 = block )?
'}'
;
scan
: 'scan' '(' expr[false] ')' ('using' variable)? '{'
regexBranch+
('default' ':' block)?
'}'
;
regexBranch
: 'regex' pattern = expr[false]
('as' assign = expr[true])?
('|' condition)?
':' block
;
listOfVariables
: v1 = variable (',' v2 = variable)*
;
variable
: ID
;
condition
: expr[false]
;
exprList [boolean enableIgnore]
: e1 = expr[$enableIgnore] (',' e2 = expr[$enableIgnore])*
;
assignmentOther
: assignable[false]
(
'+=' e = expr[false]
| '-=' e = expr[false]
| '*=' e = expr[false]
| '/=' e = expr[false]
| '\\=' e = expr[false]
| '%=' e = expr[false]
)
;
assignmentDirect
: assignable[false] ':=' (as = assignmentDirect | expr[false])
;
assignable [boolean enableIgnore]
: variable ('.' variable | '[' e1 = expr[false] (',' e2 = expr[false])* ']')*
| '[' explicitAssignList ']'
| {$enableIgnore}? '_'
;
explicitAssignList
: a1 = assignable[true] (',' a2 = assignable[true])*
;
expr [boolean enableIgnore]
: lambdaProcedure
| i1 = implication[$enableIgnore]
('<==>' i2 = implication[$enableIgnore] | '<!=>' i2 = implication[$enableIgnore] )?
;
lambdaProcedure
: lambdaParameters ('|->' expr[false] | '|=>' expr[false])
;
lambdaParameters
: variable
| '[' (v1 = variable (',' v2 = variable )*)?']'
;
implication [boolean enableIgnore]
: disjunction[$enableIgnore]
('=>' im = implication[$enableIgnore])?
;
disjunction [boolean enableIgnore]
: c1 = conjunction[$enableIgnore] ('||' c2 = conjunction[$enableIgnore])*
;
conjunction [boolean enableIgnore]
: c1 = comparison[$enableIgnore] ('&&' c2 = comparison[$enableIgnore])*
;
comparison [boolean enableIgnore]
: s1 = sum[$enableIgnore]
(
'==' s2 = sum[$enableIgnore]
| '!=' s2 = sum[$enableIgnore]
| '<' s2 = sum[$enableIgnore]
| '<=' s2 = sum[$enableIgnore]
| '>' s2 = sum[$enableIgnore]
| '>=' s2 = sum[$enableIgnore]
| 'in' s2 = sum[$enableIgnore]
| 'notin' s2 = sum[$enableIgnore]
)?
;
sum [boolean enableIgnore]
: p1 = product[$enableIgnore]
(
'+' p2 = product[$enableIgnore]
| '-' p2 = product[$enableIgnore]
)*
;
product [boolean enableIgnore]
: r1 = reduce[$enableIgnore]
(
'*' r2 = reduce[$enableIgnore]
| '/' r2 = reduce[$enableIgnore]
| '\\' r2 = reduce[$enableIgnore]
| '%' r2 = reduce[$enableIgnore]
| '><' r2 = reduce[$enableIgnore]
)*
;
reduce [boolean enableIgnore]
: p1 = prefixOperation[$enableIgnore, false]
(
'+/' p2 = prefixOperation[$enableIgnore, false]
| '*/' p2 = prefixOperation[$enableIgnore, false]
)*
;
prefixOperation [boolean enableIgnore, boolean quoted]
: factor[$enableIgnore, $quoted]
(
'**' p = prefixOperation[$enableIgnore, $quoted]
)?
| '+/' po2 = prefixOperation[$enableIgnore, $quoted]
| '*/' po2 = prefixOperation[$enableIgnore, $quoted]
| '#' po2 = prefixOperation[$enableIgnore, $quoted]
| '-' po2 = prefixOperation[$enableIgnore, $quoted]
| '@' po2 = prefixOperation[$enableIgnore, true]
;
factor [boolean enableIgnore, boolean quoted]
: '!' f2 = factor[$enableIgnore, $quoted]
| TERM '(' termArguments ')'
| 'forall' '(' iteratorChain[$enableIgnore] '|' condition ')'
| 'exists' '(' iteratorChain[$enableIgnore] '|' condition ')'
| (
'(' expr[$enableIgnore] ')'
| procedure
| variable
)
(
'.' variable
| call[$enableIgnore, $f]
)*
(
'!'
)?
| value[$enableIgnore, $quoted] ('!')?
;
termArguments
: exprList[true]
| /* epsilon */
;
procedure
: 'procedure' '(' procedureParameters[true] ')' '{' block '}'
| 'cachedProcedure' '(' procedureParameters[false] ')' '{' block '}'
| 'closure' '(' procedureParameters[true] ')' '{' block '}'
;
procedureParameters [boolean enableRw]
: pp1 = procedureParameter[$enableRw]
(',' pp2 = procedureParameter[$enableRw])*
(',' dp1 = procedureDefaultParameter)*
(',' lp1 = procedureListParameter)?
| dp2 = procedureDefaultParameter
(',' dp3 = procedureDefaultParameter)*
(',' lp2 = procedureListParameter)?
| lp3 = procedureListParameter
| /* epsilon */
;
procedureParameter [boolean enableRw]
: {$enableRw}? 'rw' variable
| variable
;
procedureDefaultParameter
: variable ':=' expr[false]
;
procedureListParameter
: '*' variable
;
call [boolean enableIgnore, Expr lhs]
: '(' callParameters[$enableIgnore] ')'
| '[' collectionAccessParams[$enableIgnore] ']'
| '{' expr[$enableIgnore] '}'
;
callParameters [boolean enableIgnore]
: exprList[$enableIgnore] (',' '*' expr[false])?
| '*' expr[false]
| /* epsilon */
;
collectionAccessParams [boolean enableIgnore]
: e1 = expr[$enableIgnore] (RANGE_SIGN (e2 = expr[$enableIgnore])? | (',' e3 = expr[false])+)?
| RANGE_SIGN expr[$enableIgnore] }
;
value [boolean enableIgnore, boolean quoted] returns [Expr v]
: '[' (collectionBuilder[$enableIgnore] { cb = $collectionBuilder.cb; } )? ']'
| '{' (collectionBuilder[$enableIgnore] { cb = $collectionBuilder.cb; } )? '}'
| STRING
| LITERAL
| matrix
| vector
| atomicValue
| {$enableIgnore}? '_'
;
collectionBuilder [boolean enableIgnore] returns [CollectionBuilder cb]
: /*iterator[$enableIgnore] '|' c2 = condition
| */e1 = expr[$enableIgnore]
(
',' e2 = expr[$enableIgnore]
(
RANGE_SIGN e3 = expr[$enableIgnore]
|
(
',' e3 = expr[$enableIgnore]
)*
(
'|' e4 = expr[false]
| /* epsilon */
)
)
| RANGE_SIGN e3 = expr[$enableIgnore]
|
(
'|' e2 = expr[false]
| /* epsilon */
)
| ':' iteratorChain[$enableIgnore]
(
'|' c1 = condition
| /* epsilon */
)
)
;
iteratorChain [boolean enableIgnore]
: i1 = iterator[$enableIgnore] (',' i2 = iterator[$enableIgnore])*
;
iterator [boolean enableIgnore]
: assignable[true] 'in' expr[$enableIgnore]
;
matrix
: '<<' (vector)+ '>>'
;
vector
: '<<' (('-' | /* epsilon */)(n1 = NUMBER | DOUBLE )('/' n2 = NUMBER)?)+ '>>'
;
atomicValue
: NUMBER
| DOUBLE
| 'om'
| 'true'
| 'false'
;
ID : ('a' .. 'z')('a' .. 'z' | 'A' .. 'Z'| '_' | '0' .. '9')* ;
TERM : ('^' ID | 'A' .. 'Z' ID?) ;
NUMBER : '0'|('1' .. '9')('0' .. '9')*;
DOUBLE : NUMBER? '.' ('0' .. '9')+ (('e' | 'E') ('+' | '-')? ('0' .. '9')+)? ;
RANGE_SIGN : '..';
STRING : '"' ('\\'.|~('"'|'\\'))* '"';
LITERAL : '\'' ('\'\''|~('\''))* '\'';
LINE_COMMENT : '//' ~('\n' | '\r')* { skip(); } ;
MULTI_COMMENT : '/*' (~('*') | '*'+ ~('*'|'/'))* '*'+ '/' { skip(); } ;
WS : (' '|'\t'|'\n'|'\r') { skip(); } ;
/*
* This is the desperate attempt at counting mismatched characters as errors
* instead of the lexers default behavior of emitting an error message,
* consuming the character and continuing without counting it as an error.
*
* Using this rule all unknown characters are added to the token stream
* and the parser will stumble over them, reporting "mismatched input"
*
* Matching any character here works, because the lexer matches rules in order.
*/
REMAINDER : . ;
|
add setlx pure antlr4 grammar
|
add setlx pure antlr4 grammar
|
ANTLR
|
mit
|
setlxjs/setlxjs-transpiler
|
|
bdbf016eca2e0a116b46ecef3a578dafd48a0390
|
viper/grammar/Viper.g4
|
viper/grammar/Viper.g4
|
grammar Viper;
tokens { NAME
, NEWLINE
, INDENT
, DEDENT
, NUMBER
, STRING
}
func_def: 'def' func_name parameters '->' func_type ':' suite ;
func_name: NAME ;
func_type: type_expr ;
parameters: '(' params_list? ')' ;
params_list: argless_parameter parameter* ;
parameter: arg_label? argless_parameter ;
argless_parameter: param_name ':' param_type ;
arg_label: NAME ;
param_name: NAME ;
param_type: type_expr ;
type_expr: NAME ;
suite: ( simple_stmt
| NEWLINE INDENT stmt+ DEDENT
) ;
stmt: ( simple_stmt
| compound_stmt
) ;
simple_stmt: expr_stmt NEWLINE ;
expr_stmt: ( expr_list
| 'pass'
| 'return' expr_list?
) ;
expr_list: expr (',' expr)* ;
expr: atom_expr ;
atom_expr: atom trailer* ;
atom: ( '(' expr_list? ')'
| NAME
| NUMBER
| STRING
| '...'
| 'Zilch'
| 'True'
| 'False'
) ;
trailer: ( '(' arg_list? ')'
| '.' NAME
) ;
compound_stmt: ( func_def
| object_def
| data_def
) ;
object_def: ( class_def
| interface_def
| implementation_def
) ;
class_def: 'class' common_def ;
interface_def: 'interface' common_def ;
implementation_def: NAME common_def ;
data_def: 'data' common_def ;
common_def: NAME ('(' arg_list? ')')? ':' suite ;
arg_list: argument (',' argument)* ;
argument: expr ;
|
Add grammar in ANTLR 4 format
|
Add grammar in ANTLR 4 format
|
ANTLR
|
apache-2.0
|
pdarragh/Viper
|
|
78eb0ac304d9dfd7ae58af66bb6b9ffe4f12eeb7
|
dot/DOT.g4
|
dot/DOT.g4
|
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** Derived from http://www.graphviz.org/doc/info/lang.html.
Comments pulled from spec.
*/
grammar DOT;
graph : STRICT? (GRAPH | DIGRAPH) id? '{' stmt_list '}' ;
stmt_list : ( stmt ';'? )* ;
stmt : node_stmt
| edge_stmt
| attr_stmt
| id '=' id
| subgraph
;
attr_stmt : (GRAPH | NODE | EDGE) attr_list ;
attr_list : ('[' a_list? ']')+ ;
a_list : (id ('=' id)? ','?)+ ;
edge_stmt : (node_id | subgraph) edgeRHS attr_list? ;
edgeRHS : ( edgeop (node_id | subgraph) )+ ;
edgeop : '->' | '--' ;
node_stmt : node_id attr_list? ;
node_id : id port? ;
port : ':' id (':' id)? ;
subgraph : (SUBGRAPH id?)? '{' stmt_list '}' ;
id : ID
| STRING
| HTML_STRING
| NUMBER
;
// "The keywords node, edge, graph, digraph, subgraph, and strict are
// case-independent"
STRICT : [Ss][Tt][Rr][Ii][Cc][Tt] ;
GRAPH : [Gg][Rr][Aa][Pp][Hh] ;
DIGRAPH : [Dd][Ii][Gg][Rr][Aa][Pp][Hh] ;
NODE : [Nn][Oo][Dd][Ee] ;
EDGE : [Ee][Dd][Gg][Ee] ;
SUBGRAPH : [Ss][Uu][Bb][Gg][Rr][Aa][Pp][Hh] ;
/** "a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? )" */
NUMBER : '-'? ('.' DIGIT+ | DIGIT+ ('.' DIGIT*)? ) ;
fragment
DIGIT : [0-9] ;
/** "any double-quoted string ("...") possibly containing escaped quotes" */
STRING : '"' ('\\"'|.)*? '"' ;
/** "Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores
* ('_') or digits ([0-9]), not beginning with a digit"
*/
ID : LETTER (LETTER|DIGIT)*;
fragment
LETTER : [a-zA-Z\u0080-\u00FF_] ;
/** "HTML strings, angle brackets must occur in matched pairs, and
* unescaped newlines are allowed."
*/
HTML_STRING : '<' (TAG|~[<>])* '>' ;
fragment
TAG : '<' .*? '>' ;
COMMENT : '/*' .*? '*/' -> skip ;
LINE_COMMENT: '//' .*? '\r'? '\n' -> skip ;
/** "a '#' character is considered a line output from a C preprocessor (e.g.,
* # 34 to indicate line 34 ) and discarded"
*/
PREPROC : '#' .*? '\n' -> skip ;
WS : [ \t\n\r]+ -> skip ;
|
add DOT grammar
|
add DOT grammar
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
1c66703cc49765caa0f14637237340a1195d9879
|
sharding-core/src/main/antlr4/imports/OracleDCLStatement.g4
|
sharding-core/src/main/antlr4/imports/OracleDCLStatement.g4
|
grammar OracleDCLStatement;
import OracleKeyword, Keyword, OracleBase, BaseRule, DataType, Symbol;
/**
* each statement has a url,
* each base url : https://docs.oracle.com/database/121/SQLRF/.
* no begin statement in oracle
*/
//statements_9014.htm#SQLRF01603
grant
: GRANT
(
(grantSystemPrivileges | grantObjectPrivilegeClause) (CONTAINER EQ_ (CURRENT | ALL))?
| grantRolesToPrograms
)
;
grantSystemPrivileges
: systemObjects TO (grantees | granteeIdentifiedBy) (WITH (ADMIN | DELEGATE) OPTION)?
;
systemObjects
: systemObject(COMMA systemObject)*
;
systemObject
: ALL PRIVILEGES
| roleName
| ID *?
;
grantees
: grantee (COMMA grantee)*
;
grantee
: userName
| roleName
| PUBLIC
;
granteeIdentifiedBy
: userName (COMMA userName)* IDENTIFIED BY STRING (COMMA STRING)*
;
grantObjectPrivilegeClause
: grantObjectPrivilege (COMMA grantObjectPrivilege)* onObjectClause
TO grantees (WITH HIERARCHY OPTION)?(WITH GRANT OPTION)?
;
grantObjectPrivilege
: objectPrivilege ( LP_ columnName (COMMA columnName)* RP_)?
;
objectPrivilege
: ID *?
| ALL PRIVILEGES?
;
onObjectClause
: ON
(
schemaName? ID
| USER userName ( COMMA userName)*
| (DIRECTORY | EDITION | MINING MODEL | JAVA (SOURCE | RESOURCE) | SQL TRANSLATION PROFILE) schemaName? ID
)
;
grantRolesToPrograms
: roleName (COMMA roleName)* TO programUnit ( COMMA programUnit )*
;
programUnit
: (FUNCTION | PROCEDURE | PACKAGE) schemaName? ID
;
revokeSystemPrivileges
: systemObjects FROM
;
revokeObjectPrivileges
: objectPrivilege (COMMA objectPrivilege)* onObjectClause
FROM grantees
(CASCADE CONSTRAINTS | FORCE)?
;
|
grammar OracleDCLStatement;
import OracleKeyword, Keyword, OracleBase, BaseRule, DataType, Symbol;
/**
* each statement has a url,
* each base url : https://docs.oracle.com/database/121/SQLRF/.
* no begin statement in oracle
*/
//statements_9014.htm#SQLRF01603
grant
: GRANT
(
(grantSystemPrivileges | grantObjectPrivilegeClause) (CONTAINER EQ_ (CURRENT | ALL))?
| grantRolesToPrograms
)
;
grantSystemPrivileges
: systemObjects TO (grantees | granteeIdentifiedBy) (WITH (ADMIN | DELEGATE) OPTION)?
;
systemObjects
: systemObject(COMMA systemObject)*
;
systemObject
: ALL PRIVILEGES
| roleName
| ID *?
;
grantees
: grantee (COMMA grantee)*
;
grantee
: userName
| roleName
| PUBLIC
;
granteeIdentifiedBy
: userNames IDENTIFIED BY STRING (COMMA STRING)*
;
grantObjectPrivilegeClause
: grantObjectPrivilege (COMMA grantObjectPrivilege)* onObjectClause
TO grantees (WITH HIERARCHY OPTION)?(WITH GRANT OPTION)?
;
grantObjectPrivilege
: objectPrivilege columnList?
;
objectPrivilege
: ID *?
| ALL PRIVILEGES?
;
onObjectClause
: ON
(
schemaName? ID
| USER userName ( COMMA userName)*
| (DIRECTORY | EDITION | MINING MODEL | JAVA (SOURCE | RESOURCE) | SQL TRANSLATION PROFILE) schemaName? ID
)
;
grantRolesToPrograms
: roleNames TO programUnits
;
programUnits
: programUnit (COMMA programUnit)*
;
programUnit
: (FUNCTION | PROCEDURE | PACKAGE) schemaName? ID
;
revokeSystemPrivileges
: systemObjects FROM
;
revokeObjectPrivileges
: objectPrivilege (COMMA objectPrivilege)* onObjectClause
FROM grantees
(CASCADE CONSTRAINTS | FORCE)?
;
revokeRolesFromPrograms
: (roleNames | ALL) FROM programUnits
;
|
add revokeRolesFromPrograms add programUnits use userNames roleNames
|
add revokeRolesFromPrograms
add programUnits
use userNames roleNames
|
ANTLR
|
apache-2.0
|
leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,apache/incubator-shardingsphere,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,apache/incubator-shardingsphere,leeyazhou/sharding-jdbc,leeyazhou/sharding-jdbc
|
7b1ec8a7f0d623d4b6fe7fbe70e50b0e765aaf3d
|
clojure/Clojure.g4
|
clojure/Clojure.g4
|
/* Converted to ANTLR 4 by Terence Parr. Unsure of provence. I see
it commited by matthias.koester for clojure-eclipse project on
Oct 5, 2009:
https://code.google.com/p/clojure-eclipse/
Seems to me Laurent Petit had a version of this. I also see
Jingguo Yao submitting a link to a now-dead github project on
Jan 1, 2011.
https://github.com/laurentpetit/ccw/tree/master/clojure-antlr-grammar
Regardless, there are some issues perhaps related to "sugar";
I've tried to fix them.
This parses https://github.com/weavejester/compojure project.
I also note this is hardly a grammar; more like "match a bunch of
crap in parens" but I guess that is LISP for you ;)
*/
grammar Clojure;
file: list*;
form: literal
| list
| vector
| map
| reader_macro
| '#\'' SYMBOL // TJP added (get Var object instead of the value of a symbol)
;
list: '(' form* ')' ;
vector: '[' form* ']' ;
map: '{' (form form)* '}' ;
// TJP added '&' (gather a variable number of arguments)
special_form: ('\'' | '`' | '~' | '~@' | '^' | '@' | '&') form ;
lambda: '#(' form* ')' ;
meta_data: '#^' map form ;
var_quote: '\'' '#' SYMBOL ;
regex: '#' STRING ;
reader_macro
: lambda
| meta_data
| special_form
| regex
| var_quote
| SYMBOL '#' // TJP added (auto-gensym)
;
literal
: STRING
| NUMBER
| CHARACTER
| NIL
| BOOLEAN
| KEYWORD
| SYMBOL
| PARAM_NAME
;
STRING : '"' ( ~'"' | '\\' '"' )* '"' ;
NUMBER : '-'? [0-9]+ ('.' [0-9]+)? ([eE] '-'? [0-9]+)? ;
CHARACTER : '\\' . ;
NIL : 'nil';
BOOLEAN : 'true' | 'false' ;
KEYWORD : ':' SYMBOL ;
SYMBOL: '.' | '/' | NAME ('/' NAME)? ;
PARAM_NAME: '%' (('1'..'9')('0'..'9')*)? ;
fragment
NAME: SYMBOL_HEAD SYMBOL_REST* (':' SYMBOL_REST+)* ;
fragment
SYMBOL_HEAD
: 'a'..'z' | 'A'..'Z' | '*' | '+' | '!' | '-' | '_' | '?' | '>' | '<' | '=' | '$'
;
fragment
SYMBOL_REST
: SYMBOL_HEAD
| '&' // apparently this is legal in an ID: "(defn- assoc-&-binding ..." TJP
| '0'..'9'
| '.'
;
WS : [ \n\r\t\,] -> channel(HIDDEN) ;
COMMENT : ';' ~[\r\n]* -> channel(HIDDEN) ;
|
add Clojure grammar
|
add Clojure grammar
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
e4cac2f5e883fcd8904d481c61e089e3fcb5311b
|
asm/asm_ruberoid.g4
|
asm/asm_ruberoid.g4
|
grammar asm_ruberoid;
program
: (line? EOL)+
;
section
: section_id
| section_code
;
section_id
: section_id_header section_id_body
;
section_id_header
: SECTION_ID_HEADER
;
section_id_body
: (line_id? EOL)+
;
section_code
: section_code_header section_code_body
;
section_code_header
: SECTION_CODE_HEADER
;
section_code_body
: (line? EOL) +
;
line
: comment
| instruction
| label
;
line_id
: comment
| id_declaration
;
id_declaration
: id_type id hexid
;
id_type
: ID_TYPE
;
hexid
: '{' HEXID '}'
;
instruction
: label? opcode argumentlist? comment?
;
label
: label_id ':'
;
label_id
: '.' NAME
;
argumentlist
: argument (',' argumentlist)?
;
argument
: reference
| label_id
| number
| string
;
reference
: '$' id
;
id
: NAME ('%' NAME)*
;
number
: NUMBER
;
string
: STRING
;
comment
: COMMENT
;
opcode
: OPCODE
;
ID_TYPE
: 'c'
| 'f'
;
HEXID
: [0-9a-fA-F]+
;
SECTION_ID_HEADER
: '.ID'
;
SECTION_CODE_HEADER
: '.CODE'
;
OPCODE
: 'CTXC'
| 'CTXF'
| 'BSKP'
| 'BALN'
| 'BRDB'
| 'BRDU8'
| 'BRDU16'
| 'BRDU32'
| 'BRDU64'
| 'BRDS8'
| 'BRDS16'
| 'BRDS32'
| 'BRDS64'
| 'SLOTA'
| 'SLOTF'
| 'SLOTE'
| 'SLOTD'
| 'CALL'
| 'RET'
| 'VARU8'
| 'VARU16'
| 'VARU32'
| 'VARU64'
| 'VARS8'
| 'VARS16'
| 'VARS32'
| 'VARS64'
| 'VARD'
| 'MOV'
| 'JL'
| 'JNL'
| 'JG'
| 'JNG'
| 'JE'
| 'JNE'
| 'INC'
| 'DEC'
| 'ADD'
| 'SUB'
| 'MUL'
| 'DIV'
| 'MOD'
| 'XOR'
| 'OR'
| 'AND'
| 'NOT'
;
NAME
: [a-zA-Z_][a-zA-Z0-9_]*
;
NUMBER
: NUMBER_DECIMAL
| NUMBER_HEX
| NUMBER_BINARY
| NUMBER_OCT
;
NUMBER_DECIMAL
: '-'? [1-9][0-9]+
;
NUMBER_HEX
: '0x' [0-9a-fA-F]+
;
NUMBER_BINARY
: '0b' [0-1]+
;
NUMBER_OCT
: '0' [0-7]+
;
COMMENT
: '//' ~[\r\n]* -> skip
;
STRING
: '"' ~["]* '"'
;
EOL
: '\r'? '\n'
;
WS
: [ \t] -> skip
;
|
Add a draft of parser VM asm grammar (still needs documenting and examples)
|
Add a draft of parser VM asm grammar (still needs documenting and examples)
|
ANTLR
|
bsd-3-clause
|
axethrower/ruberoid
|
|
74ac11c91cefbdef4c1a9431a5a0628923fc8c97
|
de.peeeq.wurstscript/parserspec/Jurst.g4
|
de.peeeq.wurstscript/parserspec/Jurst.g4
|
grammar Jurst;
compilationUnit : NL* decls+=topLevelDeclaration*;
topLevelDeclaration:
wpackage
| jassTopLevelDeclaration
;
jassTopLevelDeclaration:
jassGlobalsBlock
| jassFuncDef
| jassTypeDecl
| jassNativeDecl
;
jassGlobalsBlock:
'globals' NL vars+=jassGlobalDecl* 'endglobals' NL
;
jassGlobalDecl:
constant='constant'? typeExpr name=id ('=' initial=expr)? NL
;
jassFuncDef:
constant='constant'? 'function' jassFuncSignature NL
(jassLocals+=jassLocal)*
jassStatements
'endfunction' NL
;
jassLocal: 'local' typeExpr name=id ('=' initial=expr)? NL;
jassStatements: stmts+=jassStatement*;
jassStatement:
jassStatementIf
| jassStatementLoop
| jassStatementExithwhen
| jassStatementReturn
| jassStatementSet
| jassStatementCall
;
jassStatementIf:
'if' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
;
jassElseIfs:
'elseif' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
| 'else' NL elseStmts=jassStatements 'endif' NL
| 'endif' NL
;
jassStatementLoop:
'loop' NL jassStatements 'endloop' NL
;
jassStatementExithwhen:
'exitwhen' cond=expr NL
;
jassStatementReturn:
'return' expr NL
;
jassStatementSet:
'set' left=exprAssignable '=' right=expr NL
;
jassStatementCall:
'call' exprFunctionCall NL
;
jassNativeDecl:
constant='constant'? 'native' jassFuncSignature NL
;
jassFuncSignature:
name=id 'takes' ('nothing' | args+=formalParameter (',' args+=formalParameter)*)
'returns' ('nothing'|returnType=typeExpr)
;
jassTypeDecl: 'type' name=id 'extends' extended=typeExpr NL;
wpackage: ('package'|'library'|'scope') name=id
('initializer' initializer=id)?
(('uses'|'requires'|'needs') 'optional'? requires+=id (',' 'optional'? requires+=id)*)?
NL
imports+=wImport* entities+=entity*
('endpackage'|'endlibrary'|'endscope'|'end') NL
;
wImport:
'import' isPublic='public'? isInitLater='initlater'? importedPackage=id NL
;
entity:
nativeType
| funcDef
| functionInterfaceDef
| globalsBlock
| initBlock
| nativeDef
| classDef
| enumDef
| moduleDef
| interfaceDef
| tupleDef
| extensionFuncDef
| varDef
;
globalsBlock: 'globals' NL vars+=varDef* ('endglobals' | 'end') NL;
interfaceDef:
modifiersWithDoc 'interface' name=id typeParams
('extends' extended+=typeExpr (',' extended+=typeExpr)*)?
NL
classSlots
('end'|'endinterface') NL
;
classDef:
modifiersWithDoc ('class'|'struct') name=id typeParams
('extends' (extended=typeExpr | 'array'))?
('implements' implemented+=typeExpr (',' implemented+=typeExpr)*)?
NL
classSlots
('end'|'endclass'|'endstruct') NL
;
enumDef: modifiersWithDoc 'enum' name=id NL
(enumMembers+=id NL)*
('end'|'endenum') NL
;
moduleDef:
modifiersWithDoc 'module' name=id typeParams
NL
classSlots
('end'|'endmodule') NL
;
classSlots: slots+=classSlot*;
classSlot:
constructorDef
| moduleUse
| ondestroyDef
| varDef
| funcDef
;
constructorDef:
modifiersWithDoc 'construct' formalParameters NL
('super' '(' superArgs=exprList ')' NL)?
stmts+=statement*
('end'|'endconstruct') NL
;
moduleUse:
modifiersWithDoc ('use'|'implement') optional='optional'? moduleName=id typeArgs NL
;
ondestroyDef:
'ondestroy' NL statementsBlock ('end'|'endondestroy') NL
;
funcDef:
modifiersWithDoc ('function'|'method') funcSignature
(
NL statementsBlock ('end'|'endfunction'|'endmethod')
| 'defaults' (defaultExpr=expr|defaultsNothing='nothing')
)?
NL
;
functionInterfaceDef:
modifiersWithDoc 'function' 'interface' funcSignature NL
;
modifiersWithDoc:
(hotdocComment NL)?
modifiers+=modifier*
;
modifier:
modType=(
'public'
| 'private'
| 'protected'
| 'publicread'
| 'readonly'
| 'static'
| 'override'
| 'abstract'
| 'constant'
| 'delegate'
| 'stub'
)
| annotation
;
annotation: ANNOTATION;
hotdocComment: HOTDOC_COMMENT;
funcSignature:
name=id typeParams formalParameters ('returns' ('nothing' | returnType=typeExpr))?
;
formalParameters:
'(' (params+=formalParameter (',' params+=formalParameter)*)? ')'
| 'takes' 'nothing'
| 'takes' params+=formalParameter (',' params+=formalParameter)*
;
formalParameter:
typeExpr name=id
;
typeExpr:
thistype='thistype'
| typeName=ID typeArgs
| typeExpr 'array' ('[' arraySizes+=expr ']')*
;
varDef:
modifiersWithDoc
('var'|constant='constant' varType=typeExpr?|constant='let'|varType=typeExpr)
name=id ('[' arraySizes+=expr ']')* ('=' initial=expr)? NL
;
statements: statement*;
statementsBlock: statement*;
statement:
stmtIf
| stmtLoop
| stmtExitwhen
| stmtWhile
| localVarDef
| stmtSet
| stmtCall
| stmtReturn
| stmtForLoop
| stmtBreak
| stmtSkip
| stmtSwitch
;
stmtLoop: 'loop' NL statementsBlock ('end'|'endloop') NL;
stmtExitwhen: 'exitwhen' expr NL;
exprDestroy:
'destroy' expr
| expr '.' 'destroy' ('(' ')')?
;
stmtReturn:
'return' expr NL
;
stmtIf:
isStatic='static'? 'if' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
;
elseStatements:
'elseif' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
| 'else' NL statementsBlock ('endif'|'end') NL
| ('endif'|'end') NL
;
stmtSwitch:
'switch' expr NL
switchCase*
switchDefaultCase?
('end'|'endswitch')
;
switchCase:
'case' expr NL statementsBlock
;
switchDefaultCase:
'default' NL statementsBlock
;
stmtWhile:
'while' cond=expr NL statementsBlock
('end'|'endwhile')
;
localVarDef:
(var='var'|let='let'|'local'? type=typeExpr)
name=id ('=' initial=expr)? NL
;
localVarDefInline:
typeExpr? name=id
;
stmtSet:
'set'? left=exprAssignable
(assignOp=('='|'+='|'-='|'*='|'/=') right=expr
| incOp='++'
| decOp='--'
)
NL
;
exprAssignable:
exprMemberVar
| exprVarAccess
;
exprMemberVar:
expr dots=('.'|'..') varname=id indexes*
;
exprVarAccess:
varname=id indexes*
;
indexes:
'[' expr ']'
;
stmtCall: 'call'?
(
exprMemberMethod
| exprFunctionCall
| exprNewObject
| exprDestroy
) NL
;
exprMemberMethod:
receiver=expr dots=('.'|'..') funcName=id? typeArgs ('(' exprList ')')?
;
expr:
exprPrimary
| left=expr 'castTo' castToType=typeExpr
| left=expr 'instanceof' instaneofType=typeExpr
| receiver=expr dotsCall=('.'|'..') funcName=id? typeArgs '(' exprList ')'
| receiver=expr dotsVar=('.'|'..') varName=id? indexes*
| 'destroy' destroyedObject=expr
| destroyedObject=expr '.' 'destroy' '(' ')'
| left=expr op=('*'|'/'|'%'|'div'|'mod') right=expr
| op='-' right=expr // TODO move unary minus one up to be compatible with Java etc.
// currently it is here to be backwards compatible with the old wurst parser
| left=expr op=('+'|'-') right=expr
| left=expr op=('<='|'<'|'>'|'>=') right=expr
| left=expr op=('=='|'!=') right=expr
| op='not' right=expr
| left=expr op='and' right=expr
| left=expr op='or' right=expr
|
;
exprPrimary:
exprFunctionCall
| exprNewObject
| exprClosure
| exprStatementsBlock
| atom=(INT
| REAL
| STRING
| 'null'
| 'true'
| 'false'
| 'this'
| 'super')
| exprFuncRef
| varname=id indexes*
| '(' expr ')'
;
exprFuncRef: 'function' (scopeName=id '.')? funcName=id;
exprStatementsBlock:
'begin' NL statementsBlock 'end'
;
exprFunctionCall:
funcName=id typeArgs '(' exprList ')'
;
exprNewObject:'new' className=id typeArgs ('(' exprList ')')?;
exprClosure: formalParameters '->' expr;
typeParams: ('<' (params+=typeParam (',' params+=typeParam)*)? '>')?;
typeParam: name=id;
stmtForLoop:
forRangeLoop
| forIteratorLoop
;
forRangeLoop:
'for' loopVar=localVarDefInline '=' start=expr direction=('to'|'downto') end=expr ('step' step=expr)? NL
statementsBlock
('end'|'endfor')
;
forIteratorLoop:
'for' loopVar=localVarDefInline iterStyle=('in'|'from') iteratorExpr=expr NL
statementsBlock
('end'|'endfor')
;
stmtBreak:'break' NL;
stmtSkip:'skip' NL;
typeArgs: ('<' (args+=typeExpr (',' args+=typeExpr)*)? '>')?;
exprList : exprs+=expr (',' exprs+=expr)*;
nativeType: 'type' name=id ('extends' extended=id)? NL;
initBlock: 'init' NL
statementsBlock
('end'|'endinit') NL;
nativeDef: modifiersWithDoc 'native' funcSignature NL;
tupleDef: modifiersWithDoc 'tuple' name=id formalParameters NL;
extensionFuncDef: modifiersWithDoc 'function' receiverType=typeExpr '.' funcSignature NL
statementsBlock
('end'|'endfunction');
// some keywords are also valid identifiers for backwards compatibility reasons
id: ID|'end'|'init'|'this'|'new'|'destroy'|'it'|'to'|'from'|'class'|'thistype';
// Lexer:
CLASS: 'class';
RETURN: 'return';
IF: 'if';
ELSE: 'else';
WHILE: 'while';
FOR: 'for';
IN: 'in';
BREAK: 'break';
NEW: 'new';
NULL: 'null';
PACKAGE: 'package';
ENDPACKAGE: 'endpackage';
FUNCTION: 'function';
RETURNS: 'returns';
PUBLIC: 'public';
PULBICREAD: 'publicread';
READONLY: 'readonly';
DELEGATE: 'delegate';
STUB: 'stub';
PRIVATE: 'private';
PROTECTED: 'protected';
IMPORT: 'import';
INITLATER: 'initlater';
NATIVE: 'native';
NATIVETYPE: 'nativetype';
EXTENDS: 'extends';
INTERFACE: 'interface';
IMPLEMENTS: 'implements';
MODULE: 'module';
USE: 'use';
ABSTRACT: 'abstract';
STATIC: 'static';
THISTYPE: 'thistype';
OVERRIDE: 'override';
IMMUTABLE: 'immutable';
IT: 'it';
ARRAY: 'array';
AND: 'and';
OR: 'or';
NOT: 'not';
THIS: 'this';
CONSTRUCT: 'construct';
ONDESTROY: 'ondestroy';
DESTROY: 'destroy';
TYPE: 'type';
CONSTANT: 'constant';
ENDFUNCTION: 'endfunction';
NOTHING: 'nothing';
INIT: 'init';
CASTTO: 'castTo';
TUPLE: 'tuple';
DIV: 'div';
MOD: 'mod';
LET: 'let';
FROM: 'from';
TO: 'to';
DOWNTO: 'downto';
STEP: 'step';
SKIP: 'skip';
TRUE: 'true';
FALSE: 'false';
VAR: 'var';
INSTANCEOF: 'instanceof';
SUPER: 'super';
ENUM: 'enum';
SWITCH: 'switch';
CASE: 'case';
DEFAULT: 'default';
BEGIN: 'begin';
END: 'end';
LIBRARY: 'library';
ENDLIBRARY: 'endlibrary';
SCOPE: 'scope';
ENDSCOPE: 'endscope';
REQUIRES: 'requires';
USES: 'uses';
NEEDS: 'needs';
STRUCT: 'struct';
ENDSTRUCT: 'endstruct';
THEN: 'then';
ENDIF: 'endif';
LOOP: 'loop';
EXITHWHEN: 'exithwhen';
ENDLOOP: 'endloop';
METHOD: 'method';
TAKES: 'takes';
ENDMETHOD: 'endmethod';
SET: 'set';
CALL: 'call';
EXITWHEN: 'exitwhen';
INITIALIZER: 'initializer';
ENDINTERFACE: 'endinterface';
ENDCLASS: 'endclass';
ENDENUM: 'endenum';
ENDMODULE: 'endmodule';
ENDCONSTRUCT: 'endconstruct';
IMPLEMENT: 'implement';
ENDONDESTROY: 'endondestroy';
ENDSWITCH: 'endswitch';
ENDWHILE: 'endwhile';
ENDFOR: 'endfor';
ENDINIT: 'endinit';
COMMA: ',';
PLUS: '+';
PLUSPLUS: '++';
MINUS: '-';
MINUSMINUS: '--';
MULT: '*';
DIV_REAL: '/';
MOD_REAL: '%';
DOT: '.';
DOTDOT: '..';
PAREN_LEFT: '(';
PAREN_RIGHT: ')';
BRACKET_LEFT: '[';
BRACKET_RIGHT: ']';
EQ: '=';
EQEQ: '==';
NOT_EQ: '!=';
LESS: '<';
LESS_EQ: '<=';
GREATER: '>';
GREATER_EQ: '>=';
PLUS_EQ: '+=';
MINUS_EQ: '-=';
MULT_EQ: '*=';
DIV_EQ: '/=';
ARROW: '->';
INVALID:[];
JASS_GLOBALS: 'globals';
JASS_ENDGLOBALS: 'endglobals';
JASS_LOCAL: 'local';
JASS_ELSEIF: 'elseif';
NL: [\r\n]+;
ID: [a-zA-Z_][a-zA-Z0-9_]* ;
ANNOTATION: '@' [a-zA-Z0-9_]+;
STRING: '"' ( EscapeSequence | ~('\\'|'"'|'\r'|'\n') )* '"';
REAL: [0-9]+ '.' [0-9]* | '.'[0-9]+;
INT: [0-9]+ | '0x' [0-9a-fA-F]+ | '\'' . . . . '\'' | '\'' . '\'';
fragment EscapeSequence: '\\' [abfnrtvz"'\\];
DEBUG: 'debug' -> skip;
WS : [ \t]+ -> skip ;
HOTDOC_COMMENT: '/**' .*? '*/';
ML_COMMENT: '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
|
grammar Jurst;
compilationUnit : NL* decls+=topLevelDeclaration*;
topLevelDeclaration:
wpackage
| jassTopLevelDeclaration
;
jassTopLevelDeclaration:
jassGlobalsBlock
| jassFuncDef
| jassTypeDecl
| jassNativeDecl
;
jassGlobalsBlock:
'globals' NL vars+=jassGlobalDecl* 'endglobals' NL
;
jassGlobalDecl:
constant='constant'? typeExpr name=id ('=' initial=expr)? NL
;
jassFuncDef:
constant='constant'? 'function' jassFuncSignature NL
(jassLocals+=jassLocal)*
jassStatements
'endfunction' NL
;
jassLocal: 'local' typeExpr name=id ('=' initial=expr)? NL;
jassStatements: stmts+=jassStatement*;
jassStatement:
jassStatementIf
| jassStatementLoop
| jassStatementExithwhen
| jassStatementReturn
| jassStatementSet
| jassStatementCall
;
jassStatementIf:
'if' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
;
jassElseIfs:
'elseif' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
| 'else' NL elseStmts=jassStatements 'endif' NL
| 'endif' NL
;
jassStatementLoop:
'loop' NL jassStatements 'endloop' NL
;
jassStatementExithwhen:
'exitwhen' cond=expr NL
;
jassStatementReturn:
'return' expr NL
;
jassStatementSet:
'set' left=exprAssignable '=' right=expr NL
;
jassStatementCall:
'call' exprFunctionCall NL
;
jassNativeDecl:
constant='constant'? 'native' jassFuncSignature NL
;
jassFuncSignature:
name=id 'takes' ('nothing' | args+=formalParameter (',' args+=formalParameter)*)
'returns' ('nothing'|returnType=typeExpr)
;
jassTypeDecl: 'type' name=id 'extends' extended=typeExpr NL;
wpackage: ('package'|'library'|'scope') name=id
('initializer' initializer=id)?
(('uses'|'requires'|'needs') 'optional'? requires+=id (',' 'optional'? requires+=id)*)?
NL
imports+=wImport* entities+=entity*
('endpackage'|'endlibrary'|'endscope'|'end') NL
;
wImport:
'import' isPublic='public'? isInitLater='initlater'? importedPackage=id NL
;
entity:
nativeType
| funcDef
| functionInterfaceDef
| globalsBlock
| initBlock
| nativeDef
| classDef
| enumDef
| moduleDef
| interfaceDef
| tupleDef
| extensionFuncDef
| varDef
;
globalsBlock: 'globals' NL vars+=varDef* ('endglobals' | 'end') NL;
interfaceDef:
modifiersWithDoc 'interface' name=id typeParams
('extends' extended+=typeExpr (',' extended+=typeExpr)*)?
NL
classSlots
('end'|'endinterface') NL
;
classDef:
modifiersWithDoc ('class'|'struct') name=id typeParams
('extends' (extended=typeExpr | 'array'))?
('implements' implemented+=typeExpr (',' implemented+=typeExpr)*)?
NL
classSlots
('end'|'endclass'|'endstruct') NL
;
enumDef: modifiersWithDoc 'enum' name=id NL
(enumMembers+=id NL)*
('end'|'endenum') NL
;
moduleDef:
modifiersWithDoc 'module' name=id typeParams
NL
classSlots
('end'|'endmodule') NL
;
classSlots: slots+=classSlot*;
classSlot:
constructorDef
| moduleUse
| ondestroyDef
| varDef
| funcDef
;
constructorDef:
modifiersWithDoc 'construct' formalParameters NL
('super' '(' superArgs=exprList ')' NL)?
stmts+=statement*
('end'|'endconstruct') NL
;
moduleUse:
modifiersWithDoc ('use'|'implement') optional='optional'? moduleName=id typeArgs NL
;
ondestroyDef:
'ondestroy' NL statementsBlock ('end'|'endondestroy') NL
;
funcDef:
modifiersWithDoc ('function'|'method') funcSignature
(
NL statementsBlock ('end'|'endfunction'|'endmethod')
| 'defaults' (defaultExpr=expr|defaultsNothing='nothing')
)?
NL
;
functionInterfaceDef:
modifiersWithDoc 'function' 'interface' funcSignature NL
;
modifiersWithDoc:
(hotdocComment NL)?
(modifiers+=modifier NL?)*
;
modifier:
modType=(
'public'
| 'private'
| 'protected'
| 'publicread'
| 'readonly'
| 'static'
| 'override'
| 'abstract'
| 'constant'
| 'delegate'
| 'stub'
)
| annotation
;
annotation: ANNOTATION;
hotdocComment: HOTDOC_COMMENT;
funcSignature:
name=id typeParams formalParameters ('returns' ('nothing' | returnType=typeExpr))?
;
formalParameters:
'(' (params+=formalParameter (',' params+=formalParameter)*)? ')'
| 'takes' 'nothing'
| 'takes' params+=formalParameter (',' params+=formalParameter)*
;
formalParameter:
typeExpr name=id
;
typeExpr:
thistype='thistype'
| typeName=ID typeArgs
| typeExpr 'array' ('[' arraySizes+=expr ']')*
;
varDef:
modifiersWithDoc
('var'|constant='constant' varType=typeExpr?|constant='let'|varType=typeExpr)
name=id ('[' arraySizes+=expr ']')* ('=' initial=expr)? NL
;
statements: statement*;
statementsBlock: statement*;
statement:
stmtIf
| stmtLoop
| stmtExitwhen
| stmtWhile
| localVarDef
| stmtSet
| stmtCall
| stmtReturn
| stmtForLoop
| stmtBreak
| stmtSkip
| stmtSwitch
;
stmtLoop: 'loop' NL statementsBlock ('end'|'endloop') NL;
stmtExitwhen: 'exitwhen' expr NL;
exprDestroy:
'destroy' expr
| expr '.' 'destroy' ('(' ')')?
;
stmtReturn:
'return' expr NL
;
stmtIf:
isStatic='static'? 'if' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
;
elseStatements:
'elseif' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
| 'else' NL statementsBlock ('endif'|'end') NL
| ('endif'|'end') NL
;
stmtSwitch:
'switch' expr NL
switchCase*
switchDefaultCase?
('end'|'endswitch')
;
switchCase:
'case' expr NL statementsBlock
;
switchDefaultCase:
'default' NL statementsBlock
;
stmtWhile:
'while' cond=expr NL statementsBlock
('end'|'endwhile')
;
localVarDef:
(var='var'|let='let'|'local'? type=typeExpr)
name=id ('=' initial=expr)? NL
;
localVarDefInline:
typeExpr? name=id
;
stmtSet:
'set'? left=exprAssignable
(assignOp=('='|'+='|'-='|'*='|'/=') right=expr
| incOp='++'
| decOp='--'
)
NL
;
exprAssignable:
exprMemberVar
| exprVarAccess
;
exprMemberVar:
expr dots=('.'|'..') varname=id indexes*
;
exprVarAccess:
varname=id indexes*
;
indexes:
'[' expr ']'
;
stmtCall: 'call'?
(
exprMemberMethod
| exprFunctionCall
| exprNewObject
| exprDestroy
) NL
;
exprMemberMethod:
receiver=expr dots=('.'|'..') funcName=id? typeArgs ('(' exprList ')')?
;
expr:
exprPrimary
| left=expr 'castTo' castToType=typeExpr
| left=expr 'instanceof' instaneofType=typeExpr
| receiver=expr dotsCall=('.'|'..') funcName=id? typeArgs '(' exprList ')'
| receiver=expr dotsVar=('.'|'..') varName=id? indexes*
| 'destroy' destroyedObject=expr
| destroyedObject=expr '.' 'destroy' '(' ')'
| left=expr op=('*'|'/'|'%'|'div'|'mod') right=expr
| op='-' right=expr // TODO move unary minus one up to be compatible with Java etc.
// currently it is here to be backwards compatible with the old wurst parser
| left=expr op=('+'|'-') right=expr
| left=expr op=('<='|'<'|'>'|'>=') right=expr
| left=expr op=('=='|'!=') right=expr
| op='not' right=expr
| left=expr op='and' right=expr
| left=expr op='or' right=expr
|
;
exprPrimary:
exprFunctionCall
| exprNewObject
| exprClosure
| exprStatementsBlock
| atom=(INT
| REAL
| STRING
| 'null'
| 'true'
| 'false'
| 'this'
| 'super')
| exprFuncRef
| varname=id indexes*
| '(' expr ')'
;
exprFuncRef: 'function' (scopeName=id '.')? funcName=id;
exprStatementsBlock:
'begin' NL statementsBlock 'end'
;
exprFunctionCall:
funcName=id typeArgs '(' exprList ')'
;
exprNewObject:'new' className=id typeArgs ('(' exprList ')')?;
exprClosure: formalParameters '->' expr;
typeParams: ('<' (params+=typeParam (',' params+=typeParam)*)? '>')?;
typeParam: name=id;
stmtForLoop:
forRangeLoop
| forIteratorLoop
;
forRangeLoop:
'for' loopVar=localVarDefInline '=' start=expr direction=('to'|'downto') end=expr ('step' step=expr)? NL
statementsBlock
('end'|'endfor')
;
forIteratorLoop:
'for' loopVar=localVarDefInline iterStyle=('in'|'from') iteratorExpr=expr NL
statementsBlock
('end'|'endfor')
;
stmtBreak:'break' NL;
stmtSkip:'skip' NL;
typeArgs: ('<' (args+=typeExpr (',' args+=typeExpr)*)? '>')?;
exprList : exprs+=expr (',' exprs+=expr)*;
nativeType: 'type' name=id ('extends' extended=id)? NL;
initBlock: 'init' NL
statementsBlock
('end'|'endinit') NL;
nativeDef: modifiersWithDoc 'native' funcSignature NL;
tupleDef: modifiersWithDoc 'tuple' name=id formalParameters NL;
extensionFuncDef: modifiersWithDoc 'function' receiverType=typeExpr '.' funcSignature NL
statementsBlock
('end'|'endfunction');
// some keywords are also valid identifiers for backwards compatibility reasons
id: ID|'end'|'init'|'this'|'new'|'destroy'|'it'|'to'|'from'|'class'|'thistype';
// Lexer:
CLASS: 'class';
RETURN: 'return';
IF: 'if';
ELSE: 'else';
WHILE: 'while';
FOR: 'for';
IN: 'in';
BREAK: 'break';
NEW: 'new';
NULL: 'null';
PACKAGE: 'package';
ENDPACKAGE: 'endpackage';
FUNCTION: 'function';
RETURNS: 'returns';
PUBLIC: 'public';
PULBICREAD: 'publicread';
READONLY: 'readonly';
DELEGATE: 'delegate';
STUB: 'stub';
PRIVATE: 'private';
PROTECTED: 'protected';
IMPORT: 'import';
INITLATER: 'initlater';
NATIVE: 'native';
NATIVETYPE: 'nativetype';
EXTENDS: 'extends';
INTERFACE: 'interface';
IMPLEMENTS: 'implements';
MODULE: 'module';
USE: 'use';
ABSTRACT: 'abstract';
STATIC: 'static';
THISTYPE: 'thistype';
OVERRIDE: 'override';
IMMUTABLE: 'immutable';
IT: 'it';
ARRAY: 'array';
AND: 'and';
OR: 'or';
NOT: 'not';
THIS: 'this';
CONSTRUCT: 'construct';
ONDESTROY: 'ondestroy';
DESTROY: 'destroy';
TYPE: 'type';
CONSTANT: 'constant';
ENDFUNCTION: 'endfunction';
NOTHING: 'nothing';
INIT: 'init';
CASTTO: 'castTo';
TUPLE: 'tuple';
DIV: 'div';
MOD: 'mod';
LET: 'let';
FROM: 'from';
TO: 'to';
DOWNTO: 'downto';
STEP: 'step';
SKIP: 'skip';
TRUE: 'true';
FALSE: 'false';
VAR: 'var';
INSTANCEOF: 'instanceof';
SUPER: 'super';
ENUM: 'enum';
SWITCH: 'switch';
CASE: 'case';
DEFAULT: 'default';
BEGIN: 'begin';
END: 'end';
LIBRARY: 'library';
ENDLIBRARY: 'endlibrary';
SCOPE: 'scope';
ENDSCOPE: 'endscope';
REQUIRES: 'requires';
USES: 'uses';
NEEDS: 'needs';
STRUCT: 'struct';
ENDSTRUCT: 'endstruct';
THEN: 'then';
ENDIF: 'endif';
LOOP: 'loop';
EXITHWHEN: 'exithwhen';
ENDLOOP: 'endloop';
METHOD: 'method';
TAKES: 'takes';
ENDMETHOD: 'endmethod';
SET: 'set';
CALL: 'call';
EXITWHEN: 'exitwhen';
INITIALIZER: 'initializer';
ENDINTERFACE: 'endinterface';
ENDCLASS: 'endclass';
ENDENUM: 'endenum';
ENDMODULE: 'endmodule';
ENDCONSTRUCT: 'endconstruct';
IMPLEMENT: 'implement';
ENDONDESTROY: 'endondestroy';
ENDSWITCH: 'endswitch';
ENDWHILE: 'endwhile';
ENDFOR: 'endfor';
ENDINIT: 'endinit';
COMMA: ',';
PLUS: '+';
PLUSPLUS: '++';
MINUS: '-';
MINUSMINUS: '--';
MULT: '*';
DIV_REAL: '/';
MOD_REAL: '%';
DOT: '.';
DOTDOT: '..';
PAREN_LEFT: '(';
PAREN_RIGHT: ')';
BRACKET_LEFT: '[';
BRACKET_RIGHT: ']';
EQ: '=';
EQEQ: '==';
NOT_EQ: '!=';
LESS: '<';
LESS_EQ: '<=';
GREATER: '>';
GREATER_EQ: '>=';
PLUS_EQ: '+=';
MINUS_EQ: '-=';
MULT_EQ: '*=';
DIV_EQ: '/=';
ARROW: '->';
INVALID:[];
JASS_GLOBALS: 'globals';
JASS_ENDGLOBALS: 'endglobals';
JASS_LOCAL: 'local';
JASS_ELSEIF: 'elseif';
NL: [\r\n]+;
ID: [a-zA-Z_][a-zA-Z0-9_]* ;
ANNOTATION: '@' [a-zA-Z0-9_]+;
STRING: '"' ( EscapeSequence | ~('\\'|'"'|'\r'|'\n') )* '"';
REAL: [0-9]+ '.' [0-9]* | '.'[0-9]+;
INT: [0-9]+ | '0x' [0-9a-fA-F]+ | '\'' . . . . '\'' | '\'' . '\'';
fragment EscapeSequence: '\\' [abfnrtvz"'\\];
DEBUG: 'debug' -> skip;
WS : [ \t]+ -> skip ;
HOTDOC_COMMENT: '/**' .*? '*/';
ML_COMMENT: '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
|
allow newlines after modifiers and annotations
|
Jurst: allow newlines after modifiers and annotations
|
ANTLR
|
apache-2.0
|
Cokemonkey11/WurstScript,Crigges/WurstScript,peq/WurstScript,peq/WurstScript,Cokemonkey11/WurstScript,wurstscript/WurstScript,Crigges/WurstScript,Crigges/WurstScript,Crigges/WurstScript,Crigges/WurstScript,Crigges/WurstScript,Cokemonkey11/WurstScript,Crigges/WurstScript,wurstscript/WurstScript,peq/WurstScript,Cokemonkey11/WurstScript,Cokemonkey11/WurstScript,peq/WurstScript,wurstscript/WurstScript,Crigges/WurstScript
|
195195262ac01123dd7ee3d4cc7af504241e0ffc
|
java-vtl-lexer/src/main/resources/kohl/hadrien/antlr4/Conditional.g4
|
java-vtl-lexer/src/main/resources/kohl/hadrien/antlr4/Conditional.g4
|
grammar Conditional;
expression : booleanExpression EOF ;
//
booleanExpression
: booleanExpression AND booleanExpression
| booleanExpression ( OR booleanExpression | XOR booleanExpression )
| booleanEquallity
| BOOLEAN_CONSTANT
;
booleanEquallity
: booleanEquallity ( ( EQ | NE | LE | GE ) booleanEquallity )
| datasetExpression
// typed constant?
;
datasetExpression
: 'dsTest'
;
EQ : '=' ;
NE : '<>' ;
LE : '<=' ;
GE : '>=' ;
AND : 'and' ;
OR : 'or' ;
XOR : 'xor' ;
BOOLEAN_CONSTANT : 'true' | 'false' ;
WS : [ \r\t\u000C] -> skip ;
|
Add conditional grammar
|
Add conditional grammar
|
ANTLR
|
apache-2.0
|
hadrienk/java-vtl,statisticsnorway/java-vtl,statisticsnorway/java-vtl,statisticsnorway/java-vtl,statisticsnorway/java-vtl,hadrienk/java-vtl,hadrienk/java-vtl
|
|
e1f91b82e441f71d96e930f39eb09ae585fc4a44
|
resources/LineGrammar.g4
|
resources/LineGrammar.g4
|
grammar LineGrammar;
/*
LineGrammer is a lightweight grammer for specifying a combination of melody line and harmonic context track.
It uses the python module line_constructor.py as an assist to build these items, and the module
line_grammar_executor as a exposed api to using this grammer to parse strings into lines and harmonic_context_tracks.
The grammar is relative easy:
{ ... } is how you start
{ ... [ ... [...] ... ] ...} as a way to do nested beams
{ ... (dur, #)[ ... ] ...] } as a way to do tuplets with dur being a unit duration, and # the number of them
dur * # is the full (locked) duration of the tuplet no matter how many notes
Notes: (duration) (letter) (alteration) : (register), e.g. hEb:5 is half note Eb in register 5
for convenience:
1) register may be specified once and assumed in further notes for that level, e.g. line, beam, tuplet.
2) same for duration, e.g. i is eight note, and further notes on same level are eights.
Example: '{ C:5 D Eb F (1:8, 2)[C:3 D:4 E] [i@C#:3 sBb D:4 Fbb]}'
Harmonic Contexts:
These are:
< ... >
< tonality : chord> where tonality is like Db-Major and chord is either say Eb-Min or ii.
< : chord> means tonality is picked up from where last specified.
Harmonic contexts are dropped whereever they start to take effect - duration and position are automatically
calculated.
Example: '{ <E-Major:iv> C:5 D Eb F (1:8, 2)[C:3 D:4 E] <:v> [i@C#:3 sBb D:4 Fbb]}'
NOTE: Ties are in the syntax but not supported at this time.
*/
@header {
from structure.LineGrammar.line_constructor import LineConstructor
import sys
}
@members {
self.lc = LineConstructor();
self._notelist = list()
}
/* This is the entry rule of our parser. */
motif: LINEBEGIN ( motificElement )+ LINEEND;
motificElement: ( (primitiveNote {self.lc.add_note($primitiveNote.n)} | harmonicTag)
| beam
| tuplet)
;
primitiveNote returns [n]
locals [dots=0, dur=None, ties=False]:
(duration {$dur = $duration.d} ( DOT {$dots = $dots + 1} )*)?
pitch
( TIE {$ties = True})? {$n = self.lc.construct_note($pitch.p, $dur, $dots, $ties)}
;
beam: '[' {self.lc.start_level()}
( motificElement )+
']' {self.lc.end_level()}
;
tuplet:
'(' duration ',' dur_int=INT ')'
'[' {self.lc.start_level($duration.d, dur_int=$dur_int.int)}
( motificElement )+
']' {self.lc.end_level()}
;
pitch returns [p]
locals [tt=None ,alert=None, reg=None]:
tone {$tt = $tone.t}
(':' INT {$reg = $INT.int})? {$p=self.lc.construct_pitch($tt, $reg)};
tone returns [t=None]
locals [ltr=None]:
((TONELETTER {$ltr = $TONELETTER.text}
| COMMON_TONE_ALTERATION_LETTER {$ltr = $COMMON_TONE_ALTERATION_LETTER.text}))
(alter=ALTERATION | alter=COMMON_TONE_ALTERATION_LETTER)? {$t=LineConstructor.construct_tone($ltr, $alter.text if $alter is not None else None)}
;
duration returns[d]:
( DURATIONLETTER {$d = LineConstructor.construct_duration_by_shorthand($DURATIONLETTER.text) }
| '(' durationFraction ')' {$d = LineConstructor.construct_duration($durationFraction.f[0], $durationFraction.f[1])});
durationFraction returns [f]:
numerator=INT ':' denominator=INT {$f = ($numerator.int, $denominator.int)};
tonality returns [tonal]:
tone '-' MODALITY {$tonal = self.lc.construct_tonality($tone.t, $MODALITY.text)};
chordTemplate returns [ctemplate]:
(tone '-' CHORDMODALITY {$ctemplate = self.lc.construct_chord_template($tone.t, $CHORDMODALITY.text)})
| CHORDNUMERAL {$ctemplate = self.lc.construct_chord_template(None, $CHORDNUMERAL.text)}
;
harmonicTag returns[ht]:
'<'
(( tonality ':' chordTemplate {$ht=self.lc.construct_harmonic_tag($tonality.tonal, $chordTemplate.ctemplate)})
| ( ':' chordTemplate {$ht=self.lc.construct_harmonic_tag(None, $chordTemplate.ctemplate)}))
'>'
;
DOT: '@';
TIE: '-';
INT : [0-9]+ ;
LINEBEGIN : '{';
LINEEND: '}';
WS : [ \t]+ -> skip ; // toss out whitespace
COMMON_TONE_ALTERATION_LETTER: 'b';
DURATIONLETTER: ('W' | 'w' | 'H' | 'h' | 'Q' | 'q' | 'I' | 'i' | 'S' | 's' | 'T' | 't' | 'X' | 'x');
TONELETTER: ('C' | 'D' | 'E' | 'F' | 'G' | 'A' | 'B' | 'c' | 'd' | 'e' | 'f' | 'g' | 'a' );
ALTERATION: ('b' | 'bb' | '#' | '##');
MODALITY: ('Major' | 'Natural' | 'Melodic' | 'Harmonic' | 'Minor');
CHORDNUMERAL: ('I' | 'II' | 'III' | 'IV' | 'V' | 'VI' | 'VII' | 'i' | 'ii' | 'iii' | 'iv' | 'v' | 'vi' | 'vii');
CHORDMODALITY: ('Maj' | 'Min' | 'Aug' | 'Dim') ;
|
Add antlr4 grammar file, for Line building.
|
Add antlr4 grammar file, for Line building.
|
ANTLR
|
mit
|
dpazel/music_rep
|
|
5ee7d929e8debea9250c294d2db3afa7b06a7847
|
csv/CSV.g4
|
csv/CSV.g4
|
grammar CSV;
file: hdr row+ ;
hdr : row ;
row : field (',' field)* '\r'? '\n' ;
field
: TEXT
| STRING
|
;
TEXT : ~[,\n\r"]+ ;
STRING : '"' ('""'|~'"')* '"' ; // quote-quote is an escaped quote
|
add CSV grammar
|
add CSV grammar
|
ANTLR
|
mit
|
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
|
|
508a0f27a55f575a969c2016fa81d48f5d559285
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
src/net/hillsdon/reviki/wiki/renderer/creole/CreoleTokens.g4
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"';:\\\\-=]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
// \L (when at the start) matches the start of a line.
ends[5] = "\\L*";
ends[6] = "\\L#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' {doHdr();} ;
HEnd : WS? '='* WS? (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'file:/' | 'mailto:' ;
Attachment : ALNUM+ '.' ALNUM+ ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
EmptyLink : ('[[' WS? ']]' | '{{' WS? '}}' |'[[' WS? '|' WS? ']]' | '{{' WS? '|' WS? '}}') -> skip ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : (~('|'|'\r'|'\n'|']'|'}') | ']' ~']' {seek(-1);} | '}' ~'}' {seek(-1);})+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') {seek(-1);} -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : (~' ' '}}}' | ' }}}' '\r'? '\n' {seek(-1);}) {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
/* Todo:
* - Comments justifying and explaining every rule.
*/
lexer grammar CreoleTokens;
options { superClass=ContextSensitiveLexer; }
@members {
Formatting bold;
Formatting italic;
Formatting strike;
public void setupFormatting() {
bold = new Formatting("**");
italic = new Formatting("//");
strike = new Formatting("--");
inlineFormatting.add(bold);
inlineFormatting.add(italic);
inlineFormatting.add(strike);
}
public boolean inHeader = false;
public boolean start = false;
public int listLevel = 0;
boolean nowiki = false;
boolean cpp = false;
boolean html = false;
boolean java = false;
boolean xhtml = false;
boolean xml = false;
boolean intr = false;
public void doHdr() {
String prefix = getText().trim();
boolean seekback = false;
if(!prefix.substring(prefix.length() - 1).equals("=")) {
prefix = prefix.substring(0, prefix.length() - 1);
seekback = true;
}
if(prefix.length() <= 6) {
if(seekback) {
seek(-1);
}
setText(prefix);
inHeader = true;
} else {
setType(Any);
}
}
public void setStart() {
String next1 = next();
String next2 = get(1);
start = (next1.equals("*") && !next2.equals("*")) || (next1.equals("#") && !next2.equals("#"));
}
public void doList(int level) {
listLevel = level;
seek(-1);
setStart();
resetFormatting();
}
public void doUrl() {
String url = getText();
String last = url.substring(url.length()-1);
String next = next();
if(url.endsWith("://") || url.endsWith("mailto:")) { setType(Any); }
while((last + next).equals("//") || last.matches("[\\.,)\"';:\\\\=-]")) {
seek(-1);
url = url.substring(0, url.length() - 1);
last = url.substring(url.length()-1);
next = next();
}
setText(url);
}
public void breakOut() {
resetFormatting();
listLevel = 0;
inHeader = false;
intr = false;
nowiki = false;
cpp = false;
html = false;
java = false;
xhtml = false;
xml = false;
}
public String[] thisKillsTheFormatting() {
String[] ends = new String[7];
if(inHeader || intr) {
ends[0] = "\n";
ends[1] = "\r\n";
} else {
ends[0] = null;
ends[1] = null;
}
if(intr) {
ends[2] = "|";
} else {
ends[2] = null;
}
ends[3] = "\n\n";
ends[4] = "\r\n\r\n";
if(listLevel > 0) {
// \L (when at the start) matches the start of a line.
ends[5] = "\\L*";
ends[6] = "\\L#";
} else {
ends[5] = null;
ends[6] = null;
}
return ends;
}
}
/* ***** Headings ***** */
HSt : LINE '='+ ~'=' {doHdr();} ;
HEnd : WS? '='* WS? (LineBreak | ParBreak) {inHeader}? {breakOut();} ;
/* ***** Lists ***** */
U1 : START '*' ~'*' {doList(1);} ;
U2 : START '**' ~'*' {listLevel >= 1}? {doList(2);} ;
U3 : START '***' ~'*' {listLevel >= 2}? {doList(3);} ;
U4 : START '****' ~'*' {listLevel >= 3}? {doList(4);} ;
U5 : START '*****' ~'*' {listLevel >= 4}? {doList(5);} ;
U6 : START '******' ~'*' {listLevel >= 5}? {doList(6);} ;
U7 : START '*******' ~'*' {listLevel >= 6}? {doList(7);} ;
U8 : START '********' ~'*' {listLevel >= 7}? {doList(8);} ;
U9 : START '*********' ~'*' {listLevel >= 8}? {doList(9);} ;
U10 : START '**********' ~'*' {listLevel >= 9}? {doList(10);} ;
O1 : START '#' ~'#' {doList(1);} ;
O2 : START '##' ~'#' {listLevel >= 1}? {doList(2);} ;
O3 : START '###' ~'#' {listLevel >= 2}? {doList(3);} ;
O4 : START '####' ~'#' {listLevel >= 3}? {doList(4);} ;
O5 : START '#####' ~'#' {listLevel >= 4}? {doList(5);} ;
O6 : START '######' ~'#' {listLevel >= 5}? {doList(6);} ;
O7 : START '#######' ~'#' {listLevel >= 6}? {doList(7);} ;
O8 : START '########' ~'#' {listLevel >= 7}? {doList(8);} ;
O9 : START '#########' ~'#' {listLevel >= 8}? {doList(9);} ;
O10 : START '##########' ~'#' {listLevel >= 9}? {doList(10);} ;
/* ***** Horizontal Rules ***** */
Rule : LINE '---' '-'+ {breakOut();} ;
/* ***** Tables ***** */
TdStartLn : LINE '|'+ {intr=true; setType(TdStart);} ;
ThStartLn : LINE '|'+ '=' {intr=true; setType(ThStart);} ;
RowEnd : '|' WS? LineBreak {intr}? {breakOut();} ;
TdStart : '|'+ {intr}? {breakOut(); intr=true;} ;
ThStart : '|'+ '=' {intr}? {breakOut(); intr=true;} ;
/* ***** Inline Formatting ***** */
BSt : '**' {!bold.active}? {setFormatting(bold, Any);} ;
ISt : '//' {!italic.active && !prior().matches("[a-zA-Z0-9]:")}? {setFormatting(italic, Any);} ;
SSt : '--' {!strike.active}? {setFormatting(strike, Any);} ;
BEnd : '**' {bold.active}? {unsetFormatting(bold);} ;
IEnd : '//' {italic.active && !prior().matches("[a-zA-Z0-9]:")}? {unsetFormatting(italic);} ;
SEnd : '--' {strike.active}? {unsetFormatting(strike);} ;
NoWiki : '{{{' {nowiki=true;} -> mode(CODE_INLINE) ;
StartCpp : '[<c++>]' {cpp=true;} -> mode(CODE_INLINE) ;
StartHtml : '[<html>]' {html=true;} -> mode(CODE_INLINE) ;
StartJava : '[<java>]' {java=true;} -> mode(CODE_INLINE) ;
StartXhtml : '[<xhtml>]' {xhtml=true;} -> mode(CODE_INLINE) ;
StartXml : '[<xml>]' {xml=true;} -> mode(CODE_INLINE) ;
/* ***** Links ***** */
LiSt : '[[' -> mode(LINK) ;
ImSt : '{{' -> mode(LINK) ;
/* ***** Breaks ***** */
InlineBrk : '\\\\' ;
ParBreak : LineBreak WS? LineBreak+ {breakOut();} ;
LineBreak : '\r'? '\n' ;
/* ***** Links ***** */
RawUrl : PROTOCOL (~(' '|'\t'|'\r'|'\n'|'|'|'['|']')+ '/'?)+ {doUrl();} ;
fragment PROTOCOL : ('http' 's'? | 'file' | 'ftp') '://' | 'file:/' | 'mailto:' ;
Attachment : ALNUM+ '.' ALNUM+ ;
WikiWords : (UPPER (ABBR | CAMEL) | INTERWIKI ALNUM+) {checkBounds("[\\.\\w:]", "\\w")}? ;
fragment INTERWIKI : ALPHA ALNUM+ ':' ;
fragment ABBR : UPPER UPPER+ ;
fragment CAMEL : (LOWNUM* UPNUM ALNUM* LOWER ALNUM* | ALNUM* LOWER ALNUM* UPNUM+) ;
/* ***** Macros ***** */
MacroSt : '<<' -> mode(MACRO) ;
/* ***** Miscellaneous ***** */
Any : . ;
WS : (' '|'\t')+ ;
EmptyLink : ('[[' WS? ']]' | '{{' WS? '}}' |'[[' WS? '|' WS? ']]' | '{{' WS? '|' WS? '}}') -> skip ;
fragment NOTALNUM : ~('A'..'Z'|'a'..'z'|'0'..'9') ;
fragment START : {start}? | LINE ;
fragment LINE : {getCharPositionInLine()==0}? (' '|'\t')*;
fragment LOWNUM : (LOWER | DIGIT) ;
fragment UPNUM : (UPPER | DIGIT) ;
fragment ALNUM : (ALPHA | DIGIT) ;
fragment ALPHA : (UPPER | LOWER) ;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
/* ***** Contextual stuff ***** */
mode LINK;
LiEnd : (']]' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
ImEnd : ('}}' | '\r'? '\n') -> mode(DEFAULT_MODE) ;
Sep : ' '* '|' ' '*;
InLink : (~('|'|'\r'|'\n'|']'|'}') | ']' ~']' {seek(-1);} | '}' ~'}' {seek(-1);})+ {setText(getText().trim());};
mode MACRO;
MacroName : ~(':'|'>')+ ;
MacroEndNoArgs : '>>' -> mode(DEFAULT_MODE) ;
MacroSep : ':' -> mode(MACRO_ARGS) ;
mode MACRO_ARGS;
MacroArgs : . -> more ;
MacroEnd : '>>' -> mode(DEFAULT_MODE) ;
mode CODE_INLINE;
AnyInline : ~('\r'|'\n') -> more;
OopsItsABlock : ('\r'|'\n') {seek(-1);} -> mode(CODE_BLOCK), more ;
EndNoWikiInline : '}}}' ~'}' {nowiki}? {nowiki=false; seek(-1);} -> mode(DEFAULT_MODE) ;
EndCppInline : '[</c++>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlInline : '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaInline : '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlInline : '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlInline : '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
mode CODE_BLOCK;
AnyText : . -> more ;
EndNoWikiBlock : (~' ' '}}}' | ' }}}' '\r'? '\n' {seek(-1);}) {nowiki}? {nowiki=false;} -> mode(DEFAULT_MODE) ;
EndCppBlock : ~' ' '[</cpp>]' {cpp}? {cpp=false;} -> mode(DEFAULT_MODE) ;
EndHtmlBlock : ~' ' '[</html>]' {html}? {html=false;} -> mode(DEFAULT_MODE) ;
EndJavaBlock : ~' ' '[</java>]' {java}? {java=false;} -> mode(DEFAULT_MODE) ;
EndXhtmlBlock : ~' ' '[</xhtml>]' {xhtml}? {xhtml=false;} -> mode(DEFAULT_MODE) ;
EndXmlBlock : ~' ' '[</xml>]' {xml}? {xml=false;} -> mode(DEFAULT_MODE) ;
|
Fix bad range in URL regex
|
Fix bad range in URL regex
|
ANTLR
|
apache-2.0
|
CoreFiling/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,ashirley/reviki,CoreFiling/reviki,strr/reviki,strr/reviki,CoreFiling/reviki,CoreFiling/reviki,strr/reviki,ashirley/reviki
|
7c6cf2fa27cda28b714b130c2f4b8bdc289fd865
|
deployment/osmaxxProduction.vhost
|
deployment/osmaxxProduction.vhost
|
WSGIDaemonProcess osmaxx.dev python-path=/var/www/eda/environment/:/var/www/eda/environment/lib/python3.4/site-packages
WSGIProcessGroup osmaxx.dev
ErrorLog /var/log/apache2/osmaxx.log
WSGIScriptAlias / /var/www/eda/projects/osmaxx/wsgi.py
Alias "/static/admin" "/var/www/eda/environment/lib/python3.4/site-packages/django/contrib/admin/static/admin"
Alias "/static/excerptexport" "/var/www/eda/projects/excerptexport/static/excerptexport"
<Directory /var/www/eda/projects>
<Files osmaxx/wsgi.py>
Require all granted
</Files>
</Directory>
|
WSGIDaemonProcess osmaxx.dev python-path=/var/www/eda/environment/:/var/www/eda/environment/lib/python3.4/site-packages
WSGIProcessGroup osmaxx.dev
ErrorLog /var/log/apache2/osmaxx.log
WSGIScriptAlias / /var/www/eda/projects/osmaxx/wsgi.py
Alias "/static/admin" "/var/www/eda/environment/lib/python3.4/site-packages/django/contrib/admin/static/admin"
Alias "/static/excerptexport" "/var/www/eda/projects/excerptexport/static/excerptexport"
<Directory /var/www/eda/projects>
<Files osmaxx/wsgi.py>
Require all granted
</Files>
</Directory>
|
add newline at end of file
|
add newline at end of file
|
ApacheConf
|
mit
|
geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/drf-utm-zone-info
|
ea17f2140e0ecd1c1cf34a72fe12c6c65bd15780
|
images/nginx/xtc.vhost
|
images/nginx/xtc.vhost
|
server {
server_name mobile.viewspeaker.com mobile.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /admin/index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
server {
server_name mobile.api.viewspeaker.com mobile.api.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
server {
server_name mobile.viewspeaker.com mobile.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /admin/index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
server {
server_name mobile.api.viewspeaker.com mobile.api.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
server {
server_name viewspeaker.com www.viewspeaker.com;
root /var/www/vs;
index index.html;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
update vs site
|
update vs site
|
ApacheConf
|
mit
|
newbdez33/phpstack
|
b879e117963635056adf1d2029e3d4e6d44eede4
|
sites/default.vhost
|
sites/default.vhost
|
server {
server_name default;
root /var/www/public;
index main.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /status {
access_log off;
allow 172.17.0.0/16;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /status;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /ping {
access_log off;
allow all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /ping;
fastcgi_pass unix:/Var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
server {
server_name default;
root /var/www/public;
index main.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri.html $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location /status {
access_log off;
allow 172.17.0.0/16;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /status;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /ping {
access_log off;
allow all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /ping;
fastcgi_pass unix:/Var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
Remove .php extensions from url
|
Remove .php extensions from url
|
ApacheConf
|
mit
|
hector-valdivia/docker-php-mongodb-mysql-nginx
|
03d24d5af1354b7c85761f1003134f64f173d20f
|
var/docker/conf/nginx/sites/default.vhost
|
var/docker/conf/nginx/sites/default.vhost
|
server {
server_name default;
root /var/www/web;
index index.php;
client_max_body_size 16M;
fastcgi_read_timeout 60;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/(index|index_dev)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~ \.php$ {
return 404;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
}
|
server {
server_name default;
root /var/www/web;
index index.php;
client_max_body_size 16M;
fastcgi_read_timeout 60;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/(index|index_dev)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~ \.php$ {
return 404;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires off;
log_not_found off;
access_log off;
}
}
|
Set default vhost expires off for assets
|
Set default vhost expires off for assets
|
ApacheConf
|
mit
|
honeylex/honeylex,honeylex/honeylex,honeylex/honeylex
|
57d1f6d8ff85ed313a0de0587d42923d7aa96dd8
|
config/devel.vhost
|
config/devel.vhost
|
#
# This file is part of the Berny\Project-Manager package
#
# (c) Berny Cantos <[email protected]>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
<VirtualHost *:80>
ServerName localhost.devel
ServerAlias *.devel
DocumentRoot /var/www/public
VirtualDocumentRoot /var/www/public/%-2+
php_admin_value auto_prepend_file /var/www/boot/docroot.php
# combined log for all virtual hosts
# can be split per-vhost based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/www/log/access.log vcommon
ErrorLog /var/www/log/errors.log
UseCanonicalName Off
AcceptPathInfo On
<IfModule mod_rewrite.c>
RewriteLog /var/www/log/rewrite.log
RewriteLogLevel 1
</IfModule>
</VirtualHost>
|
#
# This file is part of the Berny\Project-Manager package
#
# (c) Berny Cantos <[email protected]>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
<VirtualHost *:80>
ServerName localhost.devel
ServerAlias *.devel
DocumentRoot /var/www/public
VirtualDocumentRoot /var/www/public/%-1+
php_admin_value auto_prepend_file /var/www/boot/docroot.php
UseCanonicalName Off
AcceptPathInfo On
# combined log for all virtual hosts
# can be split per-vhost based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/www/log/access.log vcommon
ErrorLog /var/www/log/errors.log
<IfModule mod_rewrite.c>
RewriteLog /var/www/log/rewrite.log
RewriteLogLevel 1
</IfModule>
</VirtualHost>
|
fix virtual root
|
fix virtual root
|
ApacheConf
|
mit
|
xphere/project-manager
|
ce95cbae420b99535cdc20c267ab3af809841a3e
|
examples/apache2/default.vhost
|
examples/apache2/default.vhost
|
WSGIPythonPath /path/to/repo/FuzzManager/server
<VirtualHost *:80>
ServerName fuzzmanager.your.domain
Alias /static/ /path/to/repo/FuzzManager/server/crashmanager/static/
Alias /tests/ /path/to/repo/FuzzManager/server/tests/
WSGIScriptAlias / /path/to/repo/FuzzManager/server/server/wsgi.py
WSGIPassAuthorization On
<Location />
AuthType Basic
AuthName "LDAP Login"
AuthBasicProvider file ldap
AuthUserFile /path/to/.htpasswd
# Your LDAP configuration here, including Require directives
# This user is used by clients to download test cases and signatures
Require user fuzzmanager
</Location>
<Location /crashmanager/rest/>
Satisfy Any
Allow from all
</Location>
<Directory /path/to/repo/FuzzManager/server>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
|
WSGIDaemonProcess fuzzmanager.your.domain python-path=/path/to/repo/FuzzManager/server
WSGIProcessGroup fuzzmanager.your.domain
WSGIApplicationGroup %{GLOBAL}
<VirtualHost *:80>
ServerName fuzzmanager.your.domain
Alias /static/ /path/to/repo/FuzzManager/server/crashmanager/static/
Alias /tests/ /path/to/repo/FuzzManager/server/tests/
WSGIScriptAlias / /path/to/repo/FuzzManager/server/server/wsgi.py process-group=fuzzmanager.your.domain
WSGIPassAuthorization On
<Location />
AuthType Basic
AuthName "LDAP Login"
AuthBasicProvider file ldap
AuthUserFile /path/to/.htpasswd
# Your LDAP configuration here, including Require directives
# This user is used by clients to download test cases and signatures
Require user fuzzmanager
</Location>
<Location /crashmanager/rest/>
Satisfy Any
Allow from all
</Location>
<Location /ec2spotmanager/rest/>
Satisfy Any
Allow from all
</Location>
<Directory /path/to/repo/FuzzManager/server>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
|
Update example vhost file for Apache2
|
Update example vhost file for Apache2
|
ApacheConf
|
mpl-2.0
|
MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager
|
8bebd2a290732cc173f95796d9f076264c887bd8
|
nginx/api.gouv.vhost
|
nginx/api.gouv.vhost
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name ~^particulier(-dev|-test|-local|)\.api\.gouv\.fr$ default;
location /docs {
root /var/www;
add_header 'Access-Control-Allow-Origin' '*';
}
location /status {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
root /var/www;
}
}
|
server {
listen 80 default_server;
root /var/www/app;
index index.html;
server_name ~^particulier(-dev|-test|-local|)\.api\.gouv\.fr$ default;
location /docs {
root /var/www;
add_header 'Access-Control-Allow-Origin' '*';
}
location /status {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
root /var/www;
}
}
|
set the app as the default server
|
set the app as the default server
|
ApacheConf
|
agpl-3.0
|
sgmap/api-particulier,sgmap/api-particulier
|
8df7c8359ed3d94d6baf96e1a5867398f2425264
|
developmentEnvironment/osmaxx.vhost
|
developmentEnvironment/osmaxx.vhost
|
WSGIDaemonProcess osmaxx.dev python-path=/var/www/eda/environment/:/var/www/eda/environment/lib/python3.4/site-packages
WSGIProcessGroup osmaxx.dev
ErrorLog /var/log/apache2/osmaxx.log
WSGIScriptAlias / /var/www/eda/projects/osmaxx/wsgi.py
Alias "/static/admin" "/var/www/eda/environment/lib/python3.4/site-packages/django/contrib/admin/static/admin"
Alias /resources/ /var/www/eda/projects/resources/public/
<Directory /var/www/eda/projects>
<Files osmaxx/wsgi.py>
Require all granted
</Files>
</Directory>
|
WSGIDaemonProcess osmaxx.dev python-path=/var/www/eda/environment/:/var/www/eda/environment/lib/python3.4/site-packages
WSGIProcessGroup osmaxx.dev
ErrorLog /var/log/apache2/osmaxx.log
WSGIScriptAlias / /var/www/eda/projects/osmaxx/wsgi.py
Alias "/static/admin" "/var/www/eda/environment/lib/python3.4/site-packages/django/contrib/admin/static/admin"
Alias "/static/excerptexport" "/var/www/eda/projects/excerptexport/static/excerptexport"
<Directory /var/www/eda/projects>
<Files osmaxx/wsgi.py>
Require all granted
</Files>
</Directory>
|
Fix alias for apache to server static files. Fixes #3
|
Bugfix: Fix alias for apache to server static files. Fixes #3
|
ApacheConf
|
isc
|
geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend
|
27e0ac67b0e2fb336f9ef640b7c4640df8ba482b
|
sites/default.vhost
|
sites/default.vhost
|
server {
server_name default;
root /var/www/public;
index main.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri.html $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location /status {
access_log off;
allow 172.17.0.0/16;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /status;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /ping {
access_log off;
allow all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /ping;
fastcgi_pass unix:/Var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
server {
server_name keya;
root /var/www/public;
index main.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri.html $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location /status {
access_log off;
allow 172.17.0.0/16;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /status;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /ping {
access_log off;
allow all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /ping;
fastcgi_pass unix:/Var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
Update default.vhost
|
Update default.vhost
|
ApacheConf
|
mit
|
hector-valdivia/docker-php-mongodb-mysql-nginx
|
e7f3b55c8cfa0f43011773a090bb9795cbaf3e05
|
nginx/apiparticulier.vhost
|
nginx/apiparticulier.vhost
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name apiparticulier.sgmap.fr default;
location /docs {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
rewrite /tech(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://tech:4567;
}
}
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name ~^apiparticulier(-dev|-test|-local|)\.sgmap\.fr$ default;
location /docs {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
rewrite /tech(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://tech:4567;
}
}
|
add regex to tolerate all env
|
add regex to tolerate all env
|
ApacheConf
|
agpl-3.0
|
sgmap/api-particulier,sgmap/api-particulier
|
202f2c7e12579e850b048ad9ccaff68bc1700b95
|
nginx/apiparticulier.vhost
|
nginx/apiparticulier.vhost
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name apiparticulier.sgmap.fr default;
location /docs {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://tech:4567;
}
}
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name apiparticulier.sgmap.fr default;
location /docs {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
rewrite /tech(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://tech:4567;
}
}
|
add url rewritting for tech redirect
|
add url rewritting for tech redirect
|
ApacheConf
|
agpl-3.0
|
sgmap/api-particulier,sgmap/api-particulier
|
ef422488a438302b5959cd3e97edb6f393a0085c
|
var/docker/conf/nginx/sites/default.vhost
|
var/docker/conf/nginx/sites/default.vhost
|
server {
server_name default;
root /var/www/web;
index index.php;
client_max_body_size 16M;
fastcgi_read_timeout 60;
location @rewrite {
rewrite ^/([^?]*)$ /index.php?/$1 last;
}
location / {
try_files $uri $uri/ @rewrite;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
server {
server_name default;
root /var/www/web;
index index.php;
client_max_body_size 16M;
fastcgi_read_timeout 60;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/(index|index_dev)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~ \.php$ {
return 404;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
}
|
Fix vhost
|
Fix vhost
|
ApacheConf
|
mit
|
honeylex/honeylex,honeylex/honeylex,honeylex/honeylex
|
f85cca2c42547907264a94cdc7d72e271de67bda
|
support/nginx.vhost
|
support/nginx.vhost
|
server {
listen <YOURIP>:443 ssl;
server_name <YOURFQDN>;
ssl_certificate /etc/nginx/ssl/server.pem;
ssl_certificate_key /etc/nginx/ssl/server.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/www/virtual/cpves/logs/nginx_access.log;
error_log /var/www/virtual/cpves/logs/nginx_error.log;
root /var/www/virtual/cpves/html/web;
index index.php;
location ~ ^(.*)\/\.(.*)$ {
return 404;
}
location ~ ^(.*)\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/www/virtual/cpves/sockets/phpfpm.socket;
}
}
|
server {
listen <YOURIP>:443 ssl;
server_name <YOURFQDN>;
ssl_certificate /etc/nginx/ssl/cpves.pem;
ssl_certificate_key /etc/nginx/ssl/cpves.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/www/virtual/cpves/logs/nginx_access.log;
error_log /var/www/virtual/cpves/logs/nginx_error.log;
root /var/www/virtual/cpves/html/web;
index index.php;
location ~ ^(.*)\/\.(.*)$ {
return 404;
}
location ~ ^(.*)\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/www/virtual/cpves/sockets/phpfpm.socket;
}
}
|
fix nginx vhost
|
fix nginx vhost
|
ApacheConf
|
agpl-3.0
|
tobiasge/cpves,tobiasge/cpves,hggh/cpves,hggh/cpves,tobiasge/cpves,hggh/cpves,tobiasge/cpves,hggh/cpves
|
2c6bda58cdf1056e61685c68bdfbc39ddfacc4e2
|
images/nginx/xtc.vhost
|
images/nginx/xtc.vhost
|
server {
server_name mobile.viewspeaker.com;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /admin/index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
server {
server_name mobile.api.viewspeaker.com;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
server {
server_name mobile.viewspeaker.com mobile.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /admin/index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
server {
server_name mobile.api.viewspeaker.com mobile.api.viewspeaker.cat;
root /var/www/xtc;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
|
update xtc web config
|
update xtc web config
|
ApacheConf
|
mit
|
newbdez33/phpstack
|
139ff2fefb711c06ac02a99ca5a26cfa6b8fd670
|
sites/default.vhost
|
sites/default.vhost
|
server {
server_name default;
root /var/www/default;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
}
}
|
server {
server_name default;
root /var/www/default;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
}
}
|
Enable GET parameters
|
Enable GET parameters
|
ApacheConf
|
mit
|
inhere/dockerenv,inhere/dockerenv,myorb/php-dockerized,mmswebinternet/php-dockerized,kasperisager/phpstack,mmswebinternet/php-dockerized,mmswebinternet/php-dockerized,mmswebinternet/php-dockerized,yazashin/php-dockerized,kasperisager/php-dockerized
|
6005466152f20f85707767cc00bf42482eb55215
|
travis-ci/default.vhost
|
travis-ci/default.vhost
|
server {
listen *:9000;
root /var/www/html;
server_name localhost;
charset UTF-8;
# Block Bad Bots
include /etc/nginx/bots.d/blockbots.conf;
include /etc/nginx/bots.d/ddos.conf;
}
|
server {
listen *:9000;
root /var/www/html;
server_name localhost;
charset UTF-8;
location / {
root /var/www/html/;
}
}
|
test with new default.vhost file
|
test with new default.vhost file
|
ApacheConf
|
mit
|
mitchellkrogza/Travis-CI-Nginx-for-Testing-Nginx-Configuration,mitchellkrogza/Travis-CI-Nginx-for-Testing-Nginx-Configuration
|
555333287eff87cf5652500f224e18428b179f99
|
nginx/apiparticulier.vhost
|
nginx/apiparticulier.vhost
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name ~^apiparticulier(-dev|-test|-local|)\.sgmap\.fr$ default;
location /docs {
root /var/www;
add_header 'Access-Control-Allow-Origin' '*.gouv.fr';
}
location /status {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
root /var/www;
}
}
|
server {
listen 80;
root /var/www/app;
index index.html;
server_name ~^apiparticulier(-dev|-test|-local|)\.sgmap\.fr$ default;
location /docs {
root /var/www;
add_header 'Access-Control-Allow-Origin' '*';
}
location /status {
root /var/www;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://app:3004;
}
location /tech {
root /var/www;
}
}
|
remove restriction on CORS
|
remove restriction on CORS
|
ApacheConf
|
agpl-3.0
|
sgmap/api-particulier,sgmap/api-particulier
|
3622256e6ffb026af1ba30131027ed8109c668e7
|
nginx.vhost
|
nginx.vhost
|
server {
server_name push.example.fr;
root /var/www/push.example.fr;
access_log /var/log/nginx/push.example.fr.access.log;
error_log /var/log/nginx/push.example.fr.error.log;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ "^/([\w\d]{4})$" {
try_files $uri /pages/decoder.php?decode=$1;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
|
Add nginx configuration
|
Add nginx configuration
Signed-off-by: Konosprod <[email protected]>
|
ApacheConf
|
apache-2.0
|
Konosprod/ciconia,Konosprod/ciconia,Konosprod/ciconia,Konosprod/ciconia
|
|
44ba7c16998a9af9ea592866113b9750f685ce9c
|
Resources/doc/sample/nginx.vhost
|
Resources/doc/sample/nginx.vhost
|
server {
server_name [domain];
root [symfony-web-root]
location / {
include proxy_params;
proxy_set_header X-Forwarded-Host "$http_host:$server_port";
proxy_pass http://127.0.0.1:9100$request_uri;
}
error_log /var/log/nginx/syrma.log;
access_log /var/log/nginx/syrma.log;
}
|
add nginx sample config
|
add nginx sample config
|
ApacheConf
|
mit
|
syrma-php/web-container-bundle
|
|
45bdf825091f5a786567eaa4747eeb5e2ecaa955
|
nginx.vhost
|
nginx.vhost
|
server {
root /path/to/vhost/public;
index index.php index.html index.htm;
server_name localhost;
client_max_body_size 20M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .*.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
|
add nginx vhost
|
add nginx vhost
|
ApacheConf
|
agpl-3.0
|
BillRun/system,BillRun/system,BillRun/system,BillRun/system
|
|
d409200a74b191cd0459f893357003b7dc7d46b3
|
symfony.vhost
|
symfony.vhost
|
<VirtualHost *:80>
ServerName symfony.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/vhosts/symfony/web
# DirectoryIndex app.php
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/vhosts/symfony/>
DirectoryIndex app.php
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
RedirectMatch permanent ^/app\.php/(.*) /$1
Options FollowSymLinks
</Directory>
ErrorLog ${APACHE_LOG_DIR}/symfony-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/symfony-access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName symfony.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/vhosts/symfony/web
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/vhosts/symfony/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/symfony-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/symfony-access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
|
Add example vhost file
|
Add example vhost file
|
ApacheConf
|
mit
|
jerram/symfony-preloaded
|
|
a7480a1cdf5489ee20f2d0818d2108b1505fca5a
|
apache.vhost
|
apache.vhost
|
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /path/to/vhost/public/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path/to/vhost/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
|
add apache vhost
|
add apache vhost
|
ApacheConf
|
agpl-3.0
|
BillRun/system,BillRun/system,BillRun/system,BillRun/system
|
|
1f5a2fb06093e8e11d38ae23ea51d06a70147db9
|
data/apache.vhost
|
data/apache.vhost
|
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /path/to/vhost/public/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path/to/vhost/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
|
add apache vhost to data folder
|
add apache vhost to data folder
useful for fresh installation
|
ApacheConf
|
agpl-3.0
|
BillRun/NPG,BillRun/NPG,BillRun/NPG
|
|
adfb6a81608f42045443a5c28408f5dd15be1c5e
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
Category related resources of the **Money Advice Service**.
## Categories Collection [/{locale}/categories]
A collection of categories including their subcategories
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Categories.
+ Values
+ `en`
+ `cy`
### Retrieve all Categories [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/categories>; rel="alternate"; hreflang="cy"
+ Body
{
"id": "life-events",
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"subCategories": [
{
"id": "setting-up-home",
"title": "Setting up home",
"description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n",
"subCategories": [
]
}
]
}
## Category [/{locale}/categories/{id}]
A single category object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Category.
+ Values
+ `en`
+ `cy`
+ id (required, string, `life-events`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"contents":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
Category related resources of the **Money Advice Service**.
## Categories Collection [/{locale}/categories]
A collection of categories including their subcategories
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Categories.
+ Values
+ `en`
+ `cy`
### Retrieve all Categories [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/categories>; rel="alternate"; hreflang="cy"
+ Body
[
{
"id": "life-events",
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"subCategories": [
{
"id": "setting-up-home",
"title": "Setting up home",
"description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n",
"subCategories": [
]
}
]
}
]
## Category [/{locale}/categories/{id}]
A single category object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Category.
+ Values
+ `en`
+ `cy`
+ id (required, string, `life-events`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"contents":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
Return an array rather than a single item
|
Return an array rather than a single item
|
API Blueprint
|
mit
|
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
|
66ff13d63c21f32ea9ea8b9d2ae08011d9efcc5b
|
apiary.apib
|
apiary.apib
|
# Lion API
Lion is a basic localization service using `git` as the backend for storing translations.
## Request headers
All requests to Lion must include the following headers:
- `Lion-Api-Key`
- `Lion-Api-Secret`
- `Lion-Api-Version`
# Projects
## Project management [/project/{name}]
+ Parameters
+ name (required, string) ... Project name
### Get project [GET]
Fetch project details, given the projects' name.
+ Request (application/json)
+ Header
Lion-Api-Key: <YOUR_API_KEY>
Lion-Api-Secret: <YOUR_API_SECRET>
Lion-Api-Version: v1
+ Response 200 (application/json)
+ Header
Lion-Api-Version: v1
+ Body
{
"name": "Project name",
"resources": [
"resource1",
"..."
]
}
+ Response 401 (application/json)
+ Header
Lion-Api-Version: v1
+ Response 403 (application/json)
+ Header
Lion-Api-Version: v1
+ Response 404 (application/json)
+ Header
Lion-Api-Version: v1
|
# Lion API
Lion is a basic localization service using `git` as the backend for storing translations.
## Request headers
All requests to Lion must include the following headers:
- `Lion-Api-Key`
- `Lion-Api-Secret`
- `Lion-Api-Version`
# Projects
## Project management [/project/{name}]
+ Parameters
+ name (required, string) ... Project name
### Get project [GET]
Fetch project details, given the projects' name.
+ Request (application/json)
+ Header
Lion-Api-Key: <YOUR_API_KEY>
Lion-Api-Secret: <YOUR_API_SECRET>
Lion-Api-Version: v1
+ Response 200 (application/json)
+ Header
Lion-Api-Version: v1
+ Body
{
"name": "Project name",
"resources": [
"resource1",
"..."
]
}
+ Response 401 (application/json)
+ Header
Lion-Api-Version: v1
+ Response 403 (application/json)
+ Header
Lion-Api-Version: v1
+ Response 404 (application/json)
+ Header
Lion-Api-Version: v1
|
Replace tabs with spaces
|
Replace tabs with spaces
|
API Blueprint
|
mit
|
sebdah/lion
|
84f41473df4f4568a817687cfd557876fe70566b
|
doc/example-teapot.apib
|
doc/example-teapot.apib
|
---- APIB generated from HAR ----
---
---
# Step 1
GET http://httpbin.org/status/418
> Accept: *
> User-Agent: KATT
< 418
< x-more-info: http://tools.ietf.org/html/rfc2324
<<<
-=[ teapot ]=-
_...._
.' _ _ `.
| ."` ^ `". _,
\_;`"---"`|//
| ;/
\_ _/
`"""`
>>>
|
---- APIB generated from HAR ----
---
---
# Step 1
GET https://httpbin.org/status/418
> Accept: *
> User-Agent: KATT
< 418
< x-more-info: http://tools.ietf.org/html/rfc2324
<<<
-=[ teapot ]=-
_...._
.' _ _ `.
| ."` ^ `". _,
\_;`"---"`|//
| ;/
\_ _/
`"""`
>>>
|
use https for httpbin
|
use https for httpbin
|
API Blueprint
|
apache-2.0
|
for-GET/katt
|
04169477b588046636d0f9457f5da5a41d6d5b26
|
apiary.apib
|
apiary.apib
|
HOST: https://api.loader.io/v2
--- loader.io API load testing documentation ---
---
All requests require an API key. While you can specify the API key in the body of your request, we’d prefer it be passed via the loaderio-Auth header. You can do this as follows:
In the Header: loaderio-Auth: {api_key}
In the Body: api_key={api_key}
---
--
Application Resources
--
List registered applications
GET /apps
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
[
{
"app": "gonnacrushya.com",
"status": "verified",
"app_id": "0f2fabf74c5451cf71dce7cf43987477"
},
{
"app": "google.com",
"status": "unverified",
"app_id": "b579bbed7ef480e7318ac4d7b69e5caa"
}
]
Application status
GET /apps/{app_id}
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
{
"app": "gonnacrushya.com",
"status": "verified",
"app_id": "0f2fabf74c5451cf71dce7cf43987477"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Register a new application
Format: myapp.com or www.myapp.com (note: myapp.com & www.myapp.com are different applications)
POST /apps
> loaderio-Auth: {api_key}
> Content-Type: application/json
{
"app": "gonnacrushya.com"
}
< 200
< Content-Type: application/json
{
"message": "success",
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"verification_id": "loaderio-0f2fabf74c5451cf71dce7cf43987477"
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["We are unable to register this app"]
}
Verify a registered application
POST /apps/{app_id}/verify
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
{
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"message": "success"
}
+++++
< 422
< Content-Type: application/json
{
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"message":"error",
"errors":["can't verify domain gonnacrushya.com"]
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
--
Test Resources
--
List of load tests
GET /tests
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
[
{
"name":"",
"duration":60,
"timeout":10000,
"notes":"",
"initial":0,
"total":60,
"status":"complete",
"test_id":"9b24d675afb6c09c6813a79c956f0d02",
"test_type":"Non-Cycling",
"callback":"http://loader.io",
"callback_email":"[email protected]",
"scheduled_at": "2013-06-07T19:30:00+03:00",
"urls":
[
{
"url":"http://loader.io/signin",
"raw_post_body":null,
"request_type":"GET",
"payload_file_url":null,
"headers":{ "header": "value", "header2": "value2" },
"request_params":{ "param": "value", "param2": "value2" },
"authentication":{"login": "login", "password": "password", "type": "basic"}
}
]
}
]
Create a new load test
POST /tests
> loaderio-Auth: {api_key}
> Content-type: application/json
{
"initial": 0,
"total": 60,
"duration": 60,
"callback": "http://gonnacrushya.com/loader-callback",
"name": "GonnaCrushYa Home Page",
"timeout": 10000,
"callback_email": "[email protected]",
"test_type": "cycling",
"notes": "Going to kicks the crap out of this server",
"scheduled_at": "2013-5-15 3:30:00",
"urls": [
{
"url": "http://gonnacrushya.com",
"request_type": "GET",
"post_body": "post body params go here",
"payload_file_url": "http://loader.io/payload_file.yml",
"authentication": {"login": "login", "password": "secret", "type": "basic"},
"headers": { "header1": "value1", "header2": "value2" },
"request_params": { "params1": "value1", "params2": "value2" }
}
]
}
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"processing"
"result_id": "35b581b6bf1332c70b0642ee5387b4ee"
}
+++++
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"unverified"
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["can't create test"]
}
Load test status
GET /tests/{test_id}
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"name":"",
"duration":60,
"timeout":10000,
"notes":"",
"initial":0,
"total":60,
"status":"complete",
"test_id":"9b24d675afb6c09c6813a79c956f0d02",
"test_type":"Non-Cycling",
"callback":"http://loader.io",
"callback_email":"[email protected]",
"scheduled_at": "2013-06-07T19:30:00+03:00",
"urls":
[
{
"url":"http://loader.io/signin",
"raw_post_body":null,
"request_type":"GET",
"payload_file_url":null,
"headers":{ "header": "value", "header2": "value2" },
"request_params":{"param": "value", "param2": "value2" },
"authentication":{"login": "login", "password": "password", "type": "basic"}
}
]
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Run load test
PUT /tests/{test_id}/run
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"processing"
"result_id": "35b581b6bf1332c70b0642ee5387b4ee"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["Can't run test for unverified application"]
}
Stop load test
PUT /tests/{test_id}/stop
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"message":"success",
"test_id":"1187538bb5d5fd60a1b99a6e67978c15",
"status":"finished",
"result_id":"7c55ad8408f7c4326b7fa0e069b7a011"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["Can't stop test with finished status"]
}
--
Test results
--
Load test results
GET /tests/{test_id}/results
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
[
{
"result_id": "8fb213af34c1cf7b675dc21e900e533a",
"started_at":"2013-06-10T23:42:01+02:00",
"status":"ready",
"public_results_url":"http://loader.io/results/a72944b62d576f0f68fb30ca41d20b99/summaries/8fb213af34c1cf7b675dc21e900e533a",
"success":77,
"error":0,
"timeout_error":0,
"network_error":0,
"data_sent":28259,
"data_received":8393,
"avg_response_time":1,
"avg_error_rate":0.0
}
]
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Load test result
GET /tests/{test_id}/results/{result_id}
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"result_id": "8fb213af34c1cf7b675dc21e900e533a",
"started_at":"2013-06-10T23:42:01+02:00",
"status":"ready",
"public_results_url":"http://loader.io/results/a72944b62d576f0f68fb30ca41d20b99/summaries/8fb213af34c1cf7b675dc21e900e533a",
"success":77,
"error":0,
"timeout_error":0,
"network_error":0,
"data_sent":28259,
"data_received":8393,
"avg_response_time":1,
"avg_error_rate":0.0
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
--
Servers
--
Load test server's ip addresses
GET /servers
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"ip_addresses": ["127.0.0.1"]
}
|
HOST: https://api.loader.io/v2
--- loader.io API load testing documentation ---
---
All requests require an API key. While you can specify the API key in the body of your request, we’d prefer it be passed via the loaderio-Auth header. You can do this as follows:
In the Header: loaderio-Auth: {api_key}
In the Body: api_key={api_key}
---
--
Application Resources
--
List registered applications
GET /apps
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
[
{
"app": "gonnacrushya.com",
"status": "verified",
"app_id": "0f2fabf74c5451cf71dce7cf43987477"
},
{
"app": "google.com",
"status": "unverified",
"app_id": "b579bbed7ef480e7318ac4d7b69e5caa"
}
]
Application status
GET /apps/{app_id}
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
{
"app": "gonnacrushya.com",
"status": "verified",
"app_id": "0f2fabf74c5451cf71dce7cf43987477"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Register a new application
Format: myapp.com or www.myapp.com (note: myapp.com & www.myapp.com are different applications)
POST /apps
> loaderio-Auth: {api_key}
> Content-Type: application/json
{
"app": "gonnacrushya.com"
}
< 200
< Content-Type: application/json
{
"message": "success",
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"verification_id": "loaderio-0f2fabf74c5451cf71dce7cf43987477"
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["We are unable to register this app"]
}
Verify a registered application
POST /apps/{app_id}/verify
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
{
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"message": "success"
}
+++++
< 422
< Content-Type: application/json
{
"app_id": "0f2fabf74c5451cf71dce7cf43987477",
"message":"error",
"errors":["can't verify domain gonnacrushya.com"]
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Delete application.
All past test data will also be deleted and will not be able to be recovered.
DELETE /apps/{app_id}
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
--
Test Resources
--
List of load tests
GET /tests
> loaderio-Auth: {api_key}
> Content-Type: application/json
< 200
< Content-Type: application/json
[
{
"name":"",
"duration":60,
"timeout":10000,
"notes":"",
"initial":0,
"total":60,
"status":"complete",
"test_id":"9b24d675afb6c09c6813a79c956f0d02",
"test_type":"Non-Cycling",
"callback":"http://loader.io",
"callback_email":"[email protected]",
"scheduled_at": "2013-06-07T19:30:00+03:00",
"urls":
[
{
"url":"http://loader.io/signin",
"raw_post_body":null,
"request_type":"GET",
"payload_file_url":null,
"headers":{ "header": "value", "header2": "value2" },
"request_params":{ "param": "value", "param2": "value2" },
"authentication":{"login": "login", "password": "password", "type": "basic"}
}
]
}
]
Create a new load test
POST /tests
> loaderio-Auth: {api_key}
> Content-type: application/json
{
"initial": 0,
"total": 60,
"duration": 60,
"callback": "http://gonnacrushya.com/loader-callback",
"name": "GonnaCrushYa Home Page",
"timeout": 10000,
"callback_email": "[email protected]",
"test_type": "cycling",
"notes": "Going to kicks the crap out of this server",
"scheduled_at": "2013-5-15 3:30:00",
"urls": [
{
"url": "http://gonnacrushya.com",
"request_type": "GET",
"post_body": "post body params go here",
"payload_file_url": "http://loader.io/payload_file.yml",
"authentication": {"login": "login", "password": "secret", "type": "basic"},
"headers": { "header1": "value1", "header2": "value2" },
"request_params": { "params1": "value1", "params2": "value2" }
}
]
}
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"processing"
"result_id": "35b581b6bf1332c70b0642ee5387b4ee"
}
+++++
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"unverified"
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["can't create test"]
}
Load test status
GET /tests/{test_id}
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"name":"",
"duration":60,
"timeout":10000,
"notes":"",
"initial":0,
"total":60,
"status":"complete",
"test_id":"9b24d675afb6c09c6813a79c956f0d02",
"test_type":"Non-Cycling",
"callback":"http://loader.io",
"callback_email":"[email protected]",
"scheduled_at": "2013-06-07T19:30:00+03:00",
"urls":
[
{
"url":"http://loader.io/signin",
"raw_post_body":null,
"request_type":"GET",
"payload_file_url":null,
"headers":{ "header": "value", "header2": "value2" },
"request_params":{"param": "value", "param2": "value2" },
"authentication":{"login": "login", "password": "password", "type": "basic"}
}
]
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Run load test
PUT /tests/{test_id}/run
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-Type: application/json
{
"message":"success",
"test_id":"0642ee5387b4ee35b581b6bf1332c70b",
"status":"processing"
"result_id": "35b581b6bf1332c70b0642ee5387b4ee"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["Can't run test for unverified application"]
}
Stop load test
PUT /tests/{test_id}/stop
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"message":"success",
"test_id":"1187538bb5d5fd60a1b99a6e67978c15",
"status":"finished",
"result_id":"7c55ad8408f7c4326b7fa0e069b7a011"
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
+++++
< 422
< Content-Type: application/json
{
"message":"error",
"errors":["Can't stop test with finished status"]
}
--
Test results
--
Load test results
GET /tests/{test_id}/results
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
[
{
"result_id": "8fb213af34c1cf7b675dc21e900e533a",
"started_at":"2013-06-10T23:42:01+02:00",
"status":"ready",
"public_results_url":"http://loader.io/results/a72944b62d576f0f68fb30ca41d20b99/summaries/8fb213af34c1cf7b675dc21e900e533a",
"success":77,
"error":0,
"timeout_error":0,
"network_error":0,
"data_sent":28259,
"data_received":8393,
"avg_response_time":1,
"avg_error_rate":0.0
}
]
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
Load test result
GET /tests/{test_id}/results/{result_id}
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"result_id": "8fb213af34c1cf7b675dc21e900e533a",
"started_at":"2013-06-10T23:42:01+02:00",
"status":"ready",
"public_results_url":"http://loader.io/results/a72944b62d576f0f68fb30ca41d20b99/summaries/8fb213af34c1cf7b675dc21e900e533a",
"success":77,
"error":0,
"timeout_error":0,
"network_error":0,
"data_sent":28259,
"data_received":8393,
"avg_response_time":1,
"avg_error_rate":0.0
}
+++++
< 404
< Content-Type: application/json
{
"message":"error",
"errors":["Requested record was not found"]
}
--
Servers
--
Load test server's ip addresses
GET /servers
> loaderio-Auth: {api_key}
> Content-type: application/json
< 200
< Content-type: application/json
{
"ip_addresses": ["127.0.0.1"]
}
|
Delete app
|
[#51901849] Delete app
|
API Blueprint
|
mit
|
sendgridlabs/loaderio-docs,sendgridlabs/loaderio-docs
|
341011146c0a3312fbe538e71133171815cb85ca
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
# SCU Evals
The SCU Evals API powers the SCU Evals front-end by managing all the data and actions.
## Meta [/]
### Get API Status [GET]
+ Response 200 (application/json)
+ Attributes
+ status: ok (string, required)
## Authentication [/auth]
### Authenticate New/Old User [POST]
+ Request (application/json)
+ Attributes
+ id_token (string, required)
+ Response 200 (application/json)
+ Attributes
+ status: ok, new, incomplete (enum[string], required, fixed)
+ jwt (string, required)
+ Response 500 (application/json)
+ Attributes
+ message: `failed to get certificates from Google: <reason>` (string, required)
+ Response 401 (application/json)
+ Attributes
+ message: `token is expired` (string, required)
+ Response 422 (application/json)
+ Attributes
+ message (enum[string], required, fixed-type)
+ `invalid id_token`
+ `invalid id_token: <reason>`
+ `invalid id_token format: <reason>`
+ Response 403 (application/json)
+ Attributes
+ status: non-student (string, required, fixed)
### Validate User [GET /auth/validate]
+ Response 200 (application/json)
+ Attributes
+ jwt (string, required) - New JWT
### Authenticate API Key [POST /auth/api]
+ Request (application/json)
+ Attributes
+ api_key (string, required)
+ Response 200 (application/json)
+ Attributes
+ jwt (string, required)
## Classes [/classes/{quarter_id}/{professor_id}/{course_id}]
### Get Class Details [GET]
+ Parameters
+ quarter_id: 3900 (number) - The ID of the quarter that the class was taught
+ professor_id: 1 (number) - The ID of the professor that taught the class
+ course_id: 1 (number) - The ID of the course that was taught
+ Response 200 (application/json)
+ Attributes
+ course (Course, required)
+ quarter (Quarter, required)
+ professor (Professor, required)
+ user_posted: false (boolean, required)
Whether the current user has posted an
evaluation or not for this combination
+ Response 404 (application/json)
+ Attributes
+ message: class does not exist (string, required, fixed)
## Courses [/courses]
### List All Courses [GET /courses{?quarter_id,professor_id}]
+ Parameters
+ quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter
+ professor_id (optional, number) - Limit the list to courses that were taught by the specified professor
+ Response 200 (application/json)
+ Attributes (array[Course], fixed-type)
### Post Courses [POST]
+ Request (application/json)
+ Attributes
+ courses (array, fixed-type)
+ (object, required)
+ term: 3900 (string, required)
+ subject: ANTH (string, required)
+ catalog_nbr: 1 (number, required)
+ class_descr: Intro to Bio Anth (string, required)
+ instr_1: Doe, John (string, required)
+ instr_2 (string, required)
+ instr_3 (string, required)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, fixed)
+ updated_count: 248 (number, required)
+ Response 422 (application/json)
+ Attributes
+ message (enum[string], required, fixed)
+ Members
+ `The request was well-formed but was unable to be followed due to semantic errors.`
+ missing department to COEN
### Get Course Details [GET /courses/{id}{?embed}]
+ Parameters
+ id: 1 (number) - The course for which to get details
+ embed (enum[string], optional)
Which other data to embed.
Specifying `professors` gives you a list of professors that has taught the course.
+ Members
+ `professors`
+ Response 200 (application/json)
Example response with the professors embedded.
+ Attributes (Course, required)
+ evaluations (array, required, fixed-type)
+ (Evaluation, required)
+ user_vote: true (boolean, required)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ author (required)
+ self: false (boolean, required)
+ majors: 1, 3 (array[number], required)
+ graduation_year: 2020 (number, required)
+ professors (array[Professor], optional)
+ Response 404 (application/json)
+ Attributes
+ message: course with the specified id not found (string, required, fixed)
## Departments [/departments]
### List All Departments [GET]
+ Response 200 (application/json)
+ Attributes (array[Department], required, fixed-type)
### Post Departments [POST]
+ Request (application/json)
+ Attributes
+ departments (array, required, fixed-type)
+ (object)
+ value: ACTG (string, required)
+ label: `Accounting (ACTG)` (string, required)
+ school: BUS (string, required)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ updated_count: 74 (number, required)
+ Response 422 (application/json)
+ Attributes
+ message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed)
## Evaluations [/evaluations]
### List All Your Own Evaluations [GET]
+ Response 200 (application/json)
+ Attributes (array, required, fixed-type)
+ (Evaluation)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ course (Course, required)
### List Recent Evaluations [GET /evaluations/recent{?count}]
+ Parameters
+ count (number, optional) - How many recent evaluations to return.
+ Default: 10
+ Response 200 (application/json)
+ Attributes (array, required)
+ (Evaluation, required)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ course (Course, required)
### Get Evaluation Details [GET /evaluations/{id}]
+ Parameters
+ id: 1 (number, required)
+ Response 200 (application/json)
+ Attributes (Evaluation, required)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
### Submit Evaluation [POST]
+ Request (application/json)
+ Attributes
+ quarter_id: 3900 (number, required)
+ professor_id: 1 (number, required)
+ course_id: 1 (number, required)
+ display_grad_year: false (boolean, required)
+ display_majors: true (boolean, required)
+ evaluation (EvaluationDataV1, required)
+ Response 201 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `invalid quarter/course/professor combination` (string, required, fixed)
+ Response 409
+ Attributes
+ message: `evaluation for this combination already exists` (string, required, fixed)
### Delete Evaluation [DELETE /evaluations/{id}]
+ Parameters
+ id: 1 (number, required)
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
+ Response 403 (application/json)
+ Attributes
+ message: `you are only allowed to delete your own evaluations` (string, required, fixed)
## Evaluation Votes [/evaluations/{id}/vote]
+ Parameters
+ id: 1 (number, required)
### Add/Overwrite Vote [PUT]
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
+ Response 403 (application/json)
+ Attributes
+ message: `not allowed to vote on your own evaluations` (string, required, fixed)
### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}]
+ Parameters
+ eval_id: 1 (number, required)
+ vote_id: 1 (number, required)
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message (enum[string], required, fixed)
+ `evaluation with the specified id not found`
+ `vote not found`
## Majors [/majors]
### List All Majors [GET]
+ Response 200 (application/json)
+ Attributes (array[Major], required, fixed-type)
### Post Majors [POST]
+ Request (application/json)
+ Attributes
+ majors (array[string], required, fixed-type)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `failed to insert majors: <db error>` (string, required)
## Professors [/professors]
### List All Professors [GET /professors{?course_id,quarter_id}]
+ Parameters
+ course_id: 1 (number, optional) - Limit the list to professors that taught the specified course.
+ quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter.
+ Response 200 (application/json)
+ Attributes (array[Professor], required, fixed-type)
### Get Professor Details [GET /professors/{id}{?embed}]
+ Parameters
+ id: 1 (number) - The professor for which to get details.
+ embed (enum[string], optional)
Which other data to embed.
Specifying `courses` gives you a list of courses that this professor has taught.
+ Members
+ `courses`
+ Response 200 (application/json)
Example response with the courses embedded.
+ Attributes (Professor, required)
+ evaluations (array, required, fixed-type)
+ (Evaluation, required)
+ user_vote: true (boolean, required)
+ quarter_id: 3900 (number, required)
+ course (Course, required)
+ author (required)
+ self: false (boolean, required)
+ majors: 1, 3 (array[number], required)
+ graduation_year: 2020 (number, required)
+ courses (array[Course], optional)
+ Response 404 (application/json)
+ Attributes
+ message: professor with the specified id not found (string, required, fixed)
## Quarters [/quarters{?course_id,professor_id}]
### List All Quarters [GET]
+ Parameters
+ course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught.
+ professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught.
+ Response 200 (application/json)
+ Attributes (array[Quarter], required, fixed-type)
## Search [/search{?q,limit}]
+ Parameters
+ q: Mat (string, required) - The search query.
+ limit (number, optional) - Limit the number of results. Max is 50.
+ Default: 50
### Search For Classes And Professors [GET]
+ Response 200 (application/json)
+ Attributes
+ courses (array[Course], required, fixed-type)
+ professors (array[Professor], required, fixed-type)
## Students [/students/{id}]
+ Parameters
+ id: 1 (number, required)
### Update Info [PUT]
+ Request (application/json)
+ Attributes
+ graduation_year: 2020 (number, required)
+ gender: m, f, o (enum[string], required, fixed)
+ majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs.
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ jwt (string, required)
+ Response 403 (application/json)
+ Attributes
+ message: `you do not have the rights to modify another student` (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `invalid major(s) specified` (string, required, fixed)
# Data Structures
## Course (object)
+ id: 1 (number, required)
+ number: 42 (number, required)
+ title: What is Life (string, required)
+ department_id: 3 (number, required)
## Department (object)
+ id: 1 (number, required)
+ abbr: COEN (string, required)
+ name: Computer Science & Engineering (string, required)
+ school: EGR (string, required)
## Evaluation (object)
+ id: 1 (number, required)
+ version: 1 (number, required)
+ post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601
+ data (EvaluationDataV1, required)
+ votes_score: `-3` (number, required)
## EvaluationDataV1 (object)
+ attitude: 1 (number, required)
+ availability: 1 (number, required)
+ clarity: 1 (number, required)
+ grading_speed: 1 (number, required)
+ resourcefulness: 1 (number, required)
+ easiness: 1 (number, required)
+ workload: 1 (number, required)
+ recommended: 1 (number, required)
+ comment: Love the lectures (string, required)
## Major (object)
+ id: 1 (number, required)
+ name: Mathematics (string, required)
## Professor (object)
+ id: 1 (number, required)
+ first_name: John (string, required)
+ last_name: Doe (string, required)
## Quarter (object)
+ id: 1 (number, required)
+ year: 2018 (number, required)
+ name: Spring (string, required)
+ current: true (boolean, required)
## Student (User)
+ gender: m, f, o (enum[string], required)
+ graduation_year: 2020 (number, required)
+ majors (array[number], required) - An array of majors ids
## User (object)
+ id: 1 (number, required)
+ university_id: 1 (number, required)
+ email: [email protected] (string, required)
+ first_name: John (string, required)
+ last_name: Doe (string, required)
+ picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture
+ roles (array[number], required) - An array of roles ids
|
FORMAT: 1A
# SCU Evals
The SCU Evals API powers the SCU Evals front-end by managing all the data and actions.
## Meta [/]
### Get API Status [GET]
+ Response 200 (application/json)
+ Attributes
+ status: ok (string, required)
## Authentication [/auth]
### Authenticate New/Old User [POST]
+ Request (application/json)
+ Attributes
+ id_token (string, required)
+ Response 200 (application/json)
+ Attributes
+ status: ok, new, incomplete (enum[string], required, fixed)
+ jwt (string, required)
+ Response 500 (application/json)
+ Attributes
+ message: `failed to get certificates from Google: <reason>` (string, required)
+ Response 401 (application/json)
+ Attributes
+ status: `suspended` (string, required, fixed)
+ until: `2018-03-07T12:14:04.531000+00:00` (string, required) - ISO 8601
+ Response 422 (application/json)
+ Attributes
+ message (enum[string], required, fixed-type)
+ `invalid id_token: <reason>`
+ Response 403 (application/json)
+ Attributes
+ status: non-student (string, required, fixed)
### Validate User [GET /auth/validate]
+ Response 200 (application/json)
+ Attributes
+ jwt (string, required) - New JWT
### Authenticate API Key [POST /auth/api]
+ Request (application/json)
+ Attributes
+ api_key (string, required)
+ Response 200 (application/json)
+ Attributes
+ jwt (string, required)
## Classes [/classes/{quarter_id}/{professor_id}/{course_id}]
### Get Class Details [GET]
+ Parameters
+ quarter_id: 3900 (number) - The ID of the quarter that the class was taught
+ professor_id: 1 (number) - The ID of the professor that taught the class
+ course_id: 1 (number) - The ID of the course that was taught
+ Response 200 (application/json)
+ Attributes
+ course (Course, required)
+ quarter (Quarter, required)
+ professor (Professor, required)
+ user_posted: false (boolean, required)
Whether the current user has posted an
evaluation or not for this combination
+ Response 404 (application/json)
+ Attributes
+ message: class does not exist (string, required, fixed)
## Courses [/courses]
### List All Courses [GET /courses{?quarter_id,professor_id}]
+ Parameters
+ quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter
+ professor_id (optional, number) - Limit the list to courses that were taught by the specified professor
+ Response 200 (application/json)
+ Attributes (array[Course], fixed-type)
### Post Courses [POST]
+ Request (application/json)
+ Attributes
+ courses (array, fixed-type)
+ (object, required)
+ term: 3900 (string, required)
+ subject: ANTH (string, required)
+ catalog_nbr: 1 (number, required)
+ class_descr: Intro to Bio Anth (string, required)
+ instr_1: Doe, John (string, required)
+ instr_2 (string, required)
+ instr_3 (string, required)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, fixed)
+ updated_count: 248 (number, required)
+ Response 422 (application/json)
+ Attributes
+ message (enum[string], required, fixed)
+ Members
+ `The request was well-formed but was unable to be followed due to semantic errors.`
+ missing department to COEN
### Get Course Details [GET /courses/{id}{?embed}]
+ Parameters
+ id: 1 (number) - The course for which to get details
+ embed (enum[string], optional)
Which other data to embed.
Specifying `professors` gives you a list of professors that has taught the course.
+ Members
+ `professors`
+ Response 200 (application/json)
Example response with the professors embedded.
+ Attributes (Course, required)
+ evaluations (array, required, fixed-type)
+ (Evaluation, required)
+ user_vote: true (boolean, required)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ author (required)
+ self: false (boolean, required)
+ majors: 1, 3 (array[number], required)
+ graduation_year: 2020 (number, required)
+ professors (array[Professor], optional)
+ Response 404 (application/json)
+ Attributes
+ message: course with the specified id not found (string, required, fixed)
## Departments [/departments]
### List All Departments [GET]
+ Response 200 (application/json)
+ Attributes (array[Department], required, fixed-type)
### Post Departments [POST]
+ Request (application/json)
+ Attributes
+ departments (array, required, fixed-type)
+ (object)
+ value: ACTG (string, required)
+ label: `Accounting (ACTG)` (string, required)
+ school: BUS (string, required)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ updated_count: 74 (number, required)
+ Response 422 (application/json)
+ Attributes
+ message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed)
## Evaluations [/evaluations]
### List All Your Own Evaluations [GET]
+ Response 200 (application/json)
+ Attributes (array, required, fixed-type)
+ (Evaluation)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ course (Course, required)
### List Recent Evaluations [GET /evaluations/recent{?count}]
+ Parameters
+ count (number, optional) - How many recent evaluations to return.
+ Default: 10
+ Response 200 (application/json)
+ Attributes (array, required)
+ (Evaluation, required)
+ quarter_id: 3900 (number, required)
+ professor (Professor, required)
+ course (Course, required)
### Get Evaluation Details [GET /evaluations/{id}]
+ Parameters
+ id: 1 (number, required)
+ Response 200 (application/json)
+ Attributes (Evaluation, required)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
### Submit Evaluation [POST]
+ Request (application/json)
+ Attributes
+ quarter_id: 3900 (number, required)
+ professor_id: 1 (number, required)
+ course_id: 1 (number, required)
+ display_grad_year: false (boolean, required)
+ display_majors: true (boolean, required)
+ evaluation (EvaluationDataV1, required)
+ Response 201 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `invalid quarter/course/professor combination` (string, required, fixed)
+ Response 409
+ Attributes
+ message: `evaluation for this combination already exists` (string, required, fixed)
### Delete Evaluation [DELETE /evaluations/{id}]
+ Parameters
+ id: 1 (number, required)
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
+ Response 403 (application/json)
+ Attributes
+ message: `you are only allowed to delete your own evaluations` (string, required, fixed)
## Evaluation Votes [/evaluations/{id}/vote]
+ Parameters
+ id: 1 (number, required)
### Add/Overwrite Vote [PUT]
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message: `evaluation with the specified id not found` (string, required, fixed)
+ Response 403 (application/json)
+ Attributes
+ message: `not allowed to vote on your own evaluations` (string, required, fixed)
### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}]
+ Parameters
+ eval_id: 1 (number, required)
+ vote_id: 1 (number, required)
+ Response 204 (application/json)
+ Response 404 (application/json)
+ Attributes
+ message (enum[string], required, fixed)
+ `evaluation with the specified id not found`
+ `vote not found`
## Majors [/majors]
### List All Majors [GET]
+ Response 200 (application/json)
+ Attributes (array[Major], required, fixed-type)
### Post Majors [POST]
+ Request (application/json)
+ Attributes
+ majors (array[string], required, fixed-type)
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `failed to insert majors: <db error>` (string, required)
## Professors [/professors]
### List All Professors [GET /professors{?course_id,quarter_id}]
+ Parameters
+ course_id: 1 (number, optional) - Limit the list to professors that taught the specified course.
+ quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter.
+ Response 200 (application/json)
+ Attributes (array[Professor], required, fixed-type)
### Get Professor Details [GET /professors/{id}{?embed}]
+ Parameters
+ id: 1 (number) - The professor for which to get details.
+ embed (enum[string], optional)
Which other data to embed.
Specifying `courses` gives you a list of courses that this professor has taught.
+ Members
+ `courses`
+ Response 200 (application/json)
Example response with the courses embedded.
+ Attributes (Professor, required)
+ evaluations (array, required, fixed-type)
+ (Evaluation, required)
+ user_vote: true (boolean, required)
+ quarter_id: 3900 (number, required)
+ course (Course, required)
+ author (required)
+ self: false (boolean, required)
+ majors: 1, 3 (array[number], required)
+ graduation_year: 2020 (number, required)
+ courses (array[Course], optional)
+ Response 404 (application/json)
+ Attributes
+ message: professor with the specified id not found (string, required, fixed)
## Quarters [/quarters{?course_id,professor_id}]
### List All Quarters [GET]
+ Parameters
+ course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught.
+ professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught.
+ Response 200 (application/json)
+ Attributes (array[Quarter], required, fixed-type)
## Search [/search{?q,limit}]
+ Parameters
+ q: Mat (string, required) - The search query.
+ limit (number, optional) - Limit the number of results. Max is 50.
+ Default: 50
### Search For Classes And Professors [GET]
+ Response 200 (application/json)
+ Attributes
+ courses (array[Course], required, fixed-type)
+ professors (array[Professor], required, fixed-type)
## Students [/students/{id}]
+ Parameters
+ id: 1 (number, required)
### Update Info [PUT]
+ Request (application/json)
+ Attributes
+ graduation_year: 2020 (number, required)
+ gender: m, f, o (enum[string], required, fixed)
+ majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs.
+ Response 200 (application/json)
+ Attributes
+ result: success (string, required, fixed)
+ jwt (string, required)
+ Response 403 (application/json)
+ Attributes
+ message: `you do not have the rights to modify another student` (string, required, fixed)
+ Response 422 (application/json)
+ Attributes
+ message: `invalid major(s) specified` (string, required, fixed)
# Data Structures
## Course (object)
+ id: 1 (number, required)
+ number: 42 (number, required)
+ title: What is Life (string, required)
+ department_id: 3 (number, required)
## Department (object)
+ id: 1 (number, required)
+ abbr: COEN (string, required)
+ name: Computer Science & Engineering (string, required)
+ school: EGR (string, required)
## Evaluation (object)
+ id: 1 (number, required)
+ version: 1 (number, required)
+ post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601
+ data (EvaluationDataV1, required)
+ votes_score: `-3` (number, required)
## EvaluationDataV1 (object)
+ attitude: 1 (number, required)
+ availability: 1 (number, required)
+ clarity: 1 (number, required)
+ grading_speed: 1 (number, required)
+ resourcefulness: 1 (number, required)
+ easiness: 1 (number, required)
+ workload: 1 (number, required)
+ recommended: 1 (number, required)
+ comment: Love the lectures (string, required)
## Major (object)
+ id: 1 (number, required)
+ name: Mathematics (string, required)
## Professor (object)
+ id: 1 (number, required)
+ first_name: John (string, required)
+ last_name: Doe (string, required)
## Quarter (object)
+ id: 1 (number, required)
+ year: 2018 (number, required)
+ name: Spring (string, required)
+ current: true (boolean, required)
## Student (User)
+ gender: m, f, o (enum[string], required)
+ graduation_year: 2020 (number, required)
+ majors (array[number], required) - An array of majors ids
## User (object)
+ id: 1 (number, required)
+ university_id: 1 (number, required)
+ email: [email protected] (string, required)
+ first_name: John (string, required)
+ last_name: Doe (string, required)
+ picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture
+ roles (array[number], required) - An array of roles ids
|
Add suspended response
|
Add suspended response
|
API Blueprint
|
agpl-3.0
|
SCUEvals/scuevals-api,SCUEvals/scuevals-api
|
5282d8d0a080e11d2dfb8940d4805e9044907dac
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# OncoKB
OncoKB is the knowledgebase for cancer gemomic stuies. This is the
description for rendering the document for available API.
# API Root [/]
This resource does not have any attributes. Instead it offers the initial
API affordances in the form of the links in the JSON body.
It is recommend to follow the “url” link values,
[Link](https://tools.ietf.org/html/rfc5988) or Location headers where
applicable to retrieve resources. Instead of constructing your own URLs,
to keep your client decoupled from implementation details.
## Test the availablity of OncoKB [/access]
### Access OncoKB [GET]
+ Response 200 (application/text)
Current date
## Group Gene
### All genes inforamtion [/gene.json]
#### GET [GET]
+ Response 200 (application/json)
[
{
"name": "breast cancer 1, early onset",
"status": "Complete",
"geneLabels": [],
"entrezGeneId": 672,
"geneAliases": [
"RNF53",
"IRIS",
"BRCAI",
"PNCA4",
"PSCP",
"BROVCA1",
"BRCC1",
"FANCS",
"PPP1R53"
],
"summary": "test",
"hugoSymbol": "BRCA1"
},
{
"name": "B-Raf proto-oncogene, serine/threonine kinase",
"status": "Proceed with caution",
"geneLabels": [],
"entrezGeneId": 673,
"geneAliases": [
"NS7",
"BRAF1",
"RAFB1",
"B-RAF1"
],
"summary": "test",
"hugoSymbol": "BRAF"
}
]
### Specific gene inforamtion [/gene.json?{&hugoSymbol,entrezGeneId}]
+ Parameters
+ entrezGeneId (number, optional)
+ hugoSymbol (string, optional)
#### GET [GET]
+ Response 200 (application/json)
{
"name": "B-Raf proto-oncogene, serine/threonine kinase",
"status": "Proceed with caution",
"geneLabels": [],
"entrezGeneId": 673,
"geneAliases": [
"NS7",
"BRAF1",
"RAFB1",
"B-RAF1"
],
"summary": "test",
"hugoSymbol": "BRAF"
}
### Set gene status [/geneStatus.json?{&geneId,status}]
Each gene has a status associate with it. This API is used to update the gene status
#### UPDATE [UPDATE]
+ Parameters
+ geneId: BRAF (string)
+ status: Complete (string)
+ Members
+ Complete
+ Proceed with caution
+ Not ready
+ Not applicable
## Group Alteration
### All Alteration inforamtion [/alteration.json]
#### GET [GET]
+ Response 200 (application/json)
[
{
"name": "E17K",
"alteration": "E17K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "test",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 1,
"proteinStart": 17,
"proteinEnd": 17,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "E"
},
{
"name": "Q79K",
"alteration": "Q79K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "test",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 2,
"proteinStart": 79,
"proteinEnd": 79,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "Q"
}
]
### Specific alteration inforamtion [/alteration.json?{&hugoSymbol,entrezGeneId}]
+ Parameters
+ entrezGeneId (number, optional)
+ hugoSymbol (string, optional)
#### GET [GET]
+ Response 200 (application/json)
{
"name": "E17K",
"alteration": "E17K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "The serine-threonine protein kinase encoded by the AKT1 gene is catalytically inactive in serum-starved primary and immortalized fibroblasts. AKT1 and the related AKT2 are activated by platelet-derived growth factor. The activation is rapid and specific, and it is abrogated by mutations in the pleckstrin homology domain of AKT1. It was shown that the activation occurs through phosphatidylinositol 3-kinase. In the developing nervous system AKT is a critical mediator of growth factor-induced neuronal survival. Survival factors can suppress apoptosis in a transcription-independent manner by activating the serine/threonine kinase AKT1, which then phosphorylates and inactivates components of the apoptotic machinery. Mutations in this gene have been associated with the Proteus syndrome. Multiple alternatively spliced transcript variants have been found for this gene. [provided by RefSeq, Jul 2011].",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 1,
"proteinStart": 17,
"proteinEnd": 17,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "E"
}
## Group Tumor Type
### All Alteration inforamtion [/tumorType.json]
Return all tumor types
#### GET [GET]
+ Response 200 (application/json)
[
{
"name":"***",
"tissue":null,
"clinicalTrialKeywords":[
"***"
],
"tumorTypeId":"***",
"shortName":null
}
]
### Specific tumor type inforamtion [/alteration.json?{&tumorTypeId}]
+ Parameters
+ tumorTypeId (list, optional)
#### GET [GET]
+ Response 200 (application/json)
[
{
"name":"***",
"tissue":null,
"clinicalTrialKeywords":[
"***"
],
"tumorTypeId":"***",
"shortName":null
}
]
## Group Evidence
### All evidence inforamtion [/evidence.json]
#### GET [GET]
+ Response 200 (application/json)
[{"tumorType":{"tissue":"melanoma","tumorTypeId":"SKCM","shortName":null,"clinicalTrialKeywords":["melanoma","solid tumor","skin"],"name":"melanoma"},"clinicalTrials":[],"gene":{"entrezGeneId":673,"summary":"Summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"evidenceType":"INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY","evidenceId":4685,"knownEffect":"Sensitive","nccnGuidelines":[],"levelOfEvidence":"LEVEL_4","treatments":[{"drugs":[{"synonyms":["Buparsilib"],"drugId":8360,"fdaApproved":null,"atcCodes":[],"drugName":"BKM120","description":null},{"synonyms":[],"drugId":8242,"fdaApproved":null,"atcCodes":[],"drugName":"MEK162","description":null},{"synonyms":[],"drugId":8635,"fdaApproved":null,"atcCodes":[],"drugName":"LGX818","description":null}],"treatmentId":1701,"approvedIndications":[]},{"drugs":[{"synonyms":["Buparsilib"],"drugId":8360,"fdaApproved":null,"atcCodes":[],"drugName":"BKM120","description":null},{"synonyms":["RG7204","Vemurafenib","PLX4032","Zelboraf","RO5185426","BRAF(V600E) Kinase Inhibitor RO5185426"],"drugId":6519,"fdaApproved":true,"atcCodes":["L01XE15"],"drugName":"Vemurafenib","description":"Description"}],"treatmentId":1702,"approvedIndications":[]}],"articles":[{"title":"B-Raf and the inhibitors: from bench to bedside.","pmid":"23617957","articleId":1148,"pages":"30","authors":"Huang T et al","journal":"Journal of hematology & oncology","pubDate":"2013 Apr 25","volume":"6","issue":"","elocationId":"doi: 10.1186/1756-8722-6-30","reference":"Huang T et al. Journal of hematology & oncology. 2013 Apr 25;6()30."}],"description":"Desription","alterations":[{"alterationId":645,"alteration":"V600E","gene":{"entrezGeneId":673,"summary":"Gene summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"alterationType":"MUTATION","consequence":{"term":"missense_variant","isGenerallyTruncating":false,"description":"Descriptiion"},"refResidues":"V","proteinStart":600,"proteinEnd":600,"variantResidues":"E","name":"V600E","oncogenic":1},{"alterationId":646,"alteration":"V600K","gene":{"entrezGeneId":673,"summary":"gene summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"alterationType":"MUTATION","consequence":{"term":"missense_variant","isGenerallyTruncating":false,"description":"Descriptiion"},"refResidues":"V","proteinStart":600,"proteinEnd":600,"variantResidues":"K","name":"V600K","oncogenic":1}]}]
### Specific evidence inforamtion [/evidence.json?{&entrezGeneId,hugoSymbol,alteration,tumorType,consequence,evidenceType,geneStatus,source}]
Gene + Alteration + tumorType + consequence = Variant pair
The query can has multiple genes, alterations and consequences but can only has one tumor type.
#### GET [GET]
+ Response 200 (application/json)
+ Parameters
+ entrezGeneId: 673 (string, optional)
Gene ID.
+ hugoSymbol: BRAF (string, optional)
Gene hugo symbol. Multiple genese are separated by comma.
+ alteration: V600E (string, optional)
Mutation name. Multiple mutations are separated by comma.
+ tumorType: Melanoma (string, optional)
+ consequence: In_frame_deletion (string, optional)
Multiple consequences are separated by comma. For each variant pair, it could has multiple consequences, separated by plus.
+ evidenceType: GENE_SUMMARY (string, optional)
Evidence types.
+ Members
+ GENE_SUMMARY
+ GENE_BACKGROUND
+ MUTATION_SUMMARY
+ TUMOR_TYPE_SUMMARY
+ MUTATION_EFFECT
+ PREVALENCE
+ PROGNOSTIC_IMPLICATION
+ NCCN_GUIDELINES
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_SENSITIVITY
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_RESISTANCE
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_RESISTANCE
+ CLINICAL_TRIAL
+ geneStatus: Complete (string, optional)
Only get genes under specific status.
+ source (string, optional)
Tumor type mapping set name
+ Members
+ oncokb - This the mapping file we used to map OncoKB tumor type to Quest tumor type
+ cbioportal - This the mapping file we used to map OncoKB tumor type to cBioPortal tumor type
## Group Summary
### Three sentences summary [/summary.json?{&type,hugoSymbol,alteration,tumorType,consequence,source}]
#### GET [GET]
+ Response 200 (application/json)
+ Parameters
+ hugoSymbol: BRAF (string, optional)
Gene hugo symbol.
+ type (string, optional)
Define the type of summary, currently suport three line auto-generate summary
+ Default: variant
+ alteration: V600E (string, optional)
Mutation name
+ tumorType: Melanoma (string, optional)
+ consequence: In_frame_deletion (string, optional)
+ source (string, optional)
Tumor type mapping set name
+ Members
+ oncokb - This the mapping file we used to map OncoKB tumor type to Quest tumor type
+ cbioportal - This the mapping file we used to map OncoKB tumor type to cBioPortal tumor type
#### POST [POST]
+ Response 200 (application/json)
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# OncoKB
OncoKB is the knowledgebase for cancer gemomic stuies. This is the
description for rendering the document for available API.
# API Root [/]
This resource does not have any attributes. Instead it offers the initial
API affordances in the form of the links in the JSON body.
It is recommend to follow the “url” link values,
[Link](https://tools.ietf.org/html/rfc5988) or Location headers where
applicable to retrieve resources. Instead of constructing your own URLs,
to keep your client decoupled from implementation details.
## Test the availablity of OncoKB [/access]
### Access OncoKB [GET]
+ Response 200 (application/text)
Current date
## Group Gene
### All genes inforamtion [/gene.json]
#### GET [GET]
+ Response 200 (application/json)
[
{
"name": "breast cancer 1, early onset",
"status": "Complete",
"geneLabels": [],
"entrezGeneId": 672,
"geneAliases": [
"RNF53",
"IRIS",
"BRCAI",
"PNCA4",
"PSCP",
"BROVCA1",
"BRCC1",
"FANCS",
"PPP1R53"
],
"summary": "test",
"hugoSymbol": "BRCA1"
},
{
"name": "B-Raf proto-oncogene, serine/threonine kinase",
"status": "Proceed with caution",
"geneLabels": [],
"entrezGeneId": 673,
"geneAliases": [
"NS7",
"BRAF1",
"RAFB1",
"B-RAF1"
],
"summary": "test",
"hugoSymbol": "BRAF"
}
]
### Specific gene inforamtion [/gene.json?{&hugoSymbol,entrezGeneId}]
+ Parameters
+ entrezGeneId (number, optional)
+ hugoSymbol (string, optional)
#### GET [GET]
+ Response 200 (application/json)
{
"name": "B-Raf proto-oncogene, serine/threonine kinase",
"status": "Proceed with caution",
"geneLabels": [],
"entrezGeneId": 673,
"geneAliases": [
"NS7",
"BRAF1",
"RAFB1",
"B-RAF1"
],
"summary": "test",
"hugoSymbol": "BRAF"
}
### Set gene status [/geneStatus.json?{&geneId,status}]
Each gene has a status associate with it. This API is used to update the gene status
#### UPDATE [UPDATE]
+ Parameters
+ geneId: BRAF (string)
+ status: Complete (string)
+ Members
+ Complete
+ Proceed with caution
+ Not ready
+ Not applicable
## Group Alteration
### All Alteration inforamtion [/alteration.json]
#### GET [GET]
+ Response 200 (application/json)
[
{
"name": "E17K",
"alteration": "E17K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "test",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 1,
"proteinStart": 17,
"proteinEnd": 17,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "E"
},
{
"name": "Q79K",
"alteration": "Q79K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "test",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 2,
"proteinStart": 79,
"proteinEnd": 79,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "Q"
}
]
### Specific alteration inforamtion [/alteration.json?{&hugoSymbol,entrezGeneId}]
+ Parameters
+ entrezGeneId (number, optional)
+ hugoSymbol (string, optional)
#### GET [GET]
+ Response 200 (application/json)
{
"name": "E17K",
"alteration": "E17K",
"gene": {
"name": "v-akt murine thymoma viral oncogene homolog 1",
"entrezGeneId": 207,
"hugoSymbol": "AKT1",
"summary": "The serine-threonine protein kinase encoded by the AKT1 gene is catalytically inactive in serum-starved primary and immortalized fibroblasts. AKT1 and the related AKT2 are activated by platelet-derived growth factor. The activation is rapid and specific, and it is abrogated by mutations in the pleckstrin homology domain of AKT1. It was shown that the activation occurs through phosphatidylinositol 3-kinase. In the developing nervous system AKT is a critical mediator of growth factor-induced neuronal survival. Survival factors can suppress apoptosis in a transcription-independent manner by activating the serine/threonine kinase AKT1, which then phosphorylates and inactivates components of the apoptotic machinery. Mutations in this gene have been associated with the Proteus syndrome. Multiple alternatively spliced transcript variants have been found for this gene. [provided by RefSeq, Jul 2011].",
"geneLabels": [],
"geneAliases": [
"PRKBA",
"RAC",
"PKB",
"CWS6",
"AKT",
"RAC-ALPHA",
"PKB-ALPHA"
]
},
"oncogenic": true,
"alterationId": 1,
"proteinStart": 17,
"proteinEnd": 17,
"variantResidues": "K",
"alterationType": "MUTATION",
"consequence": {
"description": "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
"term": "missense_variant",
"isGenerallyTruncating": false
},
"refResidues": "E"
}
## Group Tumor Type
### All Alteration inforamtion [/tumorType.json]
Return all tumor types
#### GET [GET]
+ Response 200 (application/json)
[
{
"name":"***",
"tissue":null,
"clinicalTrialKeywords":[
"***"
],
"tumorTypeId":"***",
"shortName":null
}
]
### Specific tumor type inforamtion [/alteration.json?{&tumorTypeId}]
+ Parameters
+ tumorTypeId (list, optional)
#### GET [GET]
+ Response 200 (application/json)
[
{
"name":"***",
"tissue":null,
"clinicalTrialKeywords":[
"***"
],
"tumorTypeId":"***",
"shortName":null
}
]
## Group Evidence
### All evidence inforamtion [/evidence.json]
#### GET [GET]
+ Response 200 (application/json)
[{"tumorType":{"tissue":"melanoma","tumorTypeId":"SKCM","shortName":null,"clinicalTrialKeywords":["melanoma","solid tumor","skin"],"name":"melanoma"},"clinicalTrials":[],"gene":{"entrezGeneId":673,"summary":"Summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"evidenceType":"INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY","evidenceId":4685,"knownEffect":"Sensitive","nccnGuidelines":[],"levelOfEvidence":"LEVEL_4","treatments":[{"drugs":[{"synonyms":["Buparsilib"],"drugId":8360,"fdaApproved":null,"atcCodes":[],"drugName":"BKM120","description":null},{"synonyms":[],"drugId":8242,"fdaApproved":null,"atcCodes":[],"drugName":"MEK162","description":null},{"synonyms":[],"drugId":8635,"fdaApproved":null,"atcCodes":[],"drugName":"LGX818","description":null}],"treatmentId":1701,"approvedIndications":[]},{"drugs":[{"synonyms":["Buparsilib"],"drugId":8360,"fdaApproved":null,"atcCodes":[],"drugName":"BKM120","description":null},{"synonyms":["RG7204","Vemurafenib","PLX4032","Zelboraf","RO5185426","BRAF(V600E) Kinase Inhibitor RO5185426"],"drugId":6519,"fdaApproved":true,"atcCodes":["L01XE15"],"drugName":"Vemurafenib","description":"Description"}],"treatmentId":1702,"approvedIndications":[]}],"articles":[{"title":"B-Raf and the inhibitors: from bench to bedside.","pmid":"23617957","articleId":1148,"pages":"30","authors":"Huang T et al","journal":"Journal of hematology & oncology","pubDate":"2013 Apr 25","volume":"6","issue":"","elocationId":"doi: 10.1186/1756-8722-6-30","reference":"Huang T et al. Journal of hematology & oncology. 2013 Apr 25;6()30."}],"description":"Desription","alterations":[{"alterationId":645,"alteration":"V600E","gene":{"entrezGeneId":673,"summary":"Gene summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"alterationType":"MUTATION","consequence":{"term":"missense_variant","isGenerallyTruncating":false,"description":"Descriptiion"},"refResidues":"V","proteinStart":600,"proteinEnd":600,"variantResidues":"E","name":"V600E","oncogenic":1},{"alterationId":646,"alteration":"V600K","gene":{"entrezGeneId":673,"summary":"gene summary","geneLabels":[],"geneAliases":["B-RAF1","BRAF1","RAFB1","NS7"],"name":"B-Raf proto-oncogene, serine/threonine kinase","hugoSymbol":"BRAF","status":""},"alterationType":"MUTATION","consequence":{"term":"missense_variant","isGenerallyTruncating":false,"description":"Descriptiion"},"refResidues":"V","proteinStart":600,"proteinEnd":600,"variantResidues":"K","name":"V600K","oncogenic":1}]}]
### Specific evidence inforamtion [/evidence.json?{&query,entrezGeneId,hugoSymbol,alteration,tumorType,consequence,evidenceType,geneStatus,source}]
Gene + Alteration + tumorType + consequence = Variant pair
The query can has multiple genes, alterations and consequences but can only has one tumor type.
#### GET [GET]
+ Response 200 (application/json)
+ Parameters
+ entrezGeneId: 673 (string, optional)
Gene ID.
+ hugoSymbol: BRAF (string, optional)
Gene hugo symbol. Multiple genese are separated by comma.
+ alteration: V600E (string, optional)
Mutation name. Multiple mutations are separated by comma.
+ tumorType: Melanoma (string, optional)
+ consequence: In_frame_deletion (string, optional)
Multiple consequences are separated by comma. For each variant pair, it could has multiple consequences, separated by plus.
+ evidenceType: GENE_SUMMARY (string, optional)
Evidence types.
+ Members
+ GENE_SUMMARY
+ GENE_BACKGROUND
+ MUTATION_SUMMARY
+ TUMOR_TYPE_SUMMARY
+ MUTATION_EFFECT
+ PREVALENCE
+ PROGNOSTIC_IMPLICATION
+ NCCN_GUIDELINES
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_SENSITIVITY
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_RESISTANCE
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_RESISTANCE
+ CLINICAL_TRIAL
+ geneStatus: Complete (string, optional)
Only get genes under specific status.
+ source (string, optional)
Tumor type mapping set name
+ Members
+ oncokb - This the mapping file we used to map OncoKB tumor type to Quest tumor type
+ cbioportal - This the mapping file we used to map OncoKB tumor type to cBioPortal tumor type
#### POST [POST]
+ Response 200 (application/json)
+ Parameters
+ query (array)
+ evidenceType: GENE_SUMMARY (string, optional)
Evidence types.
+ Members
+ GENE_SUMMARY
+ GENE_BACKGROUND
+ MUTATION_SUMMARY
+ TUMOR_TYPE_SUMMARY
+ MUTATION_EFFECT
+ PREVALENCE
+ PROGNOSTIC_IMPLICATION
+ NCCN_GUIDELINES
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_SENSITIVITY
+ STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_RESISTANCE
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY
+ INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_RESISTANCE
+ CLINICAL_TRIAL
+ geneStatus: Complete (string, optional)
Only get genes under specific status.
+ source (string, optional)
Tumor type mapping set name
+ Members
+ oncokb - This the mapping file we used to map OncoKB tumor type to Quest tumor type
+ cbioportal - This the mapping file we used to map OncoKB tumor type to cBioPortal tumor type
## Group Summary
### Three sentences summary [/summary.json?{&type,hugoSymbol,alteration,tumorType,consequence,source}]
#### GET [GET]
+ Response 200 (application/json)
+ Parameters
+ hugoSymbol: BRAF (string, optional)
Gene hugo symbol.
+ type (string, optional)
Define the type of summary, currently suport three line auto-generate summary
+ Default: variant
+ alteration: V600E (string, optional)
Mutation name
+ tumorType: Melanoma (string, optional)
+ consequence: In_frame_deletion (string, optional)
+ source (string, optional)
Tumor type mapping set name
+ Members
+ oncokb - This the mapping file we used to map OncoKB tumor type to Quest tumor type
+ cbioportal - This the mapping file we used to map OncoKB tumor type to cBioPortal tumor type
#### POST [POST]
+ Response 200 (application/json)
|
Add evidence post method
|
Add evidence post method
|
API Blueprint
|
agpl-3.0
|
zhx828/oncokb,zhx828/oncokb,jjgao/oncokb,zhx828/oncokb,jjgao/oncokb,oncokb/oncokb,oncokb/oncokb,jjgao/oncokb,jjgao/oncokb,oncokb/oncokb
|
c8dab65bc916259338585c6afc3b19bfe8a5cfa3
|
apiary.apib
|
apiary.apib
|
HOST: https://nmoneys.apphb.com/api/v1
--- nMoneys API v1 ---
---
Welcome to NMoneys' API documentation. Here you will find what you can do with this API
---
--
Currency Resources
The following is a section of resources related to ISO 4217 currencies
--
Provides information about resources available through the API.
OPTIONS /
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
Provides information about current supported currencies.
OPTIONS /currencies
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/v1/api/currencies",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/v1/api/currencies",
"method": "GET"
},
{
"rel": "currency",
"href":"/v1/api/currencies/EUR",
"method": "GET"
},
...
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
List current supported currencies.
GET /currencies
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"snapshots": [
...,
{
"isoCode": "USD",
"numericCode":978,
"englishName": "Euro"
},
...
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
Provides information about a currency.
OPTIONS /currencies/{isoCode}
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/v1/api/currency/EUR",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/v1/api/currency/EUR",
"method": "GET"
},
{
"rel": "parent",
"href":"/v1/api/currencies",
"method": "GET"
},
{
"rel": "format",
"href":"/v1/api/currencies/EUR/format/0",
"method": "GET"
},
{
"rel": "parent",
"href":"/v1/api/currencies/EUR/format",
"method": "POST"
},
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Get detailed information about a currency.
GET /currencies/{isoCode}
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"detail": {
"isoCode":"EUR"
"numericCode":978,
"englishName":"Euro",
"nativeName":"Euro",
"symbol":"€",
"isObsolete":false
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Provides information about formatting a monetary amount according to its currency.
OPTIONS /currencies/{isoCode}/format/{amount}
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1/currencies/EUR/format/123",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format/123",
"method": "GET"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format",
"method": "POST"
},
{
"rel": "parent",
"href":"/api/v1/currencies/EUR",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Allows formatting a monetary amount according to its currency.
GET /currencies/{isoCode}/format/{amount}
> Accept: application/json
> Api-Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"money": {
"amount":123,
"isoCode":"EUR"
"representation":"123,00 €",
"amountRepresentation":"123,00"
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Provides information about formatting a monetary amount according to its currency.
OPTIONS /currencies/{isoCode}/format
> Accept: application/json
> Api-Key: your API key
{ "amount": "123.6" }
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1/currencies/EUR/format/0",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format/0",
"method": "GET"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format",
"method": "POST"
},
{
"rel": "parent",
"href":"/api/v1/currencies/EUR",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Allows formatting a monetary amount according to its currency.
POST /currencies/{isoCode}/format
> Accept: application/json
> Api-Key: your API key
{ "amount": "123.6" }
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"money": {
"amount":123.6,
"isoCode":"EUR",
"representation":"123,60 €",
"amountRepresentation":"123,60"
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
|
HOST: https://nmoneys.apphb.com/api/v1
--- nMoneys API v1 ---
---
Welcome to NMoneys' API documentation. Here you will find what you can do with this API
---
--
Currency Resources
The following is a section of resources related to ISO 4217 currencies
--
Provides information about resources available through the API.
OPTIONS /
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
Provides information about current supported currencies.
OPTIONS /currencies
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/v1/api/currencies",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/v1/api/currencies",
"method": "GET"
},
{
"rel": "currency",
"href":"/v1/api/currencies/EUR",
"method": "GET"
},
...
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
List current supported currencies.
GET /currencies
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"snapshots": [
...,
{
"isoCode": "USD",
"numericCode":978,
"englishName": "Euro"
},
...
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
Provides information about a currency.
OPTIONS /currencies/{isoCode}
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/v1/api/currency/EUR",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/v1/api/currency/EUR",
"method": "GET"
},
{
"rel": "parent",
"href":"/v1/api/currencies",
"method": "GET"
},
{
"rel": "format",
"href":"/v1/api/currencies/EUR/format/0",
"method": "GET"
},
{
"rel": "parent",
"href":"/v1/api/currencies/EUR/format",
"method": "POST"
},
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Get detailed information about a currency.
GET /currencies/{isoCode}
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"detail": {
"isoCode":"EUR"
"numericCode":978,
"englishName":"Euro",
"nativeName":"Euro",
"symbol":"€",
"isObsolete":false
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Provides information about formatting a monetary amount according to its currency.
OPTIONS /currencies/{isoCode}/format/{amount}
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1/currencies/EUR/format/123",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format/123",
"method": "GET"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format",
"method": "POST"
},
{
"rel": "parent",
"href":"/api/v1/currencies/EUR",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Allows formatting a monetary amount according to its currency.
GET /currencies/{isoCode}/format/{amount}
> Accept: application/json
> Api_Key: your API key
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"money": {
"amount":123,
"isoCode":"EUR"
"representation":"123,00 €",
"amountRepresentation":"123,00"
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Provides information about formatting a monetary amount according to its currency.
OPTIONS /currencies/{isoCode}/format
> Accept: application/json
> Api_Key: your API key
{ "amount": "123.6" }
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"_links": [
{
"rel": "_self",
"href":"/api/v1/currencies/EUR/format/0",
"method": "OPTIONS"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format/0",
"method": "GET"
},
{
"rel": "self",
"href":"/api/v1/currencies/EUR/format",
"method": "POST"
},
{
"rel": "parent",
"href":"/api/v1/currencies/EUR",
"method": "GET"
}
]
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
Allows formatting a monetary amount according to its currency.
POST /currencies/{isoCode}/format
> Accept: application/json
> Api_Key: your API key
{ "amount": "123.6" }
< 200
< Content-Type: application/json
< X-Rate-Limit-Limit: number of requests allowed in period
< X-Rate-Limit-Remaining: number of requests allowed in period
< X-Rate-Limit-Reset: number of seconds left in period
{
"money": {
"amount":123.6,
"isoCode":"EUR",
"representation":"123,60 €",
"amountRepresentation":"123,60"
}
}
+++++
< 401
+++++
< 429
Retry-After: number of seconds to wait before making a new request
+++++
< 404
|
align authentication header name with apiary documentation
|
align authentication header name with apiary documentation
|
API Blueprint
|
bsd-2-clause
|
dgg/NMoneys.Web,dgg/NMoneys.Web,dgg/NMoneys.Web
|
f87c5970aa930b25b542849c6b4a9406bd2eb654
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# VGDB
Video Game Database for UT Austin SWE IDB project
## Games Collection [/games/collection]
### List Games [GET]
+ Response 200 (application/json)
[
{
"game_id": "1",
"title": "Overwatch",
"image": "https://....com/image.png",
"genres": [
"genre_id",
"genre_id"
],
"platforms": [
"platform_id",
"platform_id
],
"companies": [
"company_id",
"company_id"
]
},
{
"game_id": "2",
"title": "Hearthstone",
"image": "https://....com/image.png",
"genres": [
"genre_id",
"genre_id"
],
"platforms": [
"platform_id",
"platform_id
],
"companies": [
"company_id",
"company_id"
]
}
]
## Games [/games/game]
### Get Game [GET]
+ Response 200 (application/json)
{
"game_id": "123",
"title": "Overwatch",
"releaseDate": "2015",
"description": "...",
"genres": [
"genre_id",
"genre_id
],
"platform": [
"PC",
"PS4",
"XBOX1"
],
"image": "https://....com/image.png",
"avgRating": "8.2",
"numRatings": "1234567",
"characters": [
"char_id_1",
"char_id_2"
],
"playerPerspective": [
"First Person",
"Third Person
],
"playModes": [
"Single Player",
"Online Multiplayer"
],
"screenshots": [
"http://urltoimage.com/image.png"
],
"videos": [
"http://urltovideo.com/video.mp4"
],
"rating": [
{
"title": "ESRB",
"rating": "T"
},
{
"title": "PEGI",
"rating": "18"
}
],
"dlc": [
"DLC Title"
],
"expansions": [
"Expansion Title"
]
}
## Characters Collection [/characters/collection]
### List Characters [GET]
+ Response 200 (application/json)
[
{
"character_id": "1",
"name": "Master Chief",
"image": "https://....com/image.png",
"games": [
"game_id",
"game_id"
],
"species": "Human"
"gender": "Man"
},
{
"character_id": "2",
"name": "Kratos",
"image": "https://....com/image.png",
"games": [
"game_id",
"game_id"
],
"species": "Human"
"gender": "Man"
}
]
## Characters [/characters/character]
### Get Character [GET]
+ Response 200 (application/json)
{
"character_id": "123",
"name": "Mario",
"description": "...",
"games": [
"game_id",
"game_id"
],
"platform": [
"platform_id",
"platform_id"
],
"image": "https://....com/image.png"
}
## Platforms Collection [/platforms/collection]
### List Platforms [GET]
+ Response 200 (application/json)
[
{
"platform_id": "1",
"name": "Xbox 360",
"manufacturer": "Microsoft",
"games": [
"game_id",
"game_id"
],
"release_date": "YYYY-MM-DD"
},
{
"platform_id": "2",
"name": "Playstation 3",
"manufacturer": "Sony",
"games": [
"game_id",
"game_id"
],
"release_date": "YYYY-MM-DD"
}
]
## Platforms [/platforms/platform]
### Get Platform [GET]
+ Response 200 (application/json)
{
"platform_id": "1"
"name": "Xbox 360",
"average_rating": "XX",
"description": "...",
"games": [
"game_id",
"game_id"
],
"characters": [
"character_id",
"character_id"
],
"image": "https://....com/image.png"
}
## Developers Collection [/developers/collection]
### List Developers [GET]
+ Response 200 (application/json)
[
{
"developer_id": "1",
"name": "Bungie"
"average_rating": "--/100"
"location": "Bellevue, Washington",
"games": [
"game_id",
"game_id"
],
"image": "https://....com/image.png"
},
{
"developer_id": "2",
"name": "Nintendo"
"average_rating": "--/100"
"location": "Kyoto, Japan",
"games": [
"game_id",
"game_id"
],
"image": "https://....com/image.png"
}
<<<<<<< Updated upstream
]
=======
]
## Developers [/developers/developer]
### Get Developer [GET]
+ Response 200 (application/json)
{
"developer_id": "1",
"name": "Bungie",
"average_rating": "XX",
"descripton": "...",
"games": [
"game_id",
"game_id"
],
"platforms": [
"platform_id",
"platform_id"
],
"website": "https://....com/",
"image": "https://....com/image.png"
}
>>>>>>> Stashed changes
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# VGDB
Video Game Database for UT Austin SWE IDB project
## Games Collection [/games/collection]
### List Games [GET]
+ Response 200 (application/json)
[
{
"game_id": "1",
"title": "Overwatch",
"image": "https://....com/image.png",
"genres": [
"genre_id",
"genre_id"
],
"platforms": [
"platform_id",
"platform_id"
],
"companies": [
"company_id",
"company_id"
]
},
{
"game_id": "2",
"title": "Hearthstone",
"image": "https://....com/image.png",
"genres": [
"genre_id",
"genre_id"
],
"platforms": [
"platform_id",
"platform_id"
],
"companies": [
"company_id",
"company_id"
]
}
]
## Games [/games/game]
### Get Game [GET]
+ Response 200 (application/json)
{
"game_id": "123",
"title": "Overwatch",
"releaseDate": "2015",
"description": "...",
"genres": [
"genre_id",
"genre_id
],
"platform": [
"PC",
"PS4",
"XBOX1"
],
"image": "https://....com/image.png",
"avgRating": "8.2",
"numRatings": "1234567",
"characters": [
"char_id_1",
"char_id_2"
],
"playerPerspective": [
"First Person",
"Third Person
],
"playModes": [
"Single Player",
"Online Multiplayer"
],
"screenshots": [
"http://urltoimage.com/image.png"
],
"videos": [
"http://urltovideo.com/video.mp4"
],
"rating": [
{
"title": "ESRB",
"rating": "T"
},
{
"title": "PEGI",
"rating": "18"
}
],
"dlc": [
"DLC Title"
],
"expansions": [
"Expansion Title"
]
}
## Characters Collection [/characters/collection]
### List Characters [GET]
+ Response 200 (application/json)
[
{
"character_id": "1",
"name": "Master Chief",
"image": "https://....com/image.png",
"games": [
"game_id",
"game_id"
],
"species": "Human"
"gender": "Man"
},
{
"character_id": "2",
"name": "Kratos",
"image": "https://....com/image.png",
"games": [
"game_id",
"game_id"
],
"species": "Human"
"gender": "Man"
}
]
## Characters [/characters/character]
### Get Character [GET]
+ Response 200 (application/json)
{
"character_id": "123",
"name": "Mario",
"description": "...",
"games": [
"game_id",
"game_id"
],
"platform": [
"platform_id",
"platform_id"
],
"image": "https://....com/image.png"
}
## Platforms Collection [/platforms/collection]
### List Platforms [GET]
+ Response 200 (application/json)
[
{
"platform_id": "1",
"name": "Xbox 360",
"manufacturer": "Microsoft",
"games": [
"game_id",
"game_id"
],
"release_date": "YYYY-MM-DD"
},
{
"platform_id": "2",
"name": "Playstation 3",
"manufacturer": "Sony",
"games": [
"game_id",
"game_id"
],
"release_date": "YYYY-MM-DD"
}
]
## Platforms [/platforms/platform]
### Get Platform [GET]
+ Response 200 (application/json)
{
"platform_id": "1"
"name": "Xbox 360",
"average_rating": "XX",
"description": "...",
"games": [
"game_id",
"game_id"
],
"characters": [
"character_id",
"character_id"
],
"image": "https://....com/image.png"
}
## Developers Collection [/developers/collection]
### List Developers [GET]
+ Response 200 (application/json)
[
{
"developer_id": "1",
"name": "Bungie"
"average_rating": "--/100"
"location": "Bellevue, Washington",
"games": [
"game_id",
"game_id"
],
"image": "https://....com/image.png"
},
{
"developer_id": "2",
"name": "Nintendo"
"average_rating": "--/100"
"location": "Kyoto, Japan",
"games": [
"game_id",
"game_id"
],
"image": "https://....com/image.png"
}
<<<<<<< Updated upstream
]
=======
]
## Developers [/developers/developer]
### Get Developer [GET]
+ Response 200 (application/json)
{
"developer_id": "1",
"name": "Bungie",
"average_rating": "XX",
"descripton": "...",
"games": [
"game_id",
"game_id"
],
"platforms": [
"platform_id",
"platform_id"
],
"website": "https://....com/",
"image": "https://....com/image.png"
}
>>>>>>> Stashed changes
|
Fix issues with apiary doc
|
Fix issues with apiary doc
|
API Blueprint
|
mit
|
mattruston/idb,mattruston/idb,mattruston/idb,mattruston/idb
|
2f8ddb05e59ae27832f0084186120a8ccaf5e962
|
apiary.apib
|
apiary.apib
|
HOST: http://api.openbookprices.com/
--- OpenBookPrices ---
---
Welcome to the our sample API documentation. All comments can be written in (support [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax)
---
--
Shopping Cart Resources
The following is a section of resources related to the shopping cart
--
Echo back your own request
GET /echo
< 200
< Content-Type: application/json
{
"timestamp": 1381509290.302,
"request": {
"method": "GET",
"secure": false,
"protocol": "http",
"host": "app.openbookprices.com",
"subdomains": [
"app"
],
"url": "/",
"originalUrl": "/echo",
"path": "/",
"query": {}
},
"network": {
"ip": "91.235.56.121",
"ips": [
"91.235.56.121"
]
},
"headers": {
"host": "app.openbookprices.com",
"user-agent": "Amazon CloudFront",
"via": "1.0 678cdeea3c67419b8e71d6490af123a1.cloudfront.net (CloudFront)",
"connection": "Keep-Alive",
"x-amz-cf-id": "z034Ur0Ub-101_73fuPLKM9wHp-8-ni3qjtRCcA0DdGHpYPtV5Yl0A==",
"x-forwarded-for": "91.235.56.121",
"accept-encoding": "gzip",
"cache-control": ""
}
}
|
HOST: http://api.openbookprices.com/
--- OpenBookPrices ---
---
The OpenBookPrices API lets you get current prices from book vendors around the
world, including shipping costs to your country and all converted into your
currency.
---
-- Books and prices --
Determine the country (and hence currency) of the person making the request and then redirect to the specific url.
GET /books/{isbn}/prices
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/books/9780340831496/prices/US/USD
Determine the primary currency of the `country` and redirect to the specific url.
GET /books/{isbn}/prices/{country}
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/books/9780340831496/prices/US/USD
Return immediately a list of all the venders who ship to `country` and the pricing details that are currently known.
GET /books/{isbn}/prices/{country}/{currency}
< 200
< Content-Type: application/json
[
{
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
},
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"ttl": 0,
"timestamp": 1381517829,
"url": null,
"status": "unfetched",
"retryDelay": 0.1,
"preConversionCurrency": null,
"apiURL": "http://api.openbookprices.com/books/9780340831496/prices/US/USD/amazon_uk"
},
{
"vendor": {
"code": "amazon_us",
"name": "Amazon USA",
"homepage": "http://www.amazon.com/"
},
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"ttl": 0,
"timestamp": 1381517829,
"url": null,
"status": "unfetched",
"retryDelay": 0.1,
"preConversionCurrency": null,
"apiURL": "http://api.openbookprices.com/books/9780340831496/prices/US/USD/amazon_us"
},
{
"vendor": {
"code": "foyles",
"name": "Foyles",
"homepage": "http://www.foyles.co.uk/"
},
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"ttl": 0,
"timestamp": 1381517829,
"url": null,
"status": "unfetched",
"retryDelay": 0.1,
"preConversionCurrency": null,
"apiURL": "http://api.openbookprices.com/books/9780340831496/prices/US/USD/foyles"
}
]
Return fresh details for the vendor. If needed this will initiate a fetch of the details so the response may block whilst this is happening.
GET /books/{isbn}/prices/{country}/{currency}/{vendor}
< 200
< Content-Type: application/json
{
"currency": "USD",
"url": "http://www.amazon.co.uk/dp/0340831499",
"offers": {
"new": {
"price": 21.7,
"availabilityNote": "Usually dispatched within 24 hours",
"shippingNote": "5 to 7 business days",
"shipping": 6.98,
"total": 28.68
}
},
"ttl": 3600,
"timestamp": 1381518231,
"isbn": "9780340831496",
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
},
"country": "US",
"status": "ok",
"retryDelay": null,
"preConversionCurrency": "GBP",
"apiURL": "http://api.openbookprices.com/books/9780340831496/prices/US/USD/amazon_uk"
}
-- Miscellaneous endpoints --
---
Echo back your own request - useful for checking what has reached the server. Should never be cached.
---
GET /echo
< 200
< Content-Type: application/json
{
"timestamp": 1381509290.302,
"request": {
"method": "GET",
"secure": false,
"protocol": "http",
"host": "app.openbookprices.com",
"subdomains": [
"app"
],
"url": "/",
"originalUrl": "/echo",
"path": "/",
"query": {}
},
"network": {
"ip": "12.34.56.78",
"ips": [
"12.34.56.78"
]
},
"headers": {
"host": "app.openbookprices.com",
"user-agent": "Amazon CloudFront",
"via": "1.0 678cdeea3c67419b8e71d6490af123a1.cloudfront.net (CloudFront)",
"connection": "Keep-Alive",
"x-amz-cf-id": "z034Ur0Ub-101_73fuPLKM9wHp-8-ni3qjtRCcA0DdGHpYPtV5Yl0A==",
"x-forwarded-for": "91.235.56.121",
"accept-encoding": "gzip",
"cache-control": ""
}
}
|
Add most of the /book/{isbn}/prices/... endpoints
|
Add most of the /book/{isbn}/prices/... endpoints
|
API Blueprint
|
agpl-3.0
|
OpenBookPrices/openbookprices-api
|
96fdcab28a56e6bd2323e84752d6f09988b63dde
|
doc/example-httpbin.apib
|
doc/example-httpbin.apib
|
--- Examples against httpbin.org ---
---
Examples of how some requests to _httpbin.org_ can be specified. Read more about
the httpbin.org API at http://httpbin.org/.
See ../README.md for details on how to test this specification.
---
# First request and response
Get a teapot from some full URL.
Leading or trailing blank lines in the body are stripped, unless you delimit
the body lines with the markers <<< (start) and >>> (end). The newlines after
<<< as well as the newline before >>> is not included in the body.
GET /status/418
> Accept: *
> User-Agent: KATT
> Host: {{<hostname}}:{{<port}}
< 418
< X-More-Info: http://tools.ietf.org/html/rfc2324
<<<
-=[ teapot ]=-
_...._
.' _ _ `.
| ."` ^ `". _,
\_;`"---"`|//
| ;/
\_ _/
`"""`
>>>
# Second request and response
Get unauthorized.
Also note that we don't expect any body.
The current date will be available to use in later requests as `{{<some_date}}.`
GET /status/401
> Accept: *
> User-Agent: KATT
< 401
< Www-Authenticate: Basic realm="Fake Realm"
< Date: {{>some_date}}
# Third request
Note that the title of this operation is "Third request", but that's just
markdown for you. You don't need to include a title, or even a description of
the operations unless you want to. In the fourth request we will skip the
description altogether.
Here we are getting a cached response.
GET /cache
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"url": "http://httpbin.org/cache",
"headers": "{{_}}",
"args": "{{_}}",
"origin": "{{>origin}}"
}
GET /cache
> Accept: application/json
> User-Agent: KATT
> If-Modified-Since: {{<some_date}}
< 304
A fifth request to show that whitespace in JSON body is insignificant.
POST /post
> Accept: application/json
> Content-Type: application/json
> User-Agent: KATT
{"origin":"{{<origin}}","whoarewe":"{{<your_name}}_and_{{<my_name}}","date":"{{<some_date}}"}
< 200
< Content-Type: application/json
{
"args": "{{_}}",
"data": "{{>raw_data}}",
"files": [],
"form": [],
"headers": "{{_}}",
"origin": "{{<origin}}",
"url": "http://httpbin.org/post",
"json": {
"origin": "{{<origin}}",
"date": "{{<some_date}}",
"whoarewe": "{{>whoarewe}}"
}
}
GET /get?origin={{<origin}}&whoarewe={{<whoarewe}}
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"args": {
"whoarewe": "{{<your_name}}_and_{{<my_name}}",
"origin": "{{<origin}}"
},
"headers": "{{_}}",
"origin": "{{_}}",
"url": "http://httpbin.org/get?origin={{<origin}}&whoarewe={{<whoarewe}}"
}
|
--- Examples against httpbin.org ---
---
Examples of how some requests to _httpbin.org_ can be specified. Read more about
the httpbin.org API at http://httpbin.org/.
See ../README.md for details on how to test this specification.
---
# First request and response
Get a teapot from some full URL.
Leading or trailing blank lines in the body are stripped, unless you delimit
the body lines with the markers <<< (start) and >>> (end). The newlines after
<<< as well as the newline before >>> is not included in the body.
GET /status/418
> Accept: *
> User-Agent: KATT
> Host: {{<hostname}}:{{<port}}
< 418
< X-More-Info: http://tools.ietf.org/html/rfc2324
<<<
-=[ teapot ]=-
_...._
.' _ _ `.
| ."` ^ `". _,
\_;`"---"`|//
| ;/
\_ _/
`"""`
>>>
# Second request and response
Get unauthorized.
Also note that we don't expect any body.
The current date will be available to use in later requests as `{{<some_date}}.`
GET /status/401
> Accept: *
> User-Agent: KATT
< 401
< Www-Authenticate: Basic realm="Fake Realm"
< Date: {{>some_date}}
# Third request
Note that the title of this operation is "Third request", but that's just
markdown for you. You don't need to include a title, or even a description of
the operations unless you want to. In the fourth request we will skip the
description altogether.
Here we are getting a cached response.
GET /cache
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"url": "http://httpbin.org/cache",
"headers": "{{_}}",
"args": "{{_}}",
"origin": "{{>origin}}"
}
GET /cache
> Accept: application/json
> User-Agent: KATT
> If-Modified-Since: {{<some_date}}
< 304
A fifth request to show that whitespace in JSON body is insignificant.
POST /post
> Accept: application/json
> Content-Type: application/json
> User-Agent: KATT
{"origin":"{{<origin}}","whoarewe":"{{<your_name}}_and_{{<my_name}}","date":"{{<some_date}}"}
< 200
< Content-Type: application/json
{
"args": "{{_}}",
"data": "{{>raw_data}}",
"files": {},
"form": {},
"headers": "{{_}}",
"origin": "{{<origin}}",
"url": "http://httpbin.org/post",
"json": {
"origin": "{{<origin}}",
"date": "{{<some_date}}",
"whoarewe": "{{>whoarewe}}"
}
}
GET /get?origin={{<origin}}&whoarewe={{<whoarewe}}
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"args": {
"whoarewe": "{{<your_name}}_and_{{<my_name}}",
"origin": "{{<origin}}"
},
"headers": "{{_}}",
"origin": "{{_}}",
"url": "http://httpbin.org/get?origin={{<origin}}&whoarewe={{<whoarewe}}"
}
|
fix doc apib
|
fix doc apib
|
API Blueprint
|
apache-2.0
|
for-GET/katt
|
8a2f2f4579ae5e8b63c0427c173927eacc2849ce
|
blueprint/notifications.apib
|
blueprint/notifications.apib
|
FORMAT: 1A
HOST: https://api.thegrid.io/
# Group Registering for Notifications
Notifications allow applications to instantly know when certain data has changed,
or certain user actions has been performed. Correct implementation of notifications
allows user to use multiple devices, with the data always being up-to-date.
To receive notifications, the Grid app needs to be registered as a client application.
The notifications sent to clients follow the [notifications schema](schema/notification.json).
For how to deal with particular notifications, see the recommendations found below.
When reacting to an action the client needs to make the request using the regular Bearer token.
## User clients [/client]
### List user's active client apps [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/client-gcm.json) -->
<!-- include(examples/client-apn.json) -->
]
```
### Register a new client app [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/client-gcm.json) -->
```
+ Schema
```
<!-- include(schema/client.json) -->
```
+ Response 201
+ Headers
Location: /client/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Client app [/client/{id}]
+ Parameters
+ id (required, string) - Site UUID
### Remove a client app [DELETE]
+ Response 204
## Notifications testing [/molly/repeat]
### Send a test notification [POST]
For development purposes, you can make Molly talk to you over the registered notification channels (like Google Cloud Messaging).
A push message will be sent to the user's all registered clients.
+ Request (application/json)
+ Schema
```
<!-- include(schema/notification.json) -->
```
+ Response 202
# Group Available Notifications
## Synchronization
These notification payloads are intended for API clients to refresh changed data from the server. They are not indended to be visualized except for possible data changes in the UI (new items appearing, site configs changing, etc).
User events:
* `user_merge`: user account has been merged with another one. All data should be re-fetched
* `user_removed`: the user account has been disabled. Remove data and disable application usage
* `user_activated`: the authenticated user's account has been activated. Re-fetch data and enable full application usage. This one may be worthy of notifying user visually
Item events:
* `new_item`: new item has been created, fetch with `id`
* `updated_item`: item has been updated, fetch with `id`
* `published_item`: item has been published to `sites`, update display accordingly. Fetch with `id` if needed
* `unpublished_item`: item has been unpublished from `sites`, update display accordingly. Fetch with `id` if needed
* `removed_item`: item has been deleted. Remove from app
Site events:
* `new_site`: new site has been created, fetch with `id` or use `repo`
* `updated_site`: site has been updated, fetch with `id` or use `repo`. These can be also caused by site publishing process
* `removed_site`: site has been deleted. Remove from app
## Job status
The job status notifications are related to long-running operations initiated by the user or a back-end process that the user should be aware of. These should be shown with persistent progress indicators either in the system's notifications are or in the context of the action made (for example, a "loading" item card).
Job events contain the following information:
* `job_id`: identifier for the long-running job, can be used for polling the job endpoint
* `item`: item ID associated with the job, if any
* `job_type`: type of the job, currently either `share` or `publish`
Job status changes cause the following events to be sent:
* `started_job`: job has started. Show progress notification accordingly
* `updated_job`: there has been progress on the job. Possibly move progress indicator one step forward
* `failed_job`: job has failed. Replace progress notification with a failure indicator
* `completed_job`: job has completed. Remove progress notification or replace with a success indicator
## Actionable notifications
These notifications are related to something urgent the user should be able to react to. They should be shown as OS-level notifications that may have additional information like screenshots or action buttons associated with them.
Notifications from the `molly` AI:
These notifications are meant to be shown visually, and contain the texts written by the AI to the user. In general, they have the `molly` collapse key if available on the platform.
Molly notifications contain the following keys:
* `type`: subtype of the notification, for example `review` or `publish`
* `title`: textual title for the notification
* `text`: full notification text
* `url`: URL that the user can visit to see more related to the notification, for example a newly redesigned website of theirs
* `preview`: Screenshot for the URL above, if any
* `ipfs`: IPFS hash for the URL, if any
* `site`: ID of the site associated with the notification
* `job`: ID of the job associated with the notification, if any. Can be used to morph job progress to visual notification
* `actions`: array of potential additional actions that user can perform, each containing `label`, `icon`, `path`, `method`, and `payload`
Molly notification types:
* `review`: The AI has multiple designs for the user to review and choose from
* `publish`: A new version of the site or some pages within is now live
|
FORMAT: 1A
HOST: https://api.thegrid.io/
# Group Registering for Notifications
Notifications allow applications to instantly know when certain data has changed,
or certain user actions has been performed. Correct implementation of notifications
allows user to use multiple devices, with the data always being up-to-date.
To receive notifications, the Grid app needs to be registered as a client application.
The notifications sent to clients follow the [notifications schema](schema/notification.json).
For how to deal with particular notifications, see the recommendations found below.
When reacting to an action the client needs to make the request using the regular Bearer token.
## User clients [/client]
### List user's active client apps [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/client-gcm.json) -->
<!-- include(examples/client-apn.json) -->
]
```
### Register a new client app [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/client-gcm.json) -->
```
+ Schema
```
<!-- include(schema/client.json) -->
```
+ Response 201
+ Headers
Location: /client/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Client app [/client/{id}]
+ Parameters
+ id (required, string) - Site UUID
### Remove a client app [DELETE]
+ Response 204
## Notifications testing [/molly/repeat]
### Send a test notification [POST]
For development purposes, you can make Molly talk to you over the registered notification channels (like Google Cloud Messaging).
A push message will be sent to the user's all registered clients.
+ Request (application/json)
+ Schema
```
<!-- include(schema/notification.json) -->
```
+ Response 202
# Group Available Notifications
## Synchronization
These notification payloads are intended for API clients to refresh changed data from the server. They are not indended to be visualized except for possible data changes in the UI (new items appearing, site configs changing, etc).
User events:
* `user_merge`: user account has been merged with another one. All data should be re-fetched
* `user_removed`: the user account has been disabled. Remove data and disable application usage
* `user_activated`: the authenticated user's account has been activated. Re-fetch data and enable full application usage. This one may be worthy of notifying user visually
Item events:
* `new_item`: new item has been created, fetch with `id`
* `updated_item`: item has been updated, fetch with `id`
* `published_item`: item has been published to `sites`, update display accordingly. Fetch with `id` if needed
* `unpublished_item`: item has been unpublished from `sites`, update display accordingly. Fetch with `id` if needed
* `removed_item`: item has been deleted. Remove from app
Site events:
* `new_site`: new site has been created, fetch with `id` or use `repo`
* `updated_site`: site has been updated, fetch with `id` or use `repo`. These can be also caused by site publishing process
* `removed_site`: site has been deleted. Remove from app
Redesign events:
* `new_redesign`: new redesign is available for the site, fetch with `id`
* `updated_redesign`: redesign has been updated (usually with a rating), fetch with `id`
* `removed_redesign`: redesign has been removed. Remove from app
## Job status
The job status notifications are related to long-running operations initiated by the user or a back-end process that the user should be aware of. These should be shown with persistent progress indicators either in the system's notifications are or in the context of the action made (for example, a "loading" item card).
Job events contain the following information:
* `job_id`: identifier for the long-running job, can be used for polling the job endpoint
* `item`: item ID associated with the job, if any
* `job_type`: type of the job, currently either `share` or `publish`
Job status changes cause the following events to be sent:
* `started_job`: job has started. Show progress notification accordingly
* `updated_job`: there has been progress on the job. Possibly move progress indicator one step forward
* `failed_job`: job has failed. Replace progress notification with a failure indicator
* `completed_job`: job has completed. Remove progress notification or replace with a success indicator
## Actionable notifications
These notifications are related to something urgent the user should be able to react to. They should be shown as OS-level notifications that may have additional information like screenshots or action buttons associated with them.
Notifications from the `molly` AI:
These notifications are meant to be shown visually, and contain the texts written by the AI to the user. In general, they have the `molly` collapse key if available on the platform.
Molly notifications contain the following keys:
* `type`: subtype of the notification, for example `review` or `publish`
* `title`: textual title for the notification
* `text`: full notification text
* `url`: URL that the user can visit to see more related to the notification, for example a newly redesigned website of theirs
* `preview`: Screenshot for the URL above, if any
* `ipfs`: IPFS hash for the URL, if any
* `site`: ID of the site associated with the notification
* `job`: ID of the job associated with the notification, if any. Can be used to morph job progress to visual notification
* `actions`: array of potential additional actions that user can perform, each containing `label`, `icon`, `path`, `method`, and `payload`
Molly notification types:
* `review`: The AI has multiple designs for the user to review and choose from
* `publish`: A new version of the site or some pages within is now live
|
Document redesign sync notifications
|
Document redesign sync notifications
|
API Blueprint
|
mit
|
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
|
4a61cce0a62223cb1430db8ce2eff13be6228adc
|
docs/apib/update_comp.apib
|
docs/apib/update_comp.apib
|
FORMAT: 1A
# XClarity UpdateComp
# Components [/updatableComponents]
## Retrieve [GET]
+ Response 200
{
"DeviceList": [{
"CMMList": [{
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 1,
"Phase": "Applying",
"StartTime": "2015-04-13 12:50:31.077",
"State": "InProgress",
"Status": "Active",
"TaskID": 1
},
"UUID": "6134AFCEA91311E199A5A45AC8953137"
}]
},
{
"ServerList": [{
"UUID": "8BFBADCC33CB11E499F740F2E9903640",
"Components": [{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 4
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 32
}
}]
},
{
"UUID": "0CDF130FDFC211E392806CAE8B704250",
"Components": [{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 64
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 30
}
}]
}]
},
{
"SwitchList": [{
"ReadinessCheck": {
"ElapsedTime": "00:00:00:01.509",
"ElapsedTimeFormatted": "1 second 509 milliseconds",
"EndTime": "2016-04-07 23:44:10.366",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"StartTime": "2016-04-07 23:44:08.857",
"State": "Complete",
"Status": "Failed",
"TaskID": 1,
"Message": {
"result": "informational",
"messages": [{
"id": "FQXHMUP1000I",
"text": "The command completed successfully."
},
{
"id": "FQXHMUP4545L",
"text": "The device is not ready for an update.",
"explanation": "The device did not pass validation for firmware updates..",
"recovery": {
"text": "Correct the issues discovered by validation checks."
}
}]
}
},
"UpdateStatus": {
"EndTime": "2016-04-07 23:44:10.869",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"State": "Complete",
"Status": "Canceled",
"TaskID": 3,
"Message": {
"result": "warning",
"messages": [{
"id": "FQXHMUP4086F",
"text": "The RackSwitch G7052 xHMCUpdates task was canceled.",
"explanation": "The task was canceled",
"recovery": {
"text": "Try to perform the update again.If the problem persists"
}
}]
}
},
"UUID": "0b0f5101bb8844b8b2d1c1aaeb24f446"
}]
}],
"UpdateStatusMetrics": {
"TotaldeviceUpdates": 6,
"TotaldeviceUpdatesActive": 6,
"TotaldeviceUpdatesComplete": 0,
"TotaldeviceUpdatesInProgress": 1,
"TotalJobs": 1,
"TotalJobsComplete": 0,
"TotalJobsInProgress": 1,
"TotalJobsPercentComplete": 0,
"TotalSupportTasks": 18,
"TotalSupportTasksActive": 18,
"TotalTasks": 93,
"TotalTasksBlocked": 92,
"TotalTasksCanceled": 0,
"TotalTasksComplete": 0,
"TotalTasksFailed": 0,
"TotalTasksInProgress": 1,
"TotalTasksSuccess": 0,
"TotalUpdateTasks": 75,
"TotalUpdateTasksActive": 72
},
"result": "informational",
"messages": [{
"id": "FQXHMUP4091I",
"text": "Update Status was obtained successfully."
}]
}
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
# Components [/updatableComponents?action=getComponents]
## Retrieve [GET]
+ Response 200
{
"DeviceList": [{
"CMMList": [{
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 1,
"Phase": "Applying",
"StartTime": "2015-04-13 12:50:31.077",
"State": "InProgress",
"Status": "Active",
"TaskID": 1
},
"UUID": "6134AFCEA91311E199A5A45AC8953137"
}]
},
{
"ServerList": [{
"UUID": "8BFBADCC33CB11E499F740F2E9903640",
"Components": [{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 4
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 32
}
}]
},
{
"UUID": "0CDF130FDFC211E392806CAE8B704250",
"Components": [{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 64
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 30
}
}]
}]
},
{
"SwitchList": [{
"ReadinessCheck": {
"ElapsedTime": "00:00:00:01.509",
"ElapsedTimeFormatted": "1 second 509 milliseconds",
"EndTime": "2016-04-07 23:44:10.366",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"StartTime": "2016-04-07 23:44:08.857",
"State": "Complete",
"Status": "Failed",
"TaskID": 1,
"Message": {
"result": "informational",
"messages": [{
"id": "FQXHMUP1000I",
"text": "The command completed successfully."
},
{
"id": "FQXHMUP4545L",
"text": "The device is not ready for an update.",
"explanation": "The device did not pass validation for firmware updates..",
"recovery": {
"text": "Correct the issues discovered by validation checks."
}
}]
}
},
"UpdateStatus": {
"EndTime": "2016-04-07 23:44:10.869",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"State": "Complete",
"Status": "Canceled",
"TaskID": 3,
"Message": {
"result": "warning",
"messages": [{
"id": "FQXHMUP4086F",
"text": "The RackSwitch G7052 xHMCUpdates task was canceled.",
"explanation": "The task was canceled",
"recovery": {
"text": "Try to perform the update again"
}
}]
}
},
"UUID": "0b0f5101bb8844b8b2d1c1aaeb24f446"
}]
}],
"UpdateStatusMetrics": {
"TotaldeviceUpdates": 6,
"TotaldeviceUpdatesActive": 6,
"TotaldeviceUpdatesComplete": 0,
"TotaldeviceUpdatesInProgress": 1,
"TotalJobs": 1,
"TotalJobsComplete": 0,
"TotalJobsInProgress": 1,
"TotalJobsPercentComplete": 0,
"TotalSupportTasks": 18,
"TotalSupportTasksActive": 18,
"TotalTasks": 93,
"TotalTasksBlocked": 92,
"TotalTasksCanceled": 0,
"TotalTasksComplete": 0,
"TotalTasksFailed": 0,
"TotalTasksInProgress": 1,
"TotalTasksSuccess": 0,
"TotalUpdateTasks": 75,
"TotalUpdateTasksActive": 72
},
"result": "informational",
"messages": [{
"id": "FQXHMUP4091I",
"text": "Update Status was obtained successfully."
}]
}
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
# Components [/updatableComponents{?action,activationMode,onErrorMode,forceUpdateMode}]
+ Parameters
+ action - The action to take. This can be one of the following values - apply, cancelApply, powerState
+ activationMode - Indicates when to activate the update. This can be one of the following values - immediate, delayed
+ forceUpdateMode - Indicates whether to apply the update if firmware is already compliant. This can be one of the following values - true, false
+ onErrorMode - Indicates how to handle errors during the firmware update. This can be one of the following values - stopOnError, stopdeviceOnError, continueOnError
## Apply [PUT]
+ Request (application/json)
{
"DeviceList": [
{
"ServerList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]}]
},
{
"SwitchList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_scsw_en4093r-8.3.9.0_anyons_noarch","Component": "Main application"}]}]
},
{
"StorageList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]}]
},
{
"CMMList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]
}
]
}
+ Response 200
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
+ Request (application/json)
{
"DeviceList": [
{
"ServerList":[{"PowerState": "reset","UUID": "8BFBADCC33CB11E499F740F2E9972457"}]
},
{
"SwitchList":[{"PowerState": "powerOn","UUID": "8BFBADCC33CB11E499F740F2E9972458"}]
},
{
"StorageList":[{"PowerState": "powerCycleSoft","UUID": "8BFBADCC33CB11E499F740F2E9972457"}]
},
{
"CMMList":[{"PowerState": "reset","UUID": "8BFBADCC33CB11E499F740F2E213123"}]
}
]
}
+ Response 200
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
|
FORMAT: 1A
# XClarity UpdateComp
# Components [/updatableComponents]
## Retrieve [GET]
+ Response 200
{
"DeviceList": [
{
"CMMList": [
{
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 1,
"Phase": "Applying",
"StartTime": "2015-04-13 12:50:31.077",
"State": "InProgress",
"Status": "Active",
"TaskID": 1
},
"UUID": "6134AFCEA91311E199A5A45AC8953137"
}
]
},
{
"ServerList": [
{
"UUID": "8BFBADCC33CB11E499F740F2E9903640",
"Components": [{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 4
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 32
}
}
]
},
{
"UUID": "0CDF130FDFC211E392806CAE8B704250",
"Components": [
{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 64
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 30
}
}
]
}
]
},
{
"SwitchList": [
{
"ReadinessCheck": {
"ElapsedTime": "00:00:00:01.509",
"ElapsedTimeFormatted": "1 second 509 milliseconds",
"EndTime": "2016-04-07 23:44:10.366",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"StartTime": "2016-04-07 23:44:08.857",
"State": "Complete",
"Status": "Failed",
"TaskID": 1,
"Message": {
"result": "informational",
"messages": [
{
"id": "FQXHMUP1000I",
"text": "The command completed successfully."
},
{
"id": "FQXHMUP4545L",
"text": "The device is not ready for an update.",
"explanation": "The device did not pass validation for firmware updates..",
"recovery": {
"text": "Correct the issues discovered by validation checks."
}
}
]
}
},
"UpdateStatus": {
"EndTime": "2016-04-07 23:44:10.869",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"State": "Complete",
"Status": "Canceled",
"TaskID": 3,
"Message": {
"result": "warning",
"messages": [
{
"id": "FQXHMUP4086F",
"text": "The RackSwitch G7052 xHMCUpdates task was canceled.",
"explanation": "The task was canceled",
"recovery": {
"text": "Try to perform the update again.If the problem persists"
}
}
]
}
},
"UUID": "0b0f5101bb8844b8b2d1c1aaeb24f446"
}
]
}
],
"UpdateStatusMetrics": {
"TotaldeviceUpdates": 6,
"TotaldeviceUpdatesActive": 6,
"TotaldeviceUpdatesComplete": 0,
"TotaldeviceUpdatesInProgress": 1,
"TotalJobs": 1,
"TotalJobsComplete": 0,
"TotalJobsInProgress": 1,
"TotalJobsPercentComplete": 0,
"TotalSupportTasks": 18,
"TotalSupportTasksActive": 18,
"TotalTasks": 93,
"TotalTasksBlocked": 92,
"TotalTasksCanceled": 0,
"TotalTasksComplete": 0,
"TotalTasksFailed": 0,
"TotalTasksInProgress": 1,
"TotalTasksSuccess": 0,
"TotalUpdateTasks": 75,
"TotalUpdateTasksActive": 72
},
"result": "informational",
"messages": [
{
"id": "FQXHMUP4091I",
"text": "Update Status was obtained successfully."
}
]
}
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
# Components [/updatableComponents?action=getComponents]
## Retrieve [GET]
+ Response 200
{
"DeviceList": [
{
"CMMList": [
{
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 1,
"Phase": "Applying",
"StartTime": "2015-04-13 12:50:31.077",
"State": "InProgress",
"Status": "Active",
"TaskID": 1
},
"UUID": "6134AFCEA91311E199A5A45AC8953137"
}
]
},
{
"ServerList": [
{
"UUID": "8BFBADCC33CB11E499F740F2E9903640",
"Components": [
{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 4
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 32
}
}
]
},
{
"UUID": "0CDF130FDFC211E392806CAE8B704250",
"Components": [
{
"Component": "System Prerequisites",
"UpdateStatus": {
"JobID": 1,
"PercentComplete": 0,
"Phase": "Queued",
"State": "Blocked",
"Status": "Queued",
"TaskID": 64
},
"Weight": 1
},
{
"Component": "ITE",
"UpdateStatus": {
"CurrentComponent": {
"Component": "Queued"
},
"PercentComplete": 0,
"State": "NotStarted",
"Status": "Active",
"TotalComplete": 0,
"TotalComponents": 30
}
}
]
}
]
},
{
"SwitchList": [
{
"ReadinessCheck": {
"ElapsedTime": "00:00:00:01.509",
"ElapsedTimeFormatted": "1 second 509 milliseconds",
"EndTime": "2016-04-07 23:44:10.366",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"StartTime": "2016-04-07 23:44:08.857",
"State": "Complete",
"Status": "Failed",
"TaskID": 1,
"Message": {
"result": "informational",
"messages": [
{
"id": "FQXHMUP1000I",
"text": "The command completed successfully."
},
{
"id": "FQXHMUP4545L",
"text": "The device is not ready for an update.",
"explanation": "The device did not pass validation for firmware updates..",
"recovery": {
"text": "Correct the issues discovered by validation checks."
}
}
]
}
},
"UpdateStatus": {
"EndTime": "2016-04-07 23:44:10.869",
"JobID": 1,
"PercentComplete": 100,
"Phase": "Complete",
"State": "Complete",
"Status": "Canceled",
"TaskID": 3,
"Message": {
"result": "warning",
"messages": [
{
"id": "FQXHMUP4086F",
"text": "The RackSwitch G7052 xHMCUpdates task was canceled.",
"explanation": "The task was canceled",
"recovery": {
"text": "Try to perform the update again"
}
}
]
}
},
"UUID": "0b0f5101bb8844b8b2d1c1aaeb24f446"
}
]
}
],
"UpdateStatusMetrics": {
"TotaldeviceUpdates": 6,
"TotaldeviceUpdatesActive": 6,
"TotaldeviceUpdatesComplete": 0,
"TotaldeviceUpdatesInProgress": 1,
"TotalJobs": 1,
"TotalJobsComplete": 0,
"TotalJobsInProgress": 1,
"TotalJobsPercentComplete": 0,
"TotalSupportTasks": 18,
"TotalSupportTasksActive": 18,
"TotalTasks": 93,
"TotalTasksBlocked": 92,
"TotalTasksCanceled": 0,
"TotalTasksComplete": 0,
"TotalTasksFailed": 0,
"TotalTasksInProgress": 1,
"TotalTasksSuccess": 0,
"TotalUpdateTasks": 75,
"TotalUpdateTasksActive": 72
},
"result": "informational",
"messages": [
{
"id": "FQXHMUP4091I",
"text": "Update Status was obtained successfully."
}
]
}
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
# Components [/updatableComponents{?action,activationMode,onErrorMode,forceUpdateMode}]
+ Parameters
+ action - The action to take. This can be one of the following values - apply, cancelApply, powerState
+ activationMode - Indicates when to activate the update. This can be one of the following values - immediate, delayed
+ forceUpdateMode - Indicates whether to apply the update if firmware is already compliant. This can be one of the following values - true, false
+ onErrorMode - Indicates how to handle errors during the firmware update. This can be one of the following values - stopOnError, stopdeviceOnError, continueOnError
## Apply [PUT]
+ Request (application/json)
{
"DeviceList": [
{
"ServerList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]}]
},
{
"SwitchList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_scsw_en4093r-8.3.9.0_anyons_noarch","Component": "Main application"}]}]
},
{
"StorageList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]}]
},
{
"CMMList":[{"UUID": "8BFBADCC33CB11E499F740F2E9903640","Components": [{"Fixid": "lnvgy_fw_storage_1.1.1","Component": "Controller a"}]
}
]
}
+ Response 200
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
+ Request (application/json)
{
"DeviceList": [
{
"ServerList":[{"PowerState": "reset","UUID": "8BFBADCC33CB11E499F740F2E9972457"}]
},
{
"SwitchList":[{"PowerState": "powerOn","UUID": "8BFBADCC33CB11E499F740F2E9972458"}]
},
{
"StorageList":[{"PowerState": "powerCycleSoft","UUID": "8BFBADCC33CB11E499F740F2E9972457"}]
},
{
"CMMList":[{"PowerState": "reset","UUID": "8BFBADCC33CB11E499F740F2E213123"}]
}
]
}
+ Response 200
+ Response 400
+ Response 401
+ Response 404
+ Response 409
+ Response 500
|
test case
|
test case
|
API Blueprint
|
apache-2.0
|
lenovo/xclarity_client,juliancheal/xclarity_client,lenovo/xclarity_client,juliancheal/xclarity_client
|
cfa1d7cf88bb9a5ffafbd8257d9772f1e2eef249
|
LIGHTNING-API-BLUEPRINT.apib
|
LIGHTNING-API-BLUEPRINT.apib
|
FORMAT: 1A
Weather API
=============================
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `lightning`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials with http basic auth).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**lightning** is the scope which allows to request Lightning Service.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
# Group Lightning
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}&startPosition={startPosition}]
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z&occurredUntil=2017-01-05T12:21:15Z&startPosition=30000
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]
##### Limitation
Due to some technical constraints, the response payload size is limited to max. 6MB - this is equivalent to ca. 30000 lightning events. If there are more than 30000 results in storage which comply to the search criteria, they can be retrieved using pagination.
In such case the response payload contains [HAL](http://stateless.co/hal_specification.html)-compatible `_link` object which contains links to the next page and the response type is application/hal+json.
If locationWithin is worldwide [-180, 90][180, -90] and occurrence ~3 days
### Observed lightning for a given boundingBox and time period
This resource provides data from existing lightning observation providers.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ provider: `ENGLN,NOWCAST` (string, required)
- lightning providers.
+ startPosition: `60000` (not negative integer, optional)
- Is used for pagination. It is recommnded to set it as multiple of 30 000.
+ Response 200 (application/hal+json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"lightnings":[
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"NOWCAST",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4500,
"location":[
9.6345,
19.3064
]
},
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"ENGLN",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4700,
"location":[
8.6345,
20.3064
]
},
{
"provider": "NOWCAST",
"occurredAt": "2017-01-05T12:20:14.974Z",
"elevationInKilometers": 0,
"lightningType": "CLOUD_TO_GROUND",
"currentInAmpere": -3500,
"location": [
9.3345,
19.7064
]
}
],
"lightningsTotal": 164256,
"lightningsInResponse": 30000,
"_links": {
"self": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=60000&locationWithin=[-180,90],[180,-90]"
},
"next": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=90000&locationWithin=[-180,90],[180,-90]"
}
}
}
#
# Weighted Lightning
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}]
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z&occurredUntil=2017-01-05T12:21:15Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]
##### Limitation
Since AWS API Gatewey has maximum response time 30 seconds and a Lambda instance can allocate no more than 1.5Gb RAM it is impossible to process a really huge amount of lightning events. Therefore at most 200 000 first lightnings are being taken into account.
### Observed weighted lightning for a given boundingBox, time period, weighted by time span and spatial resolution
This resource provides data from existing lightning observation providers: NOWCAST and ENGLN.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ temporalResolution: 'PT15M, PT5M, PT1M' in minutes(string required)
- time span interval in which lightning should be weighted
+ spatialResolution '0.5, 0.25, 0.05' degree(string required)
- spatial resolution within which lightning should be weighted
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ Response 200 (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"weightedLightnings": [{
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 8000,
"weightedLocation": [9.5033, 19.4814],
"numberOfLightnings": 2,
"temporalResolution": "PT15M",
"region": [[9.25, 19.75], [9.75, 19.25]],
"weightedOccurrence": "2017-01-05T12:20:47.000Z"
}, {
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 4700,
"weightedLocation": [8.6345, 20.3064],
"numberOfLightnings": 1,
"temporalResolution": "PT15M",
"region": [[8.25, 20.75], [8.75, 20.25]],
"weightedOccurrence": "2017-01-05T12:21:14.000Z"
}
]
}
#
|
FORMAT: 1A
Weather API
=============================
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `lightning`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials with http basic auth).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**lightning** is the scope which allows to request Lightning Service.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
# Group Lightning
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}&startPosition={startPosition}]
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z&occurredUntil=2017-01-05T12:21:15Z&startPosition=30000
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]
##### Limitation
Due to some technical constraints, the response payload size is limited to max. 6MB - this is equivalent to ca. 30000 lightning events. If there are more than 30000 results in storage which comply to the search criteria, they can be retrieved using pagination.
In such case the response payload contains [HAL](http://stateless.co/hal_specification.html)-compatible `_link` object which contains links to the next page and the response type is application/hal+json.
If locationWithin is worldwide [-180, 90][180, -90] and occurrence ~3 days
### Observed lightning for a given boundingBox and time period
This resource provides data from existing lightning observation providers.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ provider: `ENGLN,NOWCAST` (string, required)
- lightning providers.
+ startPosition: `60000` (not negative integer, optional)
- Is used for pagination. It is recommnded to set it as multiple of 30 000.
+ Response 200 (application/hal+json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"lightnings":[
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"NOWCAST",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4500,
"location":[
9.6345,
19.3064
]
},
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"ENGLN",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4700,
"location":[
8.6345,
20.3064
]
},
{
"provider": "NOWCAST",
"occurredAt": "2017-01-05T12:20:14.974Z",
"elevationInKilometers": 0,
"lightningType": "CLOUD_TO_GROUND",
"currentInAmpere": -3500,
"location": [
9.3345,
19.7064
]
}
],
"lightningsTotal": 164256,
"lightningsInResponse": 30000,
"_links": {
"self": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=60000&locationWithin=[-180,90],[180,-90]"
},
"next": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=90000&locationWithin=[-180,90],[180,-90]"
}
}
}
#
# Weighted Lightning
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}]
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z&occurredUntil=2017-01-05T12:21:15Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]
### Observed weighted lightning for a given boundingBox, time period, weighted by time span and spatial resolution
This resource provides data from existing lightning observation providers: NOWCAST and ENGLN.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ temporalResolution: 'PT15M, PT5M, PT1M' in minutes(string required)
- time span interval in which lightning should be weighted
+ spatialResolution '0.5, 0.25, 0.05' degree(string required)
- spatial resolution within which lightning should be weighted
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ Response 200 (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"weightedLightnings": [{
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 8000,
"weightedLocation": [9.5033, 19.4814],
"numberOfLightnings": 2,
"temporalResolution": "PT15M",
"region": [[9.25, 19.75], [9.75, 19.25]],
"weightedOccurrence": "2017-01-05T12:20:47.000Z"
}, {
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 4700,
"weightedLocation": [8.6345, 20.3064],
"numberOfLightnings": 1,
"temporalResolution": "PT15M",
"region": [[8.25, 20.75], [8.75, 20.25]],
"weightedOccurrence": "2017-01-05T12:21:14.000Z"
}
]
}
#
|
Update LIGHTNING-API-BLUEPRINT.apib
|
Update LIGHTNING-API-BLUEPRINT.apib
Removed references on API Gateway limitation
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
94752e9bd3322afa6acf29e1f404ceea18a74ee4
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://tidepool.io
# tidepool-user-api
The Tidepool User API is used to manage the user login information and pretty much nothing else.
Temporarily, it also manages sessions. That will change.
The apiary page is [here](http://docs.tidepooluserapi.apiary.io/).
# Group User
User related resources of the **User API**
## Status [/status]
### Retrieve status information [GET]
Returns a status health check with a list of status of its dependencies
+ Response 200
If the server is operating properly and all dependencies are up and running.
{
"up" : [ "mongo" ],
"down" : []
}
+ Response 500
If the server is *not* operating properly and one or more dependencies
have failed to start or are no longer running.
{
"up" : [],
"down" : [ "mongo" ]
}
## Testing Status [/status/{statusvalue}]
### Retrieve status information [GET]
Returns whatever status it was sent as a parameter
+ Parameters
+ statusvalue (required, integer, `404`) ... The return code you want from the status call
+ Response 404
## Login [/login]
### Log in an existing user [POST]
+ Request
+ Headers
X-Tidepool-UserID: blipuser
X-Tidepool-Password: my_1337_password
+ Response 200 (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected],
"emails" : [ "[email protected]" ]
}
+ Response 401
When the username/password combination fails.
### Refresh a session token [GET]
This call takes a token, and if the token was still valid, issues
a new (different) token; it also returns the userid in the body. This may
be a bad idea.
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Headers
x-tidepool-session-token : 1324234234.adfa234.123ad34
+ Body
{
"userid": "123123abcd",
}
+ Response 401
When the token is invalid.
+ Response 404
When the token is not provided.
## Logout [/logout]
### Log out from an existing session [POST]
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200
+ Response 401
When the token is invalid or not provided or has expired.
## User records [/user]
### Retrieve current user's info [GET]
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected],
"emails" : [ "[email protected]" ]
}
+ Response 401
When the token is invalid or not provided.
### Create a user [POST]
+ Request (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"username": "[email protected]",
"emails" : [ "[email protected]" ],
"password" : "secret"
}
+ Response 201 (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected]",
"emails" : [ "[email protected]" ]
}
+ Response 400
When the body information is invalid (usually because something
is not unique)
+ Response 401
When the token is invalid or not provided.
## User info for another user [/user/{userid}]
### Retrieve other user's info [GET]
+ Parameters
+ userid (required, string, `123123abcd`) ... Tidepool-assigned user ID
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Body
{
"userid": userid,
"username": "[email protected]",
"emails" : [ "[email protected]" ]
}
+ Response 401
When the token is invalid or not provided.
+ Response 404
When the userid was not found.
|
FORMAT: 1A
HOST: http://tidepool.io
# tidepool-user-api
The Tidepool User API is used to manage the user login information and pretty much nothing else.
Temporarily, it also manages sessions. That will change.
The apiary page is [here](http://docs.tidepooluserapi.apiary.io/).
# Group User
User related resources of the **User API**
## Status [/status]
### Retrieve status information [GET]
Returns a status health check with a list of status of its dependencies
+ Response 200
If the server is operating properly and all dependencies are up and running.
{
"up" : [ "mongo" ],
"down" : []
}
+ Response 500
If the server is *not* operating properly and one or more dependencies
have failed to start or are no longer running.
{
"up" : [],
"down" : [ "mongo" ]
}
## Testing Status [/status/{statusvalue}]
### Retrieve status information [GET]
Returns whatever status it was sent as a parameter
+ Parameters
+ statusvalue (required, integer, `404`) ... The return code you want from the status call
+ Response 404
## Login [/login]
### Log in an existing user [POST]
+ Request
+ Headers
X-Tidepool-UserID: blipuser
X-Tidepool-Password: my_1337_password
+ Response 200 (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected],
"emails" : [ "[email protected]" ]
}
+ Response 401
When the username/password combination fails.
## Machine Login [/serverlogin]
### Log in an existing user [POST]
+ Request
+ Headers
X-Tidepool-Server-Name: OtherServer
X-Tidepool-Server-Secret: serversharedsecret
+ Response 200 (application/json)
+ Headers
x-tidepool-session-token : 66sadf99.123adf840.aasd90JKj
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected],
"emails" : [ "[email protected]" ]
}
+ Response 401
When the servername/secret combination fails.
+ Response 400
When the login info is improperly set up or not supported by this installation
### Refresh a session token [GET]
This call takes a token, and if the token was still valid, issues
a new (different) token; it also returns the userid in the body. This may
be a bad idea.
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Headers
x-tidepool-session-token : 1324234234.adfa234.123ad34
+ Body
{
"userid": "123123abcd",
}
+ Response 401
When the token is invalid.
+ Response 404
When the token is not provided.
## Logout [/logout]
### Log out from an existing session [POST]
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200
+ Response 401
When the token is invalid or not provided or has expired.
## User records [/user]
### Retrieve current user's info [GET]
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected],
"emails" : [ "[email protected]" ]
}
+ Response 401
When the token is invalid or not provided.
### Create a user [POST]
+ Request (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"username": "[email protected]",
"emails" : [ "[email protected]" ],
"password" : "secret"
}
+ Response 201 (application/json)
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Body
{
"userid": "ebe58036a5",
"username": "[email protected]",
"emails" : [ "[email protected]" ]
}
+ Response 400
When the body information is invalid (usually because something
is not unique)
+ Response 401
When the token is invalid or not provided.
## User info for another user [/user/{userid}]
### Retrieve other user's info [GET]
+ Parameters
+ userid (required, string, `123123abcd`) ... Tidepool-assigned user ID
+ Request
+ Headers
x-tidepool-session-token : 23sadf87.123840.aasd90JKj
+ Response 200 (application/json)
+ Body
{
"userid": userid,
"username": "[email protected]",
"emails" : [ "[email protected]" ]
}
+ Response 401
When the token is invalid or not provided.
+ Response 404
When the userid was not found.
|
Add information on serverLogin
|
Add information on serverLogin
|
API Blueprint
|
bsd-2-clause
|
tidepool-org/user-api,tidepool-org/user-api
|
980e7a733719df29cd103f6b248ca29de534ce9d
|
apiary.apib
|
apiary.apib
|
HOST: http://www.google.com/
--- OpenBookPrices ---
---
Welcome to the our sample API documentation. All comments can be written in (support [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax)
---
--
Shopping Cart Resources
The following is a section of resources related to the shopping cart
--
List products added into your shopping-cart. (comment block again in Markdown)
GET /shopping-cart
< 200
< Content-Type: application/json
{ "items": [
{ "url": "/shopping-cart/1", "product":"2ZY48XPZ", "quantity": 1, "name": "New socks", "price": 1.25 }
] }
Save new products in your shopping cart
POST /shopping-cart
> Content-Type: application/json
{ "product":"1AB23ORM", "quantity": 2 }
< 201
< Content-Type: application/json
{ "status": "created", "url": "/shopping-cart/2" }
-- Payment Resources --
This resource allows you to submit payment information to process your *shopping cart* items
POST /payment
{ "cc": "12345678900", "cvc": "123", "expiry": "0112" }
< 200
{ "receipt": "/payment/receipt/1" }
|
HOST: http://api.openbookprices.com/
--- OpenBookPrices ---
---
Welcome to the our sample API documentation. All comments can be written in (support [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax)
---
--
Shopping Cart Resources
The following is a section of resources related to the shopping cart
--
Echo back your own request
GET /echo
< 200
< Content-Type: application/json
{
"timestamp": 1381509290.302,
"request": {
"method": "GET",
"secure": false,
"protocol": "http",
"host": "app.openbookprices.com",
"subdomains": [
"app"
],
"url": "/",
"originalUrl": "/echo",
"path": "/",
"query": {}
},
"network": {
"ip": "91.235.56.121",
"ips": [
"91.235.56.121"
]
},
"headers": {
"host": "app.openbookprices.com",
"user-agent": "Amazon CloudFront",
"via": "1.0 678cdeea3c67419b8e71d6490af123a1.cloudfront.net (CloudFront)",
"connection": "Keep-Alive",
"x-amz-cf-id": "z034Ur0Ub-101_73fuPLKM9wHp-8-ni3qjtRCcA0DdGHpYPtV5Yl0A==",
"x-forwarded-for": "91.235.56.121",
"accept-encoding": "gzip",
"cache-control": ""
}
}
|
Add echo to API blueprint
|
Add echo to API blueprint
|
API Blueprint
|
agpl-3.0
|
OpenBookPrices/openbookprices-api
|
674c7106a7eb2e3efb00d726f70b106eb752c208
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
# Room 101 Agent
The Agent API controls the lifecycle of builds and jobs running on a worker.
# Group Build
A Build is a unique object for a given source location and identifier.
## Build [/builds/{guid}]
A single Build.
+ Parameters
+ guid (required, string, `abc123`) ... `guid` of the Build to view.
+ Model (application/json)
+ Body
{
// Unique identifier for this build. If not given, the agent will generate
// one.
"guid": "abc123",
"source": {
// The type of remote location.
//
// One of: git, hg, bzr, raw
"type": "git",
// The URI from which the source can be fetched.
//
// For `raw` type, this must be a URL to a `.zip` or `.tar.gz` file.
"uri": "https://github.com/foo/bar.git",
// The ref from the repository to build.
//
// This is only required for repositories.
"ref": "deadbeef"
}
}
### Retrieve a Single Build [GET]
+ Response 200
[Build][]
### Remove a Build [DELETE]
+ Response 204
## Builds Collection [/builds]
### Create a Build [POST]
+ Request (application/json)
{
"guid": "abc123",
"source": {
"type": "git",
"uri": "https://github.com/foo/bar.git",
"ref": "deadbeef"
}
}
+ Response 201 (application/json)
[Build][]
# Group Job
A Job is a particular execution of a build's source.
## Job [/builds/{guid}/jobs/{id}]
A single Job.
+ Parameters
+ guid (required, string, `abc123`) ... `guid` of the Build to which the Job belongs.
+ id (required, numeric, `1`) ... `id` of the Job.
+ Model (application/json)
+ Body
{
// ID of the job. Starts at 1 and increments as
// jobs are added to a Build.
"id": 1,
// One of 'running', 'succeeded', 'failed', or 'errored'.
"state": "completed",
// Parameters to provide for the job.
"parameters": {
"FOO": "bar"
},
// Parameters to provide and censor from the output.
//
// Not provided to jobs from pull-requests.
"secure_parameters": {
"SECRET": "12345"
}
}
### Retrieve a Single Job [GET]
+ Response 200
[Job][]
### Remove a Job [DELETE]
+ Response 204
## Jobs Collection [/builds/{guid}/jobs]
+ Parameters
+ guid (required, string, `abc123`) ... `guid` of the Build to which the Job belongs.
+ Model (application/json)
+ Body
[
{
"id": 1,
"state": "succeeded",
"parameters": {
"FOO": "bar"
},
"secure_parameters": {
"SECRET": "12345"
}
},
{
"id": 2,
"state": "running",
"parameters": {
"FOO": "buzz"
},
"secure_parameters": {
"SECRET": "12345"
}
}
]
### List all Jobs [GET]
+ Response 200 (application/json)
[Jobs Collection][]
### Create a Job [POST]
+ Request (application/json)
{
"parameters": {
"FOO": "bar"
},
"secure_parameters": {
"SECRET": "12345"
}
}
+ Response 201 (application/json)
[Job][]
|
FORMAT: 1A
# Room 101 Agent
The Agent API controls the lifecycle of builds and jobs running on a worker.
# Group Build
A Build is an object that, when created, starts executing a build of the given
source location, controlled by the Agent that accepted the request.
## Build [/builds/{guid}]
+ Parameters
+ guid (required, string, `abc123`) ... `guid` of the Build to view.
+ Model (application/json)
+ Body
{
// Unique identifier for this build.
"guid": "abc123",
// URL to notify upon completion.
"callback": "http://example.com/builds/abc123",
// Location to fetch the bits from.
"source": {
// The type of remote location.
//
// One of: git, hg, bzr, raw
"type": "git",
// The URI from which the source can be fetched.
//
// For `raw` type, this must be a URL to a `.zip` or `.tar.gz` file.
"uri": "https://github.com/foo/bar.git",
// The ref from the repository to build.
//
// This is only required for repositories.
"ref": "deadbeef"
}
// Parameters to provide for the job.
"parameters": {
"FOO": "bar"
},
// Parameters to provide and censor from the output.
//
// Not provided to jobs from pull-requests.
"secure_parameters": {
"SECRET": "12345"
},
// State of the build.
//
// One of running, succeeded, failed, or errored.
"state": "running"
}
### Retrieve a Single Build [GET]
A Build can be inspected as long as it's running. Once the build completes it
will go away. Do not use [GET] to poll for the resulting `state` as you may
miss the transition: instead set up a `callback` URL.
+ Response 200
[Build][]
### Remove a Build [DELETE]
Deleting a Build cancels any running actions.
If the build is not running on this agent, a `503` error will be returned.
+ Response 204
+ Response 503
## Builds Collection [/builds]
Creating a build starts it immediately.
When the build completes, the given callback will receive a `PUT` with the
Build as the message body.
The callback URL must be idempotent.
### Create a Build [POST]
+ Request (application/json)
{
"guid": "abc123",
"callback": "http://example.com/builds/abc123",
"source": {
"type": "git",
"uri": "https://github.com/foo/bar.git",
"ref": "deadbeef"
}
"parameters": {
"FOO": "bar"
},
"secure_parameters": {
"SECRET": "12345"
}
}
+ Response 201 (application/json)
[Build][]
+ Response 503
[Build][]
+ Response 200
|
unify Build and Job, add callback URL
|
unify Build and Job, add callback URL
The API of the Agent no longer implies having a persistent database. Instead
clients provide their own GUID and their own callback URL. The Build lifecycle
is ephemeral.
|
API Blueprint
|
apache-2.0
|
concourse/turbine
|
5748b1037e01defc4497ac4d4b530ca05c47718f
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
## Category [/{locale}/category/{id}]
A single category with its children
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `mortgages-and-buying-property`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"content":[{
"url":"/categories/setting-up-home",
"type":"category",
"title":"Setting up home",
"id":"setting-up-home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"url":"/content/guides/how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"id":"how-much-rent-can-you-afford",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you’ve moved in"
}]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
**Money Advice Service** catgeories and their contents.
## Category [/{locale}/category/{id}]
A single category with its children
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `mortgages-and-buying-property`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"content":[{
"url":"/categories/setting-up-home",
"type":"category",
"title":"Setting up home",
"id":"setting-up-home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"url":"/content/guides/how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"id":"how-much-rent-can-you-afford",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you’ve moved in"
}]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
Add description to API blueprint category group
|
Add description to API blueprint category group
|
API Blueprint
|
mit
|
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
|
7b3da11f5baf5ea8080b675aedc140888ff6bc29
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://gbptm-api-stage.herokuapp.com/api
# Great British Public Toilet Map
The GBPTM API is a service for collection, submission and discovery of Public Toilets in the UK
# GBPTM API Root [/]
GBPTM API entry point
Offers affordances in the form of HTTP Link headers and HAL content.
## Retrieve Entry Point [GET]
+ Response 200 (application/hal+json)
+ Headers
Link: <http://gbptm-api-stage.herokuapp.com/api/>;rel="self",<http:gbptm-api-stage.herokuapp.com/api/loos/>;rel="loos"
+ Body
{
"_links": {
"self": { "href": "/" },
"loos": { "href": "/loos" }
}
}
# Group Loos
Loos related resources of the **GBPTM API**
## Loos Collection [/loos]
### List all Loos [GET]
+ Response 200 (application/json)
[{
"id": 1, "name": "Loo 1"
}, {
"id": 2, "name": "Loo 2"
}]
|
FORMAT: 1A
HOST: http://gbptm-api-stage.herokuapp.com/api
# Great British Public Toilet Map
The GBPTM API is a service for collection, submission and discovery of Public Toilets in the UK
# GBPTM API Root [/]
GBPTM API entry point
Offers affordances in the form of HTTP Link headers and HAL content.
## Retrieve Entry Point [GET]
+ Response 200 (application/hal+json)
+ Headers
Link: <http://gbptm-api-stage.herokuapp.com/api/>;rel="self",<http:gbptm-api-stage.herokuapp.com/api/loos/>;rel="loos"
+ Body
{
"_links": {
"self": { "href": "/" },
"loos": { "href": "/loos" }
}
}
# Group Loos
Loos related resources of the **GBPTM API**
## Loos Collection [/loos]
### List all Loos [GET]
+ Response 200 (application/json)
[{
"id": 1, "name": "Loo 1"
}, {
"id": 2, "name": "Loo 2"
}]
|
indent for apiary
|
indent for apiary
|
API Blueprint
|
mit
|
neontribe/gbptm,jimhbanks/gbptm,neontribe/gbptm,neontribe/gbptm
|
b1eaa1168994a5f1218849e898cef1bca8815ae7
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
**Money Advice Service** catgeories and their contents.
## Category [/{locale}/category/{id}]
A single category with its children
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `mortgages-and-buying-property`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"content":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you’ve moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
**Money Advice Service** catgeories and their contents.
## Category [/{locale}/category/{id}]
A single category with its content
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Category.
+ Values
+ `en`
+ `cy`
+ id (required, string, `mortgages-and-buying-property`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"content":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you’ve moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
Fix typos in API blueprint category group
|
Fix typos in API blueprint category group
|
API Blueprint
|
mit
|
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
|
87fd5c7a854fb43feea8c50ef565067b574189fa
|
doc/apiary/iotagent.apib
|
doc/apiary/iotagent.apib
|
FORMAT: 1A
HOST: http://idas.lab.fiware.org
TITLE: FIWARE IoT Agents API
DATE: December 2016
VERSION: stable
APIARY_PROJECT: telefonicaiotiotagents
SPEC_URL: https://telefonicaid.github.io/iotagent-node-lib/api/
GITHUB_SOURCE: https://github.com/telefonicaid/iotagent-node-lib
## Copyright
Copyright (c) 2014-2016 Telefonica Investigacion y Desarrollo
## License
This specification is licensed under the
[FIWARE Open Specification License (implicit patent license)](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Implicit_Patents_License).
# IoT Agent Provision API Documentacion
An [IoT Agent](https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus) is a component that mediates between a set of Devices using their own native protocols and a NGSI compliant Context Provider (i.e. Fiware Context Broker).
This documentation covers the IoT Agent Provision API and the resources you can manipulate on an IoT Agent in order to publish custom information in IoT Platform. The IoT Agent Provision API is based on REST principles.
|Allowed HTTPs requests | |
|:---------------------------|:----------------------------------------|
|POST: |Creates a resource or list of resources |
|PUT: |Updates a resource |
|GET: |Retrieves a resource or list of resources|
|DELETE: |Delete a resource |
|Server Responses | |
|:---------------------------|:--------------------------------------------------------------------------------------------------|
|200 OK |The request was succesful (some API calls may return 201 instead) |
|201 Created |The request was succesful and a resource or list of resources was created |
|204 No Content |The request was succesful but there is no representation to return (that is, the response is empty)|
|400 Bad Request |The request could not be understood or was missing required parameters |
|401 Unauthorized |Authentication failed |
|403 Forbidden |Access denied |
|404 Not Found |Resource was not found |
|409 Conflict |A resource cannot be created because it already exists |
|500 Internal Server Error |Generic error when server has a malfunction. This error will be removed |
Responses related with authentication and authorization depends on this feature is configured and a Keystone OpenStack sytem is present.
When an error is returned, a representation is returned as:
```
{
"reason": "contains why an error is returned",
"details": "contains specific information about the error, if possible"
}
```
## Authentication and Authorization
If the IoT Agent is in authenticated environment, this API requires a token, which you obtain from authentication system. This system and its API is out of scope of present documentation. In this environment, a mandatory header is needed: `X-Auth-Token`.
## Mandatory HTTP Headers
The API needs two headers in order to manage requests:
|Http Header |Level |If not present |Observations |
|:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------|
|<b>Fiware-Service</b> |Represents a tenant. Higher level in resources hierachy in IoT Platform |An error is returned |Must only contain less than 50 Underscores and Alphanumeric lowercase characters |
|<b>Fiware-ServicePath</b> |Represents the second level |We assume '/'. Allowed operation '/*'|Must only contain less than 50 Underscores and Alphanumeric characters. Must start with character '/'. Max. length is 51 characters (with /)|
## API Access
All API base URLs are relative and depend on where the IoT Agent is listening (depends on each service).
For example, `http://127.0.0.1:8080/iot/`.
# Configuration Group API
## Services [/services{?limit,offset,resource,apikey,device}]
Configuration group for iotagents.
Fields in JSON object representing a configuration group are:
|Fields in JSON Object | |
|:-----------------------|:------------------------------------------------------------|
|`apikey` |It is a key used for devices belonging to this service. If "", service does not use apikey, but it must be specified.|
|`token` |If authentication/authorization system is configured, IoT Agent works as user when it publishes information. That token allows that other components to verify the identity of IoT Agent. Depends on authentication and authorization system.|
|`cbroker` |Context Broker endpoint assigned to this service, it must be a real uri.|
|`outgoing_route` |It is an identifier for VPN/GRE tunnel. It is used when device is into a VPN and a command is sent.|
|`resource` |Path in IoTAgent. When protocol is HTTP a device could send information to this uri. In general, it is a uri in a HTTP server needed to load and execute a module.|
|`entity_type` |Entity type used in entity publication (overload default).|
|`attributes` |Mapping for protocol parameters to entity attributes.<br> `object_id` (string, mandatory): protocol parameter to be mapped.<br> `name` (string, mandatory): attribute name to publish.<br> `type`: (string, mandatory): attribute type to publish.|
|`static_attributes` |Attributes published as defined.<br> `name` (string, mandatory): attribute name to publish.<br> `type` (string, mandatory): attribute type to publish.<br> `value` (string, mandatory): attribute value to publish.|
| `timestamp`. |(optional, boolean): This filed indicates if a attribute 'TimeInstant' will be added (true) or not (false). Otherwise IotAgent configuration timestamp configuration will be used.|
| `autoprovision`. |(optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.|
Mandatory fields are identified in every operation.
`static_attributes` and `attributes` are used if device has not this information.
### Retrieve a configuration group [GET]
Retrieve a configuration group.
+ Parameters [limit, offset, resource]
+ `limit` (optional, number). In order to specify the maximum number of services (default is 20, maximun allowed is 1000).
+ `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) .
+ `resource` (optional, string). URI for the iotagent, return only services for this iotagent.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /*
+ Response 200
+ Body
{
"count": 1,
"services": [
{
"apikey": "apikey3",
"service": "service2",
"service_path": "/srvpath2",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"count": 1,
"services": [
{
"apikey": "apikey3",
"service": "service2",
"service_path": "/srvpath2",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
### Create a configuration group [POST]
Create a new configuration group. From service model, mandatory fields are: apikey, resource (cbroker field is temporary mandatory).
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"services": [
{
"apikey": "apikey3",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
+ Response 201
### Update a configuration group [PUT]
If you want modify only a field, you can do it. You cannot modify an element into an array field, but whole array. ("/*" is not allowed).
+ Parameters [apikey, resource]
+ `apikey` (optional, string). If you don't specify, apikey=" " is applied.
+ `resource` (mandatory, string). URI for service into iotagent.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"entity_type": "entity_type"
}
+ Response 204
### Remove a configuration group [DELETE]
Remove a configuration group.
+ Parameters [apikey, resource, device]
+ `apikey` (optional, string). If you don't specify, apikey="" is applied.
+ `resource` (mandatory, string). URI for service into iotagent.
+ `device` (optional, boolean). Default value is false. Remove devices in service/subservice. This parameter is not valid when Fiware-ServicePath is '/*' or '/#'.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 204
## Devices [/devices{?limit,offset,detailed,protocol,entity}]
A device is a resource that publish information to IoT Platform and it uses the IoT Agent.
### Device Model
- `device_id`. Unique identifier into a service.
- `protocol`. Protocol assigned to device. This field is easily provided by IoTA Manager if it is used. Every module implmenting a protocol has an identifier.
- `entity_name`. Entity name used for entity publication (overload default)
- `entity_type`. Entity type used for entity publication (overload entity_type defined in service).
- `timezone`. Used to automatically generate timestamps attributes for the entity publication.
- `attributes`. Mapping for protocol parameters to entity attributes.
`object_id` (string, mandatory): protocol parameter to be mapped.
`name` (string, mandatory): attribute name to publish.
`type`: (string, mandatory): attribute type to publish.
- `static_attributes` (optional, array). Attributes published as defined.
`name` (string, mandatory): attribute name to publish.
`type` (string, mandatory): attribute type to publish.
`value` (string, mandatory): attribute value to publish.
- `endpoint` (optional, string): when a device uses push commands.
- `commands` (optional, array). Attributes working as commands.
`name` (string, mandatory): command identifier.
`type` (string, mandatory). It must be 'command'.
`value` (string, mandatory): command representation depends on protocol.
- `timestamp`. (optional, boolean): This filed indicates if a attribute 'TimeInstant' will be added (true) or not (false). Otherwise IotAgent configuration timestamp configuration will be used.
- `autoprovision`. (optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.
Mandatory fields are identified in every operation.
### Retrieve all devices [GET]
+ Parameters [limit, offset, detailed, entity, protocol]
+ `limit` (optional, number). In order to specify the maximum number of devices (default is 20, maximun allowed is 1000).
+ `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) .
+ `detailed` (optional, string). `on` return all device information, `off` (default) return only name.
+ `entity` (optional, string). It allows get a device from entity name.
+ `protocol` (optional, string). It allows get devices with this protocol.
+ Request (application/json)
+ Headers
Fiware-Service: testService
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"count": 1,
"devices": [
{
"device_id": "device_id",
"protocol": "12345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
]
}
### Create a device [POST]
From device model, mandatory fields are: device_id and protocol.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"devices": [
{
"device_id": "device_id",
"protocol": "12345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
]
}
+ Response 201
+ Headers (only if ONE device is in request)
Location: /iot/devices/device_id
+ Response 400
{
"reason": "parameter limit must be an integer"
}
+ Response 404
## Device [/devices/{device_id}]
### Retrieve a device [GET]
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"device_id": "device_id",
"protocol": "121345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
### Update a device [PUT]
If you want modify only a field, you can do it, except field `protocol` (this field, if provided it is removed from request).
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"entity_name": "entity_name"
}
+ Response 204
### Remove a device [DELETE]
If specific device is not found, we work as deleted.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 204
|
FORMAT: 1A
HOST: http://idas.lab.fiware.org
TITLE: FIWARE IoT Agents API
DATE: December 2016
VERSION: stable
APIARY_PROJECT: telefonicaiotiotagents
SPEC_URL: https://telefonicaid.github.io/iotagent-node-lib/api/
GITHUB_SOURCE: https://github.com/telefonicaid/iotagent-node-lib
## Copyright
Copyright (c) 2014-2016 Telefonica Investigacion y Desarrollo
## License
This specification is licensed under the
[FIWARE Open Specification License (implicit patent license)](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Implicit_Patents_License).
# IoT Agent Provision API Documentacion
An [IoT Agent](https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus) is a component that mediates between a set of Devices using their own native protocols and a NGSI compliant Context Provider (i.e. Fiware Context Broker).
This documentation covers the IoT Agent Provision API and the resources you can manipulate on an IoT Agent in order to publish custom information in IoT Platform. The IoT Agent Provision API is based on REST principles.
|Allowed HTTPs requests | |
|:---------------------------|:----------------------------------------|
|POST: |Creates a resource or list of resources |
|PUT: |Updates a resource |
|GET: |Retrieves a resource or list of resources|
|DELETE: |Delete a resource |
|Server Responses | |
|:---------------------------|:--------------------------------------------------------------------------------------------------|
|200 OK |The request was succesful (some API calls may return 201 instead) |
|201 Created |The request was succesful and a resource or list of resources was created |
|204 No Content |The request was succesful but there is no representation to return (that is, the response is empty)|
|400 Bad Request |The request could not be understood or was missing required parameters |
|401 Unauthorized |Authentication failed |
|403 Forbidden |Access denied |
|404 Not Found |Resource was not found |
|409 Conflict |A resource cannot be created because it already exists |
|500 Internal Server Error |Generic error when server has a malfunction. This error will be removed |
Responses related with authentication and authorization depends on this feature is configured and a Keystone OpenStack sytem is present.
When an error is returned, a representation is returned as:
```
{
"reason": "contains why an error is returned",
"details": "contains specific information about the error, if possible"
}
```
## Authentication and Authorization
If the IoT Agent is in authenticated environment, this API requires a token, which you obtain from authentication system. This system and its API is out of scope of present documentation. In this environment, a mandatory header is needed: `X-Auth-Token`.
## Mandatory HTTP Headers
The API needs two headers in order to manage requests:
|Http Header |Level |If not present |Observations |
|:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------|
|<b>Fiware-Service</b> |Represents a tenant. Higher level in resources hierachy in IoT Platform |An error is returned |Must only contain less than 50 Underscores and Alphanumeric lowercase characters |
|<b>Fiware-ServicePath</b> |Represents the second level |We assume '/'. Allowed operation '/*'|Must only contain less than 50 Underscores and Alphanumeric characters. Must start with character '/'. Max. length is 51 characters (with /)|
## API Access
All API base URLs are relative and depend on where the IoT Agent is listening (depends on each service).
For example, `http://127.0.0.1:8080/iot/`.
# Configuration Group API
## Services [/services{?limit,offset,resource,apikey,device}]
Configuration group for iotagents.
Fields in JSON object representing a configuration group are:
|Fields in JSON Object | |
|:-----------------------|:------------------------------------------------------------|
|`apikey` |It is a key used for devices belonging to this service. If "", service does not use apikey, but it must be specified.|
|`token` |If authentication/authorization system is configured, IoT Agent works as user when it publishes information. That token allows that other components to verify the identity of IoT Agent. Depends on authentication and authorization system.|
|`cbroker` |Context Broker endpoint assigned to this service, it must be a real uri.|
|`outgoing_route` |It is an identifier for VPN/GRE tunnel. It is used when device is into a VPN and a command is sent.|
|`resource` |Path in IoTAgent. When protocol is HTTP a device could send information to this uri. In general, it is a uri in a HTTP server needed to load and execute a module.|
|`entity_type` |Entity type used in entity publication (overload default).|
|`attributes` |Mapping for protocol parameters to entity attributes.<br> `object_id` (string, mandatory): protocol parameter to be mapped.<br> `name` (string, mandatory): attribute name to publish.<br> `type`: (string, mandatory): attribute type to publish.|
|`static_attributes` |Attributes published as defined.<br> `name` (string, mandatory): attribute name to publish.<br> `type` (string, mandatory): attribute type to publish.<br> `value` (string, mandatory): attribute value to publish.|
| `timestamp`. |(optional, boolean): This field indicates if an attribute 'TimeInstant' will be added (true) or not (false). If this field is omitted, the global IotAgent configuration timestamp will be used.|
| `autoprovision`. |(optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.|
Mandatory fields are identified in every operation.
`static_attributes` and `attributes` are used if device has not this information.
### Retrieve a configuration group [GET]
Retrieve a configuration group.
+ Parameters [limit, offset, resource]
+ `limit` (optional, number). In order to specify the maximum number of services (default is 20, maximun allowed is 1000).
+ `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) .
+ `resource` (optional, string). URI for the iotagent, return only services for this iotagent.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /*
+ Response 200
+ Body
{
"count": 1,
"services": [
{
"apikey": "apikey3",
"service": "service2",
"service_path": "/srvpath2",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"count": 1,
"services": [
{
"apikey": "apikey3",
"service": "service2",
"service_path": "/srvpath2",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
### Create a configuration group [POST]
Create a new configuration group. From service model, mandatory fields are: apikey, resource (cbroker field is temporary mandatory).
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"services": [
{
"apikey": "apikey3",
"token": "token2",
"cbroker": "http://127.0.0.1:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
+ Response 201
### Update a configuration group [PUT]
If you want modify only a field, you can do it. You cannot modify an element into an array field, but whole array. ("/*" is not allowed).
+ Parameters [apikey, resource]
+ `apikey` (optional, string). If you don't specify, apikey=" " is applied.
+ `resource` (mandatory, string). URI for service into iotagent.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"entity_type": "entity_type"
}
+ Response 204
### Remove a configuration group [DELETE]
Remove a configuration group.
+ Parameters [apikey, resource, device]
+ `apikey` (optional, string). If you don't specify, apikey="" is applied.
+ `resource` (mandatory, string). URI for service into iotagent.
+ `device` (optional, boolean). Default value is false. Remove devices in service/subservice. This parameter is not valid when Fiware-ServicePath is '/*' or '/#'.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 204
## Devices [/devices{?limit,offset,detailed,protocol,entity}]
A device is a resource that publish information to IoT Platform and it uses the IoT Agent.
### Device Model
- `device_id`. Unique identifier into a service.
- `protocol`. Protocol assigned to device. This field is easily provided by IoTA Manager if it is used. Every module implmenting a protocol has an identifier.
- `entity_name`. Entity name used for entity publication (overload default)
- `entity_type`. Entity type used for entity publication (overload entity_type defined in service).
- `timezone`. Used to automatically generate timestamps attributes for the entity publication.
- `attributes`. Mapping for protocol parameters to entity attributes.
`object_id` (string, mandatory): protocol parameter to be mapped.
`name` (string, mandatory): attribute name to publish.
`type`: (string, mandatory): attribute type to publish.
- `static_attributes` (optional, array). Attributes published as defined.
`name` (string, mandatory): attribute name to publish.
`type` (string, mandatory): attribute type to publish.
`value` (string, mandatory): attribute value to publish.
- `endpoint` (optional, string): when a device uses push commands.
- `commands` (optional, array). Attributes working as commands.
`name` (string, mandatory): command identifier.
`type` (string, mandatory). It must be 'command'.
`value` (string, mandatory): command representation depends on protocol.
- `timestamp`. (optional, boolean): This filed indicates if a attribute 'TimeInstant' will be added (true) or not (false). Otherwise IotAgent configuration timestamp configuration will be used.
- `autoprovision`. (optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.
Mandatory fields are identified in every operation.
### Retrieve all devices [GET]
+ Parameters [limit, offset, detailed, entity, protocol]
+ `limit` (optional, number). In order to specify the maximum number of devices (default is 20, maximun allowed is 1000).
+ `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) .
+ `detailed` (optional, string). `on` return all device information, `off` (default) return only name.
+ `entity` (optional, string). It allows get a device from entity name.
+ `protocol` (optional, string). It allows get devices with this protocol.
+ Request (application/json)
+ Headers
Fiware-Service: testService
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"count": 1,
"devices": [
{
"device_id": "device_id",
"protocol": "12345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
]
}
### Create a device [POST]
From device model, mandatory fields are: device_id and protocol.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"devices": [
{
"device_id": "device_id",
"protocol": "12345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
]
}
+ Response 201
+ Headers (only if ONE device is in request)
Location: /iot/devices/device_id
+ Response 400
{
"reason": "parameter limit must be an integer"
}
+ Response 404
## Device [/devices/{device_id}]
### Retrieve a device [GET]
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 200
+ Body
{
"device_id": "device_id",
"protocol": "121345",
"entity_name": "entity_name",
"entity_type": "entity_type",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "source_data",
"name": "attr_name",
"type": "int"
}
],
"static_attributes": [
{
"name": "att_name",
"type": "string",
"value": "value"
}
]
}
### Update a device [PUT]
If you want modify only a field, you can do it, except field `protocol` (this field, if provided it is removed from request).
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Body
{
"entity_name": "entity_name"
}
+ Response 204
### Remove a device [DELETE]
If specific device is not found, we work as deleted.
+ Request (application/json)
+ Headers
Fiware-Service: testservice
Fiware-ServicePath: /TestSubservice
+ Response 204
|
Update doc/apiary/iotagent.apib
|
Update doc/apiary/iotagent.apib
Co-Authored-By: Fermín Galán Márquez <a42853be7dd7164f3322943925c40e0cb15f30bb@users.noreply.github.com>
|
API Blueprint
|
agpl-3.0
|
telefonicaid/iotagent-node-lib,telefonicaid/iotagent-node-lib,telefonicaid/iotagent-node-lib
|
bdb34c5642796d630d8308abeb74942f90010b01
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve a Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve a Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Action Plans
Action Plans related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with al lits details
+ Parameters
+locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Rsponse 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby"
"description": "A handy action plan which can help with planning of the costs involved in having a new baby"
"body": "<h4>Why? </h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses. </p>"
}
|
Add Action Plans to API blueprint
|
Add Action Plans to API blueprint
|
API Blueprint
|
mit
|
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
|
93842191efde2559b36e0d227049445f3debe944
|
apiary.apib
|
apiary.apib
|
HOST: http://dcp.jboss.org/v1
--- Distributed Contribution Platform API v1 ---
---
# Overview
**Distributed Contribution Platform** provides **Rest API** for data manipulation and search.
# DCP Content object
This is main content object which can be pushed/retrieved or searched.
DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure.
However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_.
DCP Content described by example:
{
Free JSON Structure repsesenting content. Can be one key value pair or something more structured.
It's defined only by source provider.
"tags": ["Content tag1", "tag2", "tag2"],
"dcp_content_id": "Any value from content provider",
"dcp_content_typev: "Source provider type like 'issue'"
"dcp_content_provider": "Name of content provider like JIRA River"
"dcp_id": "internal_id"
"dcp_title": "Content Title"
"dcp_url_view": "URL representing content view"
"dcp_description": "Short description used by search GUI"
"dcp_type": "Normalized internal type of content"
"dcp_updated": "Timestamp of last update"
"dcp_project": "Normalized internal project"
"dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"]
"dcp_activity_dates": [Timestamp1, Timestamp2]
"dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"]
}
All DCP Internal data are set during push and reindex except these which can be defined during data push:
* `dcp_title`
* `dcp_url_view`
* `dcp_description`
---
--
Authentication
Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication.
If authentication is not successfull then standard forbidden http code is returned.
--
--
Content
--
Return Document JSON data
GET /rest/content/{type}/{id}
< 200
< Content-Type: application/json
{ "foo": "bar" }
All content for specified type.
GET /rest/content/{type}
< 200
< Content-Type: application/json
{
"total": "count of returned values",
"hits": [
{
"id": "internal dcp id of document"
"data": "document content"
}
]
}
JSON document in http body which is pushed to DCP.
Http body empty
POST /rest/content/{type}/{id}
< 200
< Content-Type: application/json
{ "foo": "bar" }
Document deleted
DELETE /rest/content/{type}/{id}
< 200
--
Search
--
Search contributions.
GET /rest/search?TODO
< 200
{ "foo": "bar" }
--
Suggestions
--
Get suggestions for user query.
Returned JSON contains two parts:
- `view`
- `model`
#### view
The `view` represents the visual part of query suggestions.
It *always* contains section `search` which will *always* have only one option matching incoming user query.
It can then contain one or more additional sections (like `suggestions`, `filters`, `mails`, ... etc.).
#### model
The `model` represents possible "actions" that are relevant to individual `option`s in the `view` part.
This means both `view` and `model` parts have the same highlevel structure and each `option`
in the `view` part have corresponding "action" in the `model` part.
Individual actions are described using symbolic commands. Interpretation of these commands is up to the client
the following is just a recommendation about how client can interpret the commands:
##### Commands:
`search` - execute search for `query` value.
`suggestion` - replace text in the search field with the `value`'s value.
`filter` - replace current filters with provided filters.
`filter_add` - enable provided filters (on top of currently active filters).
... more TDB.
GET /rest/suggestions/query_string?q={user_query_string}
< 200
{
"view": {
"search": {
"caption": "Search",
"options": ["${query_string}"]
},
"suggestions": {
"caption": "Query Completions",
"options": [
"option #1",
"option #2",
"..."
]
},
"filters": {
"caption": "Filters",
"options": [
"option #1",
"option #2",
"..."
]
},
"mails": {
"caption": "Mails",
"options": [
"option #1",
"option #2",
"..."
]
}
},
"model" : {
"search": {
"search": { "query": "${query_string}" }
},
"suggestions" : [
{ "action #1": {} },
{ "action #2": {} },
{ }
],
"filters": [
{ "action #1": {} },
{ "action #2": {} },
{ }
],
"mails": [
{ "action #1": {} },
{ "action #2": {} },
{ }
]
}
}
Example for user query 'Hiberna'.
GET /rest/suggestions/query_string?q=Hiberna
< 200
{
"view": {
"search": {
"caption": "Search",
"options": ["Hiberna"]
},
"suggestions": {
"caption": "Query Completions",
"options": [
"<strong>Hiberna</strong>te",
"<strong>Hiberna</strong>te query",
"<strong>Hiberna</strong>te session"
]
},
"filters": {
"caption": "Filters",
"options": [
"<strong>Add</strong> project filter for <strong>Hibernate</strong>",
"<strong>Add</strong> project filter for <strong>Infinispan</strong>",
"<strong>Search</strong> project <strong>Hibernate</strong> only"
]
},
"mails": {
"caption": "Mails",
"options": [
"<strong>Add</strong> some Mails filter",
"Do some other fancy thing here",
"Or do something else"
]
}
},
"model" : {
"search": { "search": { "query": "Hiberna" } },
"suggestions" : [
{ "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } },
{ "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } },
{ "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } }
],
"filters": [
{ "filter_add": [ "Hibernate" ] },
{ "filter_add": [ "Infinispan" ] },
{ "filter": [ "Hibernate" ] }
],
"mails": [
{ "filter_add": [ "foo" ] },
{},
{}
]
}
}
|
HOST: http://dcp.jboss.org/v1
--- Distributed Contribution Platform API v1 ---
---
# Overview
**Distributed Contribution Platform** provides **Rest API** for data manipulation and search.
# DCP Content object
This is main content object which can be pushed/retrieved or searched.
DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure.
However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_.
DCP Content described by example:
{
Free JSON Structure repsesenting content. Can be one key value pair or something more structured.
It's defined only by source provider.
"tags": ["Content tag1", "tag2", "tag2"],
"dcp_content_id": "Any value from content provider",
"dcp_content_typev: "Source provider type like 'issue'"
"dcp_content_provider": "Name of content provider like JIRA River"
"dcp_id": "internal_id"
"dcp_title": "Content Title"
"dcp_url_view": "URL representing content view"
"dcp_description": "Short description used by search GUI"
"dcp_type": "Normalized internal type of content"
"dcp_updated": "Timestamp of last update"
"dcp_project": "Normalized internal project"
"dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"]
"dcp_activity_dates": [Timestamp1, Timestamp2]
"dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"]
}
All DCP Internal data are set during push and reindex except these which can be defined during data push:
* `dcp_title`
* `dcp_url_view`
* `dcp_description`
---
--
Authentication
Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication.
If authentication is not successfull then standard forbidden http code is returned.
--
--
Content
--
Return Document JSON data
GET /rest/content/{type}/{id}
< 200
< Content-Type: application/json
{ "foo": "bar" }
All content for specified type.
GET /rest/content/{type}
< 200
< Content-Type: application/json
{
"total": "count of returned values",
"hits": [
{
"id": "internal dcp id of document"
"data": "document content"
}
]
}
JSON document in http body which is pushed to DCP.
Http body empty
POST /rest/content/{type}/{id}
< 200
< Content-Type: application/json
{ "foo": "bar" }
Document deleted
DELETE /rest/content/{type}/{id}
< 200
--
Search
--
Search contributions.
GET /rest/search?TODO
< 200
{ "foo": "bar" }
--
Suggestions
--
Get suggestions for user query.
Returned JSON contains two parts:
- `view`
- `model`
#### view
The `view` represents the visual part of query suggestions.
It *always* contains section `search` which will *always* have only one option matching incoming user query.
It can then contain one or more additional sections (like `suggestions`, `filters`, `mails`, ... etc.).
#### model
The `model` represents possible "actions" that are relevant to individual `option`s in the `view` part.
This means both `view` and `model` parts have the same highlevel structure and each `option`
in the `view` part have corresponding "action" in the `model` part.
Individual actions are described using symbolic commands. Interpretation of these commands is up to the client
the following is just a recommendation about how client can interpret the commands:
##### Commands:
`search` - execute search for `query` value.
`suggestion` - replace text in the search field with the `value`'s value.
`filter` - replace current filters with provided filters.
`filter_add` - enable provided filters (on top of currently active filters).
... more TDB.
To allow CORS we need to response to `OPTIONS` requests (for more see: <http://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0>). We allow `GET` requests only.
OPTIONS /rest/suggestions/query_string
< 200
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET
GET /rest/suggestions/query_string?q={user_query_string}
< 200
{
"view": {
"search": {
"caption": "Search",
"options": ["${query_string}"]
},
"suggestions": {
"caption": "Query Completions",
"options": [
"option #1",
"option #2",
"..."
]
},
"filters": {
"caption": "Filters",
"options": [
"option #1",
"option #2",
"..."
]
},
"mails": {
"caption": "Mails",
"options": [
"option #1",
"option #2",
"..."
]
}
},
"model" : {
"search": {
"search": { "query": "${query_string}" }
},
"suggestions" : [
{ "action #1": {} },
{ "action #2": {} },
{ }
],
"filters": [
{ "action #1": {} },
{ "action #2": {} },
{ }
],
"mails": [
{ "action #1": {} },
{ "action #2": {} },
{ }
]
}
}
Example for user query 'Hiberna'.
GET /rest/suggestions/query_string?q=Hiberna
< 200
{
"view": {
"search": {
"caption": "Search",
"options": ["Hiberna"]
},
"suggestions": {
"caption": "Query Completions",
"options": [
"<strong>Hiberna</strong>te",
"<strong>Hiberna</strong>te query",
"<strong>Hiberna</strong>te session"
]
},
"filters": {
"caption": "Filters",
"options": [
"<strong>Add</strong> project filter for <strong>Hibernate</strong>",
"<strong>Add</strong> project filter for <strong>Infinispan</strong>",
"<strong>Search</strong> project <strong>Hibernate</strong> only"
]
},
"mails": {
"caption": "Mails",
"options": [
"<strong>Add</strong> some Mails filter",
"Do some other fancy thing here",
"Or do something else"
]
}
},
"model" : {
"search": { "search": { "query": "Hiberna" } },
"suggestions" : [
{ "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } },
{ "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } },
{ "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } }
],
"filters": [
{ "filter_add": [ "Hibernate" ] },
{ "filter_add": [ "Infinispan" ] },
{ "filter": [ "Hibernate" ] }
],
"mails": [
{ "filter_add": [ "foo" ] },
{},
{}
]
}
}
|
add OPTIONS request for suggestions
|
add OPTIONS request for suggestions
|
API Blueprint
|
apache-2.0
|
searchisko/searchisko,searchisko/searchisko,ollyjshaw/searchisko,ollyjshaw/searchisko,ollyjshaw/searchisko,searchisko/searchisko
|
bd202f13b03d3a3661594c2e4ae1fee3bfd18124
|
blueprint/authentication.apib
|
blueprint/authentication.apib
|
FORMAT: 1A
HOST: https://thegrid.io/
# Authentication
The Grid operates an OAuth2 provider that is utilized for all authentication purposes.
### Identity Providers
The Grid's authentication system supports multiple identity providers including:
* GitHub (github)
* Twitter (twitter)
More identity providers are likely to be added later when they are needed. Check back to this document to see the current list.
### Registering an application
The Grid authentication is always granted to the combination of a user and an application. To register an application, log into your The Grid account at https://passport.thegrid.io/account
Go to the Developer Section of your profile page, and you'll be able to add new OAuth2 client applications. You need the following information:
* Application name: name of the application shown to users in the confirmation page
* Callback URL: the URL in your application users should be redirected to once they complete their login
Once you have registered an application you will get two values from the system:
* Application ID: Unique identifier for your application
* Application secret: Passphrase your application can use to convert authentication grants to tokens
**Note:** never let others see your client secret. Otherwise they will be able to impersonate your The Grid application!
### The OAuth dance
When you want to authenticate a user with your The Grid application, you need to first send them to The Grid's login system. For this you need to construct a login URL with the following parts:
* Protocol: https
* Host: passport.thegrid.io
* Path: `/login/authorize/<identity provider (optional, otherwise will show UI to choose provider)>`
* Query:
* `client_id`: the unique identifier of your application
* `response_type`: code
* `scope`: comma-separated list of requested scopes
* `redirect_uri`: your callback URL
Example: <https://passport.thegrid.io/login/authorize/github?client_id=XXXX&response_type=code&scope=share&redirect_uri=http://my.app.url>
#### Authentication scopes
The default authentication scope will grant you permissions to perform simple operations on behalf of the user. If needed, you can also request additional access to The Grid APIs via OAuth2 scopes. The scopes are added to the authentication request URL with the scope query key.
The currently supported scopes include:
* `content_management`: manage user's content items on The Grid
* `website_management`: manage user's The Grid sites and publish to them
* `share`: share new content to The Grid. Also provided by the `content_management` scope
* `update_profile`: update the user's profile information
* `github`: get access to the user's GitHub access token, if any. This will allow you to use the GitHub API on behalf of the user
* `github_private`: get access to the user's GitHub access token authorized to access private repositories, if any. This will allow you to use the GitHub API on behalf of the user
* `payment`: make a payment on behalf of the user
* `balance`: see user's account balance and transaction history
* `cta_management`: manage user's Calls to Action
#### Getting a token
Once the user completes the authentication process and grants your application access to their account, they will be redirected to the redirect_uri.
The redirection will contain an additional query parameter code which contains a one-time access grant.
To convert this access grant to an access token you have to make a HTTP POST request with the following URL:
* Protocol: https
* Host: passport.thegrid.io
* Path: /login/authorize/token
The payload should be a URL-encoded string containing the following key-value pairs:
* `client_id`: the unique identifier of your application
* `client_secret`: your application's passphrase
* `code`: the access grant you received in the query parameter of your callback URL
* `grant_type`: `authorization_code`
On a successful code conversion you will receive a JSON-encoded response with an object that will contain the user's access token in the `access_token` key.
### Making authenticated API requests
The Grid API calls require authentication unless stated otherwise. This is done using the user's access token via HTTP Bearer Authentication. Bearer authentication works by adding the Authorization header to your HTTP requests with the value `Bearer <access token>`.
For example:
```
req.setRequestHeader('Authorization', 'Bearer ' + token);
```
### The Grid authentication on Node.js
The [passport-thegrid](https://www.npmjs.com/package/passport-thegrid) module provides The Grid authentication for [Passport](http://passportjs.org/) enabled Node.js applications.
|
FORMAT: 1A
HOST: https://thegrid.io/
# Authentication
The Grid operates an OAuth2 provider that is utilized for all authentication purposes.
### Identity Providers
The Grid's authentication system supports multiple identity providers including:
* Facebook (facebook)
* GitHub (github)
* Google (google)
* Twitter (twitter)
More identity providers are likely to be added later when they are needed. Check back to this document to see the current list.
### Registering an application
The Grid authentication is always granted to the combination of a user and an application. To register an application, log into your The Grid account at https://passport.thegrid.io/account
Go to the Developer Section of your profile page, and you'll be able to add new OAuth2 client applications. You need the following information:
* Application name: name of the application shown to users in the confirmation page
* Callback URL: the URL in your application users should be redirected to once they complete their login
Once you have registered an application you will get two values from the system:
* Application ID: Unique identifier for your application
* Application secret: Passphrase your application can use to convert authentication grants to tokens
**Note:** never let others see your client secret. Otherwise they will be able to impersonate your The Grid application!
### The OAuth dance
When you want to authenticate a user with your The Grid application, you need to first send them to The Grid's login system. For this you need to construct a login URL with the following parts:
* Protocol: https
* Host: passport.thegrid.io
* Path: `/login/authorize/<identity provider (optional, otherwise will show UI to choose provider)>`
* Query:
* `client_id`: the unique identifier of your application
* `response_type`: code
* `scope`: comma-separated list of requested scopes
* `redirect_uri`: your callback URL
Example: <https://passport.thegrid.io/login/authorize/github?client_id=XXXX&response_type=code&scope=share&redirect_uri=http://my.app.url>
#### Authentication scopes
The default authentication scope will grant you permissions to perform simple operations on behalf of the user. If needed, you can also request additional access to The Grid APIs via OAuth2 scopes. The scopes are added to the authentication request URL with the scope query key.
The currently supported scopes include:
* `content_management`: manage user's content items on The Grid
* `website_management`: manage user's The Grid sites and publish to them
* `share`: share new content to The Grid. Also provided by the `content_management` scope
* `update_profile`: update the user's profile information
* `github`: get access to the user's GitHub access token, if any. This will allow you to use the GitHub API on behalf of the user
* `github_private`: get access to the user's GitHub access token authorized to access private repositories, if any. This will allow you to use the GitHub API on behalf of the user
* `payment`: make a payment on behalf of the user
* `balance`: see user's account balance and transaction history
* `cta_management`: manage user's Calls to Action
#### Getting a token
Once the user completes the authentication process and grants your application access to their account, they will be redirected to the redirect_uri.
The redirection will contain an additional query parameter code which contains a one-time access grant.
To convert this access grant to an access token you have to make a HTTP POST request with the following URL:
* Protocol: https
* Host: passport.thegrid.io
* Path: /login/authorize/token
The payload should be a URL-encoded string containing the following key-value pairs:
* `client_id`: the unique identifier of your application
* `client_secret`: your application's passphrase
* `code`: the access grant you received in the query parameter of your callback URL
* `grant_type`: `authorization_code`
On a successful code conversion you will receive a JSON-encoded response with an object that will contain the user's access token in the `access_token` key.
### Making authenticated API requests
The Grid API calls require authentication unless stated otherwise. This is done using the user's access token via HTTP Bearer Authentication. Bearer authentication works by adding the Authorization header to your HTTP requests with the value `Bearer <access token>`.
For example:
```
req.setRequestHeader('Authorization', 'Bearer ' + token);
```
### The Grid authentication on Node.js
The [passport-thegrid](https://www.npmjs.com/package/passport-thegrid) module provides The Grid authentication for [Passport](http://passportjs.org/) enabled Node.js applications.
|
Document additional auth providers.
|
Document additional auth providers.
|
API Blueprint
|
mit
|
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
|
250fae83789acbbbf2c4b7737d0b2988f9ba6f47
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://owner-api.teslamotors.com
# Tesla Model S JSON API
# ⚠️ ⚠️ ⚠️ ⚠️
# This site has moved! [https://tesla-api.timdorr.com/](https://tesla-api.timdorr.com/)
# ⚠️ ⚠️ ⚠️ ⚠️
This is unofficial documentation of the Tesla Model S JSON API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely.
# Group Authentication
## Tokens [/oauth/token]
### Get an Access Token [POST]
Performs the login. Takes in an plain text email and password, matching the owner's login information for [https://my.teslamotors.com/user/login](https://my.teslamotors.com/user/login).
Returns a `access_token` which is passed along as a header with all future requests to authenticate the user.
You must provide the `Authorization: Bearer {access_token}` header in all other requests.
The current client ID and secret are [available here](http://pastebin.com/YiLPDggh)
+ Attributes
+ grant_type: `password` (string) - The type of oAuth grant. Always "password"
+ client_id: `abc` (string) - The oAuth client ID
+ client_secret: `123` (string) - The oAuth client secret
+ email: `[email protected]` (string) - The email for my.teslamotors.com
+ password: `edisonsux` (string) - The password for my.teslamotors.com
+ Response 200 (application/json)
+ Body
{
"access_token": "abc123",
"token_type": "bearer",
"expires_in": 7776000,
"created_at": 1457385291,
"refresh_token" : "cba321"
}
# Group Vehicles
A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them.
## Vehicle Collection [/api/1/vehicles]
### List all Vehicles [GET]
Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Response 200 (application/json)
+ Body
{
"response": [{
"color": null,
"display_name": null,
"id": 321,
"option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013",
"user_id": 123,
"vehicle_id": 1234567890,
"vin": "5YJSA1CN5CFP01657",
"tokens": ["x", "x"],
"state": "online"
}],
"count":1
}
## State and Settings [/api/1/vehicles/{vehicle_id}]
These resources are read-only and determine the state of the vehicle's various sub-systems.
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
## Mobile Access [GET /api/1/vehicles/{vehicle_id}/mobile_enabled]
Determines if mobile access to the vehicle is enabled.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": true
}
## Charge State [GET /api/1/vehicles/{vehicle_id}/data_request/charge_state]
Returns the state of charge in the battery.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"charging_state": "Complete", // "Charging", ??
"charge_to_max_range": false, // current std/max-range setting
"max_range_charge_counter": 0,
"fast_charger_present": false, // connected to Supercharger?
"battery_range": 239.02, // rated miles
"est_battery_range": 155.79, // range estimated from recent driving
"ideal_battery_range": 275.09, // ideal miles
"battery_level": 91, // integer charge percentage
"battery_current": -0.6, // current flowing into battery
"charge_starting_range": null,
"charge_starting_soc": null,
"charger_voltage": 0, // only has value while charging
"charger_pilot_current": 40, // max current allowed by charger & adapter
"charger_actual_current": 0, // current actually being drawn
"charger_power": 0, // kW (rounded down) of charger
"time_to_full_charge": null, // valid only while charging
"charge_rate": -1.0, // float mi/hr charging or -1 if not charging
"charge_port_door_open": true
}
}
## Climate Settings [GET /api/1/vehicles/{vehicle_id}/data_request/climate_state]
Returns the current temperature and climate control state.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"inside_temp": 17.0, // degC inside car
"outside_temp": 9.5, // degC outside car or null
"driver_temp_setting": 22.6, // degC of driver temperature setpoint
"passenger_temp_setting": 22.6, // degC of passenger temperature setpoint
"is_auto_conditioning_on": false, // apparently even if on
"is_front_defroster_on": null, // null or boolean as integer?
"is_rear_defroster_on": false,
"fan_status": 0 // fan speed 0-6 or null
}
}
## Driving and Position [GET /api/1/vehicles/{vehicle_id}/data_request/drive_state]
Returns the driving and position state of the vehicle.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"shift_state": null, //
"speed": null, //
"latitude": 33.794839, // degrees N of equator
"longitude": -84.401593, // degrees W of the prime meridian
"heading": 4, // integer compass heading, 0-359
"gps_as_of": 1359863204 // Unix timestamp of GPS fix
}
}
## GUI Settings [GET /api/1/vehicles/{vehicle_id}/data_request/gui_settings]
Returns various information about the GUI settings of the car, such as unit format and range display.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"gui_distance_units": "mi/hr",
"gui_temperature_units": "F",
"gui_charge_rate_units": "mi/hr",
"gui_24_hour_time": false,
"gui_range_display": "Rated"
}
}
## Vehicle State [GET /api/1/vehicles/{vehicle_id}/data_request/vehicle_state]
Returns the vehicle's physical state, such as which doors are open.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"df": false, // driver's side front door open
"dr": false, // driver's side rear door open
"pf": false, // passenger's side front door open
"pr": false, // passenger's side rear door open
"ft": false, // front trunk is open
"rt": false, // rear trunk is open
"car_verson": "1.19.42", // car firmware version
"locked": true, // car is locked
"sun_roof_installed": false, // panoramic roof is installed
"sun_roof_state": "unknown",
"sun_roof_percent_open": 0, // null if not installed
"dark_rims": false, // gray rims installed
"wheel_type": "Base19", // wheel type installed
"has_spoiler": false, // spoiler is installed
"roof_color": "Colored", // "None" for panoramic roof
"perf_config": "Base"
}
}
# Group Vehicle Commands
These commands alter the vehicles state, and return result (true/false) to indicate success, and if failure reason contains the cause of failure.
## Wake Up Car [POST /api/1/vehicles/{vehicle_id}/wake_up]
Wakes up the car from the sleep state. Necessary to get some data from the car.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Set Valet Mode [POST /api/1/vehicles/{vehicle_id}/command/set_valet_mode]
Sets valet mode on or off with a PIN to disable it from within the car. Reuses last PIN from previous valet session.
Valet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and
Wifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work
locations in navigation.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ on: true (boolean) - Whether to enable or disable valet mode.
+ password: 1234 (number) - (optional) A 4 digit PIN code to unlock the car.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Reset Valet PIN [POST /api/1/vehicles/{vehicle_id}/command/reset_valet_pin]
Resets the PIN set for valet mode, if set.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Open Charge Port [POST /api/1/vehicles/{vehicle_id}/command/charge_port_door_open]
Opens the charge port. Does not close the charge port (for now...). This endpoint also unlocks the charge port if it's locked.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Set Charge Limit to Standard [POST /api/1/vehicles/{vehicle_id}/command/charge_standard]
Set the charge mode to standard (90% under the new percentage system introduced in 4.5).
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": false,
"reason": "already_standard"
}
}
## Set Charge Limit to Max Range [POST /api/1/vehicles/{vehicle_id}/command/charge_max_range]
Set the charge mode to max range (100% under the new percentage system introduced in 4.5). Use sparingly!
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": false,
"reason": "already_max_range"
}
}
## Set Charge Limit [POST /api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}]
Set the charge limit to a custom percentage.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ limit_value: `75` (number) - The percentage value
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Start Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_start]
Start charging. Must be plugged in, have power available, and not have reached your charge limit.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": "" // "already_started" if a charge is in progress
}
}
## Stop Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_stop]
Stop charging. Must already be charging.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": "" // "not_charging" if a charge was not in progress
}
}
## Flash Lights [POST /api/1/vehicles/{vehicle_id}/command/flash_lights]
Flash the lights once.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Honk Horn [POST /api/1/vehicles/{vehicle_id}/command/honk_horn]
Honk the horn once.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Unlock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_unlock]
Unlock the car's doors.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Lock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_lock]
Lock the car's doors.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Set Temperature [POST /api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_temp}&passenger_temp={passenger_temp}]
Set the temperature target for the HVAC system.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ driver_temp: `23.7` (number) - The desired temperature on the driver's side in celcius.
+ passenger_temp: `18.1` (number) - The desired temperature on the passenger's side in celcius.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Start HVAC System [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_start]
Start the climate control system. Will cool or heat automatically, depending on set temperature.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Stop HVAC System [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop]
Stop the climate control system.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Move Pano Roof [POST /api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}]
Controls the car's panoramic roof, if installed.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ state: `open` (enum[string])
The desired state of the panoramic roof. The approximate percent open values for each state are `open` = 100%, `close` = 0%, `comfort` = 80%, and `vent` = ~15%
+ Members
+ `open` - Open the roof fully
+ `close` - Close the roof completely
+ `comfort` - Open to the comfort (80%) setting
+ `vent` - Open the roof to the vent (~15%) setting
+ `move` - Indicates you will provide a percentage to move the roof.
+ percent: `50` (number, optional) - The percentage to move the roof to.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Remote Start [POST /api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}]
Start the car for keyless driving. Must start driving within 2 minutes of issuing this request.
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ password: `edisonsux` (string) - The password to the authenticated my.teslamotors.com account.
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
## Open Trunk/Frunk [POST /api/1/vehicles/{vehicle_id}/command/trunk_open]
Open the trunk or frunk. Call the endpoint again to close (this only works on rear powered trunks)
+ Request
+ Headers
Authorization: Bearer {access_token}
+ Parameters
+ vehicle_id: `1` (number) - The id of the Vehicle.
+ which_trunk: `rear` (string) - The trunk to open. `rear` and `front` are the only options
+ Response 200 (application/json)
+ Body
{
"response": {
"result": true,
"reason": ""
}
}
|
FORMAT: 1A
HOST: https://owner-api.teslamotors.com
# Tesla Model S JSON API
# ⚠️ ⚠️ ⚠️ ⚠️
# This site has moved! [https://tesla-api.timdorr.com/](https://tesla-api.timdorr.com/)
# ⚠️ ⚠️ ⚠️ ⚠️
|
Clear out the outdated docs now that we've moved to Gitbook.
|
Clear out the outdated docs now that we've moved to Gitbook.
|
API Blueprint
|
mit
|
timdorr/model-s-api
|
850909e0e2c2444fe10f3eca25c880f79eac947e
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://fossilcalibrations.org/api/v1/
# fcdb-api
fcdb-api is a REST interace to the [Fossil Calibrations database](https://github.com/NESCent/FossilCalibrations)
# Group Calibrations
Calibrations related resources of the **fcdb-api**
## Calibrations Collection [/calibrations{?filter,clade,format}]
+ Parameters
+ filter (optional, string) ... Type of filter - currently supports age, include max= and min= for Ma ages.
+ clade (optional, string) ... Name of taxon identifying clade to search for calibrations in
+ format (optional, string, `json`) ... Format to return - supports `json` or `csv`, defaults to `json`
### Filter Calibrations [GET]
+ Response 200 (application/json)
[
{"id":1,"nodeName":"node1","nodeMinAge":0,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]},
{"id":2,"nodeName":"node2","nodeMinAge":10,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]}
]
## Calibration [/calibrations/{id}{?format}]
A single Calibration object with its details
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the Calibration to perform action with.
+ format (optional, string, `json`) ... Format to return - supports `json` or `csv`, defaults to `json`
### Retrieve a Calibration [GET]
+ Response 200 (application/json)
{"id":1,"nodeName":"node1","nodeMinAge":0,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]}
|
FORMAT: 1A
HOST: http://fossilcalibrations.org/api/v1/
# fcdb-api
fcdb-api is a read-only REST interace to the [Fossil Calibrations database](https://github.com/NESCent/FossilCalibrations)
# Group Calibrations
Calibrations related resources of the **fcdb-api**
## Calibrations Collection [/calibrations{?.format}{?maxAge,minAge,clade,tipTaxa%5B%5D,geologicalTime}]
+ Parameters
+ maxAge (optional, string) ... Maximum (oldest) calibration age in Ma.
+ minAge (optional, string) ... Minimum (youngest) calibration age in Ma.
+ clade (optional, string) ... Name of taxon identifying clade in which to search
+ tipTaxa%5B%5D (optional, array) ... Up to 2 taxa to use when performing an MRCA search.
+ geologicalTime (optional, string) ... Geological time period
+ format (optional, string, `json`) ... Format to return - supports `json` or `csv`, defaults to `json`
### Filter Calibrations [GET]
Returns calibrations in the database, maching the optional filter parameters.
+ Response 200 (application/json)
[
{"id":1,"nodeName":"node1","nodeMinAge":0,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]},
{"id":2,"nodeName":"node2","nodeMinAge":10,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]}
]
## Calibration [/calibrations/{id}{?.format}]
A single Calibration object with its details
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the Calibration to perform action with.
+ format (optional, string, `json`) ... Format to return - supports `json` or `csv`, defaults to `json`
### Retrieve a Calibration [GET]
+ Response 200 (application/json)
{"id":1,"nodeName":"node1","nodeMinAge":0,"nodeMaxAge":20,"calibrationReference":"Smith, J 2014. Title","fossils":[],"tipPairs":[]}
|
Rework filter parameters
|
Rework filter parameters
|
API Blueprint
|
mit
|
NESCent/fcdb-api,NESCent/fcdb-api
|
c51a40f7857411ec2f5fcb1ad2517b7c8186a643
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://api.gtdtodoapi.com
# GTD TODO API
This is an example API, originally written as a companion to a [Quickly Prototype APIs with Apiary](http://sendgrid.com/blog/quickly-prototype-apis-apiary/) blog post at SendGrid.com. Extended by [@zdne](https://github.com/zdne) put emphasis on hyperlinks.
## GTD TODO API [/]
The API entry point. Root of the API. Main node of the mind map.
This entry point resource does not have any attributes, instead it offers root API affordances.
### Affordances
+ `show` (`self`) ... API entry point
+ `folders` ... Lists all folders
## Retrieve the API Root [GET]
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/" },
"folders": { "href": "/folders"}
}
}
## Folder [/folders/{id}]
A single Folder object.
### Attributes
+ `id` ... Id of a folder. Automatically assigned
+ `name` ... Name of the folder
+ `description` ... Description of the folder
+ `parent` ... ID of folder that is the parent. Set to 0 if no parent
+ `meta` ... A catch-all attribute to add custom features
### Affordances
+ `show` (`self`) ... A single Folder
+ `edit` ... Update or delete the Folder
+ Parameters
+ id (required, int, `0`) ... Unique folder ID in the form of an integer
+ Model (application/hal+json)
{
"_links": {
"self": { "href": "/folders/1" },
"edit": { "href": "/folders/1" }
},
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health",
"parent": 0,
"meta": "NULL"
}
## Retrieve a single Folder [GET]
+ Response 200
[Folder][]
### Edit a Folder [PATCH]
+ Request (application/json)
{
"description": "A collection of health related projects"
}
+ Response 200
[Folder][]
## Delete a Folder [DELETE]
+ Response 204
# Folder Collection [/folders]
Collections of all folders.
### Attributes
+ `folder_count` ... Total count of all folders
### Affordances
+ `show` (`self`) ... List of all Folders
+ `create` ... Create a new Folder
+ Model (application/hal+json)
{
"_links": {
"self": { "href": "/folders" },
"create": { "href": "/folders" }
},
"folder_count": 2,
"_embedded": {
"folders" : [
{
"_links": {
"self": { "href": "/folders/1" }
},
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health"
},
{
"_links": {
"self": { "href": "/folders/2" }
},
"id": 2,
"name": "Diet",
"description": "A collection of projects related to Diet"
}
]
}
}
## List all Folders [GET]
+ Response 200
[Folder Collection][]
## Create a Folder [POST]
+ Request (application/json)
Represents a folder to be created. At minimum it must contain the `name` and `description` attributes.
Optionally it may contain `parent` and `meta` attributes of the Folder being created.
+ Body
{
"name": "Diet",
"description": "A collection of projects related to Diet",
"parent": 1
}
+ Response 201
[Folder][]
|
FORMAT: 1A
HOST: http://api.gtdtodoapi.com
# GTD TODO API
This is an example API, originally written as a companion to a [Quickly Prototype APIs with Apiary](http://sendgrid.com/blog/quickly-prototype-apis-apiary/) blog post at SendGrid.com. Extended by [@zdne](https://github.com/zdne) put emphasis on hyperlinks.
## GTD TODO API [/]
The API entry point. Root of the API. Main node of the mind map.
This entry point resource does not have any attributes, instead it offers root API affordances.
### Affordances
+ `show` (`self`) ... API entry point
+ `folders` ... Lists all folders
### Retrieve the API Root [GET]
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/" },
"folders": { "href": "/folders"}
}
}
## Folder [/folders/{id}]
A single Folder object.
### Attributes
+ `id` ... Id of a folder. Automatically assigned
+ `name` ... Name of the folder
+ `description` ... Description of the folder
+ `parent` ... ID of folder that is the parent. Set to 0 if no parent
+ `meta` ... A catch-all attribute to add custom features
### Affordances
+ `show` (`self`) ... A single Folder
+ `edit` ... Update or delete the Folder
+ Parameters
+ id (required, int, `0`) ... Unique folder ID in the form of an integer
+ Model (application/hal+json)
{
"_links": {
"self": { "href": "/folders/1" },
"edit": { "href": "/folders/1" }
},
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health",
"parent": 0,
"meta": "NULL"
}
### Retrieve a single Folder [GET]
+ Response 200
[Folder][]
### Edit a Folder [PATCH]
+ Request (application/json)
{
"description": "A collection of health related projects"
}
+ Response 200
[Folder][]
### Delete a Folder [DELETE]
+ Response 204
## Folder Collection [/folders]
Collections of all folders.
### Attributes
+ `folder_count` ... Total count of all folders
### Affordances
+ `show` (`self`) ... List of all Folders
+ `create` ... Create a new Folder
+ Model (application/hal+json)
{
"_links": {
"self": { "href": "/folders" },
"create": { "href": "/folders" }
},
"folder_count": 2,
"_embedded": {
"folders" : [
{
"_links": {
"self": { "href": "/folders/1" }
},
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health"
},
{
"_links": {
"self": { "href": "/folders/2" }
},
"id": 2,
"name": "Diet",
"description": "A collection of projects related to Diet"
}
]
}
}
### List all Folders [GET]
+ Response 200
[Folder Collection][]
### Create a Folder [POST]
+ Request (application/json)
Represents a folder to be created. At minimum it must contain the `name` and `description` attributes.
Optionally it may contain `parent` and `meta` attributes of the Folder being created.
+ Body
{
"name": "Diet",
"description": "A collection of projects related to Diet",
"parent": 1
}
+ Response 201
[Folder][]
|
Fix markdown headers nesting
|
Fix markdown headers nesting
|
API Blueprint
|
mit
|
zdne/todoapi
|
d7896e565aa37acb8c7571f592898c58d4ef6fc7
|
WEATHER-API-BLUEPRINT.apib
|
WEATHER-API-BLUEPRINT.apib
|
FORMAT: 1A
Weather API
=============================
**Work in Progress** - MeteoGroup's public weather API documentation
Do you want to send [feedback](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951)?
[Roadmap for Weather API](https://github.com/MeteoGroup/weather-api/tree/roadmap)
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
The Weather API resolves weather data based on location specified by latitude and longitude coordinates.
For weather parameters prediction API offer ["forecast" endpoint](#forecast) and for weather history parameters API offer ["observation" endpoint](#observation).
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
All endpoints are **secured** with HTTP basic authorization and data are transmitted over HTTPS protocol.
If you want to get access please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
# Group Observation
## Retrieve weather observation [/observation?location={latitudeInDegree,longitudeInDegree}{&speedUnit}{&temperatureUnit}{&precipitationUnit}]
#### Example
`https://api.weather.mg/observation?location=53,13`
### Observed weather for a given *latitude* and *longitude* [GET]
This resource provides data from existing weather observation stations. These are the latest values/parameters they provide.
For any requested location a relevant station is computed.
For the relevance the stations distance, height difference and available parameters are taken into concern.
**This endpoint returns dummy data for now.**
+ Parameters
+ latitudeInDegree: `52.13` (number, required) - latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32
+ longitudeInDegree: `13.2` (number, required) - longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
+ speedUnit: `meters_per_second` (string, optional) - select which unit for windSpeed, windGust, etc.; valid values: meters_per_second, miles_per_hour, kilometers_per_hour, beaufort
+ temperatureUnit: `degree` (string, optional) - select which unit for airTemperature, etc.; valid values: degree, fahrenheit
+ precipitationUnit: `millimeter` (string, optional) - select which unit for precipitation, etc.; valid values: millimeter, inch
+ Response 200 (application/json)
+ Headers
X-Request-Calls-Per-Interval: 4711
E-Tag: "x234dff"
Cache-Control: max-age=3628800
+ Body
{
"location" : {
"latitude": 52.5337,
"longitude": 13.37788,
"timeZoneName" : "Europe/Berlin"
},
"relevantStation" : {
"latitude": 23.43,
"longitude": -56.23,
"heightInMeters": -12.43,
"id": 4711,
"wmoId": 1231,
"sourceType" : "DWD",
"name" : "Berlin Tegel"
},
"observedAt": "2015-08-25T13:00:00+02:00",
"airTemperature": {
"value" : 29.3,
"unit" : "DEGREE_CELSIUS"
},
"airPressureInHpa": 1012.9,
"windSpeed": {
"value" : 7.4,
"unit" : "METER_PER_SECOND",
"timeIntervalInMinutes" : -60
},
"windGust" : {
"value" : 21.6,
"unit" : "METER_PER_SECOND",
"timeIntervalInMinutes" : -60
},
"windDirectionInDegree": 274,
"dewPointTemperature": {
"value" : 15.8,
"unit" : "DEGREE_CELSIUS"
},
"precipitation": {
"value" : 0.2,
"unit" : "MILLIMETER",
"timeIntervalInMinutes" : -60
},
"relativeHumidityInPercent100based": 63,
"effectiveCloudCoverInOcta": 3,
"visibility": {
"value" : 0.2,
"unit" : "KILOMETER"
}
}
# Group Forecast
## Retrieve weather forecast [/forecast?location={latitudeInDegree,longitudeInDegree}{&speedUnit}{&temperatureUnit}{&precipitationUnit}]
#### Example
`https://api.weather.mg/forecast?location=53,13`
### Forecasted weather for a given *latitude* and *longitude* [GET]
Weather forecast for the next 7 days.
+ Parameters
+ latitudeInDegree: `52.13` (number, required) - latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32
+ longitudeInDegree: `13.2` (number, required) - longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
+ speedUnit: `meters_per_second` (string, optional) - select which unit for windSpeed, windGust, etc.; valid values: meters_per_second, miles_per_hour, kilometers_per_hour, beaufort
+ temperatureUnit: `degree` (string, optional) - select which unit for airTemperature, etc.; valid values: degree, fahrenheit
+ precipitationUnit: `millimeter` (string, optional) - select which unit for precipitation, etc.; valid values: millimeter, inch
+ Response 200 (application/json)
+ Headers
X-Request-Calls-Per-Interval: 4712
E-Tag: "a987dff"
Cache-Control: max-age=600
+ Body
{
"location" : {
"latitude": 52.5337,
"longitude": 13.37788,
"timeZoneName" : "Europe/Berlin"
},
"forecasts": {
"hourly" : [
{
"validAt": "2015-08-25T14:00:00+02:00",
"airTemperature": {
"value" : 29,
"unit" : "DEGREE_CELSIUS"
},
"dewPointTemperature": {
"value" : 15.8,
"unit" : "DEGREE_CELSIUS"
},
"airPressureInHpa": 1012.9,
"sunshineDurationPastIntervalInMinutes": 23,
"precipitationPastInterval": {
"value" : 0,
"unit" : "MILLIMETER"
},
"precipitationProbabilityInPercent100based": 0,
"averageWindSpeed": {
"value" : 7.48,
"unit" : "METER_PER_SECOND",
"timeIntervalInMinutes" : -60
},
"windGust" : {
"value" : 21.6,
"unit" : "METER_PER_SECOND",
"timeIntervalInMinutes" : -60
},
"windDirectionInDegree": 274,
"effectiveCloudCoverInOcta": 3
}
]
}
}
# Data Structures
## Backward compatibility
Weather API may add more parameters in the future.
Clients should irgnore unknown parameters.
Only when parameters will fundamently change, a new version might be introduced.
## Forecast Intervals
The response contains different time intervals which contain forecast in for different time spans.
Interval name | Time interval | Time span
---------------|----------------|--------------------------------
hourly | 1 hour | using time zone from requested location, today from 00:00 until 00:00 next day, plus 1 day ahead, means 48 hours in total
interval6hours | 6 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 28 intervals in total
halfDaily | 12 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 14 intervals in total
daily | 24 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 7 days in total
## Units
Parameter | unit
---------------|-----
minAirTemperature | Degree or Fahrenheit
maxAirTemperature | Degree or Fahrenheit
airTemperature | Degree or Fahrenheit
dewPointTemperature | Degree or Fahrenheit
precipitation | mm or inch
precipitationLastHour | mm or inch
windSpeed | m/s or km/h or m/h or BFT
windGust | in Knots or m/h or km/h
date, time, time offset | timestamps including date, time and a zime offset are encoded in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).
precipitationProbabilityInPercent100based | a percentage which refers to the amount of precipitation probability
## Total Cloud Cover (number)
This symbolic letter shall embrace the total fraction of the celestial dome covered by clouds irrespective of their genus.
(WMO akronym 'N')
Value | Meaning
------|---------
0 | 0
1 | 1 okta or less, but not zero
2 | 2 oktas
3 | 3 oktas
4 | 4 oktas
5 | 5 oktas
6 | 6 oktas
7 | 7 oktas
8 | 8 oktas
9 | Sky obscured by fog and/or other meteorological phenomena
|
FORMAT: 1A
Weather API
=============================
Do you want to send [feedback](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951)?
[Roadmap for Weather API](https://github.com/MeteoGroup/weather-api/tree/roadmap)
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
The Weather API resolves weather data based on location specified by latitude and longitude coordinates.
For weather parameters prediction API offer ["forecast" endpoint](#forecast) and for weather history parameters API offer ["observation" endpoint](#observation).
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
All endpoints are **secured** with HTTP basic authorization and data are transmitted over HTTPS protocol.
If you want to get access please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
# Group Observation
## Retrieve weather observation [/observation?locatedAt={locatedAt}&fields={fields}&]
#### Example
`https://api.weather.mg/observation?location=53,13`
### Observed weather for a given *latitude* and *longitude* [GET]
This resource provides data from existing weather observation stations.
These are the latest values/parameters they provide.
For any requested location a relevant station is computed.
To the relevant station, the distance and available parameters are taken into concern.
+ Parameters
+ locatedAt: `13.37788,52.5337` (string, required) - longitude,latitude; can occur multiple times for multiple stations
+ locatedAt: `joionluqqFvwqmo629nC` (string, optional) - compressed list of station locations, using Microsoft Point Compression Algorithm, is efficient for up to 400 locations
+ fields: `sunshineDurationInMinutes,airTemperatureInCelsius` (string, required) - comma separated list of parameters to be contained inside response
+ observedFromUtc: `2016-10-13T11:00:00Z` (string, optional)
+ observedUntilUtc: `2016-10-13T15:00:00Z` (string, optional)
+ observedFromLocalTime: `2016-10-13T11:00:00Z` (string, optional)
+ observedUntilLocalTime: `2016-10-13T15:00:00Z` (string, optional)
+ observedPeriod: `PT0S,PT1H,PT12H` (string, required) - comma separated list of periods to be retrieved. use iso8601 time duration notation. PT0S refers to observations at a moment in time. PT1H applies one hour aggregation.
+ Response 200 (application/json)
+ Headers
X-Request-Calls-Per-Interval: 4711
E-Tag: "x234dff"
Cache-Control: max-age=3628800
"items" : [
{
"location" : {
"latitude": 52.5337,
"longitude": 13.37788,
},
"relevantStation" : {
"meteoGroupStationId" : "abcd1234ef5678",
"stationName" : "Berlin Dahlem",
"longitude" : 13.12156,
"latitude" : 52.57113
"timeZoneName" : "Europe/Berlin"
},
"observation" : [
{
"observedFromUtc": "2016-10-13T11:00:00Z",
"observedUntilUtc": "2016-10-13T12:00:00Z",
"observedPeriod" : "PT1H",
"sunshineDurationInMinutes": 15,
"windGustInKnots" : 20,
},
{
"observedFromUtc": "2016-10-13T06:00:00Z",
"observedUntilUtc": "2016-10-13T18:00:00Z",
"observedPeriod" : "PT12H",
"sunshineDurationInMinutes": 123,
"windGustInKnots" : 20,
},
{
"observedFromUtc": "2016-10-13T12:00:00Z",
"observedUntilUtc": "2016-10-13T12:00:00Z",
"observedPeriod" : "PT0S",
"airTemperatureInCelsius": 29.6,
"windSpeedInKnots" : 14
}
]
}
]
}
# Group Forecast
## Retrieve weather forecast [/forecast?locatedAt={locatedAt}&fields={fields}&validPeriod={validPeriod}&validFrom={validFrom}{&validUntil}]
### Forecasted weather for a given *latitude* and *longitude* [GET]
Weather forecast for the next 7 days.
+ Parameters
+ locatedAt: `13.37788,52.5337` (string, required) - longitude,latitude; can occur multiple times for multiple locations
+ locatedAt: `joionluqqFvwqmo629nC` (string, optional) - compressed list of station locations, using Microsoft Point Compression Algorithm, is efficient for up to 400 locations
+ fields: `airTemperatureInCelsius,dewPointTemperatureInFahrenheit,dewPointTemperatureInKelvin` (string, required) - comma separated list of parameters to be contained inside response
+ validFromUtc: `2016-10-13T11:00:00Z` (string, optional)
+ validUntilUtc: `2016-10-13T15:00:00Z` (string, optional)
+ validFromLocalTime: `2016-10-13T11:00:00Z` (string, optional)
+ validUntilLocalTime: `2016-10-13T15:00:00Z` (string, optional)
+ validPeriod: `PT0S,PT1H,PT6H` - comma separated list of periods to be retrieved. use iso8601 time duration notation. PT1H refers one hour forecast periods. PT6H applies three hours aggregation.
+ Response 200 (application/json)
+ Headers
X-Request-Calls-Per-Interval: 4712
E-Tag: "a987dff"
Cache-Control: max-age=600
+ Body
{
"items" : [
{
"location" : {
"latitude": 52.5337,
"longitude": 13.37788,
"timeZoneName" : "Europe/Berlin"
},
"relevantStation" : {
"meteoGroupStationId" : "abcd1234ef5678",
"stationName" : "Berlin Dahlem",
"longitude" : 13.12156,
"latitude" : 52.57113
},
"forecast": [
{
"validFromUtc": "2016-08-25T14:00:00Z",
"validUntilUtc": "2016-08-25T14:00:00Z",
"validPeriod": "PT0S"
"airTemperatureInCelsius": 15.8,
"dewPointTemperatureInFahrenheit": 15.8,
"dewPointTemperatureInKelvin": 15.8,
"airPressureInHpa": 1012.9,
"effectiveCloudCoverInOcta": 3
"precipitationIntensityInMillimeterPerHour": 0,
"windSpeedInKnots":3,
},
{
"validFromUtc": "2016-08-25T14:00:00Z",
"validUntilUtc": "2016-08-25T15:00:00Z",
"validPeriod": "PT1H"
"minAirTemperatureInCelsius": 15.8,
"maxAirTemperatureInCelsius": 15.8,
"sunshineDurationInMinutes": 23,
"precipitationAmountInMillimeter": 0,
"windGustInKnots": 5,
},
{
"validFromUtc": "2016-08-25T14:00:00Z",
"validUntilUtc": "2016-08-25T20:00:00Z",
"validPeriod": "PT6H"
"minAirTemperatureInCelsius": 15.8,
"maxAirTemperatureInCelsius": 18.1,
"sunshineDurationInMinutes": 385,
"precipitationAmountInMillimeter": 0,
"windGustInKnots": 6,
}
]
}
}
# Group Warning
## Retrieve severe weather warnings [/warnings?location={latitudeInDegree,longitudeInDegree}]
### Example
`https://api.weather.mg/forecast?location=53,13`
### Severe Weather Warnings [GET]
THIS IS A DRAFT.
+ Parameters
+ latitudeInDegree: `52.13` (number, required) - latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32
+ longitudeInDegree: `13.2` (number, required) - longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
+ Request
+ Headers
X-Authentication: <API-Key>
X-TraceId: <Trace-Id>
+ Response 200 (application/json)
+ Headers
X-Request-Calls-Per-Interval: 4712
E-Tag: "a987dff"
Cache-Control: max-age=600
+ Body
{
"location" : {
"latitude": 52.5337,
"longitude": 13.37788,
},
"warningId": "1234-5678",
"issueAt": "2016-08-03T00:00:00+02:00",
"validAt": "2016-08-03T00:00:00+02:00",
"warningSeverity": "HIGH",
"affectedRegion": {
"name": "London"
}
}
# Data Structures
## Backward compatibility
Weather API may add more parameters in the future.
Clients should irgnore unknown parameters.
Only when parameters will fundamently change, a new version might be introduced.
## Forecast Intervals
The response contains different time intervals which contain forecast in for different time spans.
Interval name | Time interval | Time span
---------------|----------------|--------------------------------
hourly | 1 hour | using time zone from requested location, today from 00:00 until 00:00 next day, plus 1 day ahead, means 48 hours in total
interval6hours | 6 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 28 intervals in total
halfDaily | 12 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 14 intervals in total
daily | 24 hours | using time zone from requested location, today from 00:00 until 00:00 next day, plus 6 days ahead, means 7 days in total
## Units
Parameter | unit
---------------|-----
minAirTemperature | Degree or Fahrenheit
maxAirTemperature | Degree or Fahrenheit
airTemperature | Degree or Fahrenheit
dewPointTemperature | Degree or Fahrenheit
precipitation | mm or inch
precipitationLastHour | mm or inch
windSpeed | m/s or km/h or m/h or BFT
windGust | in Knots or m/h or km/h
date, time, time offset | timestamps including date, time and a zime offset are encoded in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).
precipitationProbabilityInPercent100based | a percentage which refers to the amount of precipitation probability
## Total Cloud Cover (number)
This symbolic letter shall embrace the total fraction of the celestial dome covered by clouds irrespective of their genus.
(WMO akronym 'N')
Value | Meaning
------|---------
0 | 0
1 | 1 okta or less, but not zero
2 | 2 oktas
3 | 3 oktas
4 | 4 oktas
5 | 5 oktas
6 | 6 oktas
7 | 7 oktas
8 | 8 oktas
9 | Sky obscured by fog and/or other meteorological phenomena
|
refactor to adopt api guide line
|
refactor to adopt api guide line
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
a2bac9b7f9c85a0e2e3ba84f8342b92f2ad37ebe
|
source/parser.apib
|
source/parser.apib
|
## API Description Parser [/parser]
Parse an API description format.
### Parse [POST]
API Blueprint parsing is performed as it is provided by the [Drafter](https://github.com/apiaryio/drafter) reference parser.
#### Input Media Types
##### API Blueprint
```
text/vnd.apiblueprint
```
API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md).
##### Swagger 2.0
```
application/swagger+yaml
application/swagger+json
```
Swagger as defined in its [specification](http://swagger.io/specification)
#### Output Media Types
##### API Description Parse Result Namespace
```
application/vnd.refract.parse-result+json
application/vnd.refract.parse-result+yaml
```
General-purpose result of the parsing operation. The parse result is in form of the Refract data structure as defined in its [specification](https://github.com/refractproject/refract-spec). The parse result data comply with the [Parse Result Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/parse-result-namespace.md).
+ Relation: parse
+ Request Parse API Blueprint into Parse Result Namespace as JSON (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json)
:[](fixtures/apib/normal.refract.parse-result.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml)
:[](fixtures/apib/normal.refract.parse-result.yaml)
+ Request Parse API Blueprint into Parse Result Namespace as JSON 1.0 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.1.0.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML 1.0 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.1.0.yaml)
+ Request Parse API Blueprint into Parse Result Namespace as JSON 0.6 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML 0.6 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.yaml)
+ Request Invalid Document (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/error.apib)
+ Response 422 (application/vnd.refract.parse-result+yaml)
:[](fixtures/apib/error.refract.parse-result.yaml)
+ Request Unsupported Input Media Type
+ Headers
Accept: application/raml+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 415 (application/vnd.error+json)
{
"statusCode": 415,
"message": "",
"name": "Rest Error"
}
+ Request Unsupported Output Media Type (application/swagger+yaml)
+ Headers
Accept: application/vnd.apiblueprint.parseresult+json; version=2.2
+ Body
:[](fixtures/swagger.yaml/normal.yaml)
+ Response 406 (application/vnd.error+json)
{
"statusCode": 406,
"message": "",
"name": "Rest Error"
}
|
## API Description Parser [/parser]
Parse an API description format.
### Parse [POST]
API Blueprint parsing is performed as it is provided by the [Drafter](https://github.com/apiaryio/drafter) reference parser.
#### Input Media Types
##### API Blueprint
```
text/vnd.apiblueprint
```
API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md).
##### Swagger 2.0
```
application/swagger+yaml
application/swagger+json
```
Swagger as defined in its [specification](http://swagger.io/specification)
#### Output Media Types
##### API Description Parse Result Namespace
```
application/vnd.refract.parse-result+json
application/vnd.refract.parse-result+yaml
```
General-purpose result of the parsing operation. The parse result is in form of the Refract data structure as defined in its [specification](https://github.com/refractproject/refract-spec). The parse result data comply with the [Parse Result Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/parse-result-namespace.md).
+ Relation: parse
+ Request Parse API Blueprint into Parse Result Namespace as JSON (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json)
:[](fixtures/apib/normal.refract.parse-result.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml)
:[](fixtures/apib/normal.refract.parse-result.yaml)
+ Request Parse API Blueprint into Parse Result Namespace as JSON 1.0 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json; version=1.0
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.1.0.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML 1.0 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml; version=1.0
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml; version=1.0)
:[](fixtures/apib/normal.refract.parse-result.1.0.yaml)
+ Request Parse API Blueprint into Parse Result Namespace as JSON 0.6 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+json; version=0.6
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+json; version=0.6)
:[](fixtures/apib/normal.refract.parse-result.json)
+ Request Parse API Blueprint into Parse Result Namespace as YAML 0.6 (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml; version=0.6
+ Body
:[](fixtures/apib/normal.apib)
+ Response 200 (application/vnd.refract.parse-result+yaml; version=0.6)
:[](fixtures/apib/normal.refract.parse-result.yaml)
+ Request Invalid Document (text/vnd.apiblueprint)
+ Headers
Accept: application/vnd.refract.parse-result+yaml
+ Body
:[](fixtures/apib/error.apib)
+ Response 422 (application/vnd.refract.parse-result+yaml)
:[](fixtures/apib/error.refract.parse-result.yaml)
+ Request Unsupported Input Media Type
+ Headers
Accept: application/raml+yaml
+ Body
:[](fixtures/apib/normal.apib)
+ Response 415 (application/vnd.error+json)
{
"statusCode": 415,
"message": "",
"name": "Rest Error"
}
+ Request Unsupported Output Media Type (application/swagger+yaml)
+ Headers
Accept: application/vnd.apiblueprint.parseresult+json; version=2.2
+ Body
:[](fixtures/swagger.yaml/normal.yaml)
+ Response 406 (application/vnd.error+json)
{
"statusCode": 406,
"message": "",
"name": "Rest Error"
}
|
Fix output versions in parser.apib
|
chore: Fix output versions in parser.apib
|
API Blueprint
|
mit
|
apiaryio/api.apiblueprint.org,apiaryio/api.apiblueprint.org
|
09d0e7062951bd5a74697c36b201d5c33ca18d10
|
apiary.apib
|
apiary.apib
|
HOST: http://api.openbookprices.com/
--- OpenBookPrices ---
---
The [OpenBookPrices](http://www.openbookprices.com/) API lets you get current prices
from book vendors around the world, including shipping costs to your country and all
converted into your currency.
---
-- Book Details --
Return very basic details about the book, currently just title and authors. If you want more details here please [create an issue](https://github.com/OpenBookPrices/openbookprices-api/issues) requesting them.
GET /v1/books/{isbn}/details
< 200
< Content-Type: application/json
{
"authors": [
"Henry David Thoreau"
],
"title": "Walden",
"isbn": "9781619493919"
}
-- Book Prices --
Determine the country (and hence currency) of the IP address making the request and then redirect to the specific url.
GET /v1/books/{isbn}/prices
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD
Determine the primary currency of the `country` and redirect to the specific url.
GET /v1/books/{isbn}/prices/{country}
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD
Return immediately a list of all the vendors who ship to `country` and the pricing details that are currently known.
GET /v1/books/{isbn}/prices/{country}/{currency}
< 200
< Content-Type: application/json
[
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_uk",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_uk"
},
"offers": {},
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
"url": null
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
},
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_us",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_us"
},
offers: {},
"vendor": {
"code": "amazon_us",
"name": "Amazon USA",
"homepage": "http://www.amazon.com/",
"url:" null
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
},
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "foyles",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/foyles"
},
offers: {},
"vendor": {
"code": "foyles",
"name": "Foyles",
"homepage": "http://www.foyles.co.uk/",
"url": null,
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
}
]
Return fresh details for the vendor. If needed this will initiate a fetch of the details so the response may block whilst this is happening.
GET /v1/books/{isbn}/prices/{country}/{currency}/{vendor}
< 200
< Content-Type: application/json
{
"status": "ok",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_uk",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_uk"
},
"offers": {
"new": {
"price": 21.7,
"availabilityNote": "Usually dispatched within 24 hours",
"shippingNote": "5 to 7 business days",
"shipping": 6.98,
"total": 28.68
}
},
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
"url": "http://www.amazon.co.uk/dp/0340831499"
},
"meta": {
"timestamp": 1381518231,
"ttl": 3600,
"retryDelay": null,
"preConversionCurrency": "GBP"
}
}
-- Ping --
Ping back your own request - useful for checking what the server thinks the time is and what IP address you appear to have. Response is not cached.
GET /ping
< 200
< Content-Type: application/json
{
"timestamp": 1381509290.302,
"network": {
"ip": "12.34.56.78",
"ips": [
"12.34.56.78"
]
}
}
|
HOST: http://api.openbookprices.com/
--- OpenBookPrices ---
---
The [OpenBookPrices](http://www.openbookprices.com/) API lets you get current prices
from book vendors around the world, including shipping costs to your country and all
converted into your currency.
---
-- Book Details --
Return very basic details about the book, currently just title and authors. If you want more details here please [create an issue](https://github.com/OpenBookPrices/openbookprices-api/issues) requesting them.
GET /v1/books/{isbn}/details
< 200
< Content-Type: application/json
{
"authors": [
"Henry David Thoreau"
],
"title": "Walden",
"isbn": "9781619493919"
}
-- Book Prices --
Determine the country (and hence currency) of the IP address making the request and then redirect to the specific url.
GET /v1/books/{isbn}/prices
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD
Determine the primary currency of the `country` and redirect to the specific url.
GET /v1/books/{isbn}/prices/{country}
< 302
< Content-Type: text/plain
Redirecting to http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD
Return immediately a list of all the vendors who ship to `country` and the pricing details that are currently known.
GET /v1/books/{isbn}/prices/{country}/{currency}
< 200
< Content-Type: application/json
{
request: {
isbn: "9780340831496",
country: "GB",
currency: "GBP",
url: "http://api.openbookprices.com/v1/books/9780340831496/prices/GB/GBP",
},
results: [
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_uk",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_uk"
},
"offers": {},
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
"url": null
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
},
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_us",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_us"
},
offers: {},
"vendor": {
"code": "amazon_us",
"name": "Amazon USA",
"homepage": "http://www.amazon.com/",
"url:" null
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
},
{
"status": "unfetched",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "foyles",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/foyles"
},
offers: {},
"vendor": {
"code": "foyles",
"name": "Foyles",
"homepage": "http://www.foyles.co.uk/",
"url": null,
},
"meta": {
"timestamp": 1381517829,
"ttl": 0,
"retryDelay": 0.1,
"preConversionCurrency": null
}
}
]
}
Return fresh details for the vendor. If needed this will initiate a fetch of the details so the response may block whilst this is happening.
GET /v1/books/{isbn}/prices/{country}/{currency}/{vendor}
< 200
< Content-Type: application/json
{
"status": "ok",
"request": {
"isbn": "9780340831496",
"country": "US",
"currency": "USD",
"vendor": "amazon_uk",
"url": "http://api.openbookprices.com/v1/books/9780340831496/prices/US/USD/amazon_uk"
},
"offers": {
"new": {
"price": 21.7,
"availabilityNote": "Usually dispatched within 24 hours",
"shippingNote": "5 to 7 business days",
"shipping": 6.98,
"total": 28.68
}
},
"vendor": {
"code": "amazon_uk",
"name": "Amazon UK",
"homepage": "http://www.amazon.co.uk/"
"url": "http://www.amazon.co.uk/dp/0340831499"
},
"meta": {
"timestamp": 1381518231,
"ttl": 3600,
"retryDelay": null,
"preConversionCurrency": "GBP"
}
}
-- Ping --
Ping back your own request - useful for checking what the server thinks the time is and what IP address you appear to have. Response is not cached.
GET /ping
< 200
< Content-Type: application/json
{
"timestamp": 1381509290.302,
"network": {
"ip": "12.34.56.78",
"ips": [
"12.34.56.78"
]
}
}
|
Update Apiary docs
|
Update Apiary docs
|
API Blueprint
|
agpl-3.0
|
OpenBookPrices/openbookprices-api
|
a81c162661ae0197d49439e5c1fb37b593a2ac76
|
STATION-METADATA-API-BLUEPRINT.apib
|
STATION-METADATA-API-BLUEPRINT.apib
|
FORMAT: 1A
Station Metadata API
=============================
# General information
This is technical documentation for the Station Metadata API
This document uses [API blueprint format](https://apiblueprint.org/documentation/).
Station Metadata is a service to get information about stations in GeoJSON format.
### Authentication
All endpoints are **secured** with HTTP basic authorization and data are transmitted over HTTPS protocol.
If you want to get access please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#Stations Metadata API
## Retrieve station metadata [/stations]
For any request all the GET HTTP parameters are optional.
+ Parameters
+ locationWithin: `[-180,90],[180,-90]` (string, optional) - top left and bottom right coordinates that construct bounding box of station locations;
+ accessVisibility: `public` (string, optional) - parameter that filter **public** or **private** stations to show;
+ providerOrType: `WMO` (string, optional) - describes data provider or type;
+ type: `SKI_RESORT` (string, optional) - describes type of station place;
+ hasForecastData: `true` (boolean, optional) - show only stations that provide forecasts;
+ hasObservationData: `true` (boolean, optional) - show only stations that provide observations;
+ countryIsoCode: `DE` (string, optional) - filter stations by country ISO code.
### Get a stations metadata for Germany [GET]
####An example
'https://station-metadata.weather.mg/stations?countryIsoCode=DE&hasObservationData=true'
+ Response 200 (application/json)
+ Headers
Content-Type: application/json
Cache-Control: max-age=86400
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"icaoCode": "EDXW",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10018,
"name": "Westerland/Sylt",
"providerStationId": "GWT",
"providerOrType": "AVIATION",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.35,
54.9167,
20
]
}
},
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10020,
"name": "List/Sylt",
"providerOrType": "WMO/DWD",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.4125,
55.0112,
26
]
}
}
]
}
#
|
FORMAT: 1A
Station Metadata API
=============================
# General information
This is technical documentation for the Station Metadata API
This document uses [API blueprint format](https://apiblueprint.org/documentation/).
Station Metadata is a service to get information about stations in GeoJSON format.
### Authentication
All endpoints are **secured** with HTTP basic authorization and data are transmitted over HTTPS protocol.
If you want to get access please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#Stations Metadata API
## Retrieve station metadata [/stations]
For any request all the GET HTTP parameters are optional.
+ Parameters
+ locationWithin: `[-180,90],[180,-90]` (string, optional) - top left and bottom right coordinates that construct bounding box of station locations;
+ accessVisibility: `public` (string, optional) - parameter that filter **public** or **private** stations to show;
+ providerOrType: `WMO` (string, optional) - describes data provider or type;
+ type: `SKI_RESORT` (string, optional) - describes type of station place;
+ hasForecastData: `true` (boolean, optional) - show only stations that provide forecasts;
+ hasObservationData: `true` (boolean, optional) - show only stations that provide observations;
+ countryIsoCode: `DE` (string, optional) - filter stations by country ISO code.
### Get a stations metadata for Germany [GET]
####An example
'https://station-metadata.weather.mg/stations?countryIsoCode=DE&hasObservationData=true'
+ Response 200 (application/json)
+ Headers
Content-Type: application/json
Cache-Control: max-age=86400
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"icaoCode": "EDXW",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10018,
"name": "Westerland/Sylt",
"providerStationId": "GWT",
"providerOrType": "AVIATION",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.35,
54.9167,
20
]
}
},
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10020,
"name": "List/Sylt",
"providerOrType": "WMO/DWD",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.4125,
55.0112,
26
]
}
}
]
}
|
Correct blueprint text
|
Correct blueprint text
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
c62f916a1b30f1780c7497013ca5dc87310920f0
|
ELEVATION-SERVICE-API-BLUEPRINT.apib
|
ELEVATION-SERVICE-API-BLUEPRINT.apib
|
FORMAT: 1A
HOST: https://elevation.weather.mg
# Elevation Service
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `elevation`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
### Get elevation for single point [GET /elevation?locatedAt={singlePoint}&elevationDataSource={dataSource}]
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `10.041,22.409` (string, required) - longitude,latitude;
+ elevationDataSource: `srtm` (string, optional) - data source, where to get elevation; there can be used 'srtm' or 'gtopo'
+ Response 200 (application/json)
Returns elevation for single Lon/Lat point
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "670"
},
"geometry": {
"type": "Point",
"coordinates": [
10.041000366,
22.409000397
]
}
}
]
}
### Get elevation for compressed points [GET /elevation?locatedAt={compressedPoints}&elevationDataSource={dataSource}]
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `j-h6z-6rvBj19wwt1pwHysgn9xou4FlxjuglztmDoszr_ylwqD` (string, required) - compressed points;
+ elevationDataSource: `srtm` (string, optional) - data source, where to get elevation; there can be used 'srtm' or 'gtopo'
+ Response 200 (application/json)
Returns elevations for compressed points in the same order as they were requested
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "438"
},
"geometry": {
"type": "Point",
"coordinates": [
35.432941437,
15.598409653
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "0"
},
"geometry": {
"type": "Point",
"coordinates": [
129.721343994,
36.248039246
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "96"
},
"geometry": {
"type": "Point",
"coordinates": [
40.656719208,
47.881080627
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "gtopo",
"elevationInMeter": "668"
},
"geometry": {
"type": "Point",
"coordinates": [
96.525482178,
67.051452637
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "41"
},
"geometry": {
"type": "Point",
"coordinates": [
78.036361694,
9.021289825
]
}
}
]
}
|
FORMAT: 1A
HOST: https://elevation.weather.mg
# Elevation Service
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `elevation`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
### Get elevation for single point [GET /elevation?locatedAt={singlePoint}]
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `10.041,22.409` (string, required) - longitude,latitude;
+ Response 200 (application/json)
Returns elevation for single Lon/Lat point
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "670"
},
"geometry": {
"type": "Point",
"coordinates": [
10.041000366,
22.409000397
]
}
}
]
}
### Get elevation for compressed points [GET /elevation?locatedAt={compressedPoints}]
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `j-h6z-6rvBj19wwt1pwHysgn9xou4FlxjuglztmDoszr_ylwqD` (string, required) - compressed points;
+ Response 200 (application/json)
Returns elevations for compressed points in the same order as they were requested
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "438"
},
"geometry": {
"type": "Point",
"coordinates": [
35.432941437,
15.598409653
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "0"
},
"geometry": {
"type": "Point",
"coordinates": [
129.721343994,
36.248039246
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "96"
},
"geometry": {
"type": "Point",
"coordinates": [
40.656719208,
47.881080627
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "gtopo",
"elevationInMeter": "668"
},
"geometry": {
"type": "Point",
"coordinates": [
96.525482178,
67.051452637
]
}
},
{
"type": "Feature",
"properties": {
"elevationDataSource": "srtm",
"elevationInMeter": "41"
},
"geometry": {
"type": "Point",
"coordinates": [
78.036361694,
9.021289825
]
}
}
]
}
|
Revert "Add info about 'elevationDataSource' parameter into ELEVATION-API-BLUEPRINT."
|
Revert "Add info about 'elevationDataSource' parameter into ELEVATION-API-BLUEPRINT."
This reverts commit a88cc8253fca58b83a81d218611c64732fd7759d.
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
0f17dff89e57107c59515ce26870a279fa5975ec
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://datemo.info
# Datemo
Datemo is an API for documents.
## Documents Collection [/documents]
### Create a New Document [POST]
You may create your own document using this action.
- doc-string (string) - The document as an html string.
- type (string) - The type of document (note, or document).
+ Request (application/json)
{
"doc-string": "<p>This is a paragraph.</p>",
}
+ Response 201 (application/hal+json)
{
"_links": {
"self": { "href": "/document/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
## Document Resources [/documents/:id]
### View an Existing Document [GET]
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
### Update an Existing Document [PUT]
+ Request (application/json)
{
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<p>Update for the document</p>"
}
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"doc-string": "<p>Updated for the document</p>",
"lastUpdatedAt": "2014-12-30T09:00:23.340Z",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
|
FORMAT: 1A
HOST: http://datemo.info
# Datemo
Datemo is an API for documents.
## Latest Documents [/latest{?page,type,perpage}]
### View the most recent documents added to the server [GET]
- Parameters
- page - The page of results to request.
- type - The type of document to fetch (note, essay, all) (optional).
- perpage - Number of results per page, defaults to 20 (optional).
+ Response 200 (application/hal+json)
{
"_links": {
"self": "/latest?"
"next": "/latest?page=2"
},
"_embedded": {
"documents": [
{
"id": "5902e5c7-23b6-4664-bba6-f5dffd689eee",
"_links": {
"self": "/documents/5902e5c7-23b6-4664-bba6-f5dffd689eee"
},
"html": "<div><h2>Test</h2><p>This is also a test document.</p></div>"
},
{
"id": "5902e504-6bf6-47be-b1a9-f3e8e0bf4616",
"_links": {
"self": "/documents/5902e504-6bf6-47be-b1a9-f3e8e0bf4616"
},
"html": "<div><h2>Test</h2><p>This is a test document.</p></div>"
},
{
"id": "5902e58a-4948-4df4-a79f-6627576b506d",
"_links": {
"self": "/documents/5902e58a-4948-4df4-a79f-6627576b506d"
},
"html": "<div><h2>Test</h2><p>This is a test document.</p></div>"
}
]
}
}
## Documents Collection [/documents]
### Create a New Document [POST]
You may create your own document using this action.
- doc-string (string) - The document as an html string.
- type (string) - The type of document (note, or document).
+ Request (application/json)
{
"doc-string": "<p>This is a paragraph.</p>",
}
+ Response 201 (application/hal+json)
{
"_links": {
"self": { "href": "/document/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
## Document Resources [/documents/:id]
### View an Existing Document [GET]
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
### Update an Existing Document [PUT]
+ Request (application/json)
{
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<p>Update for the document</p>"
}
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"doc-string": "<p>Updated for the document</p>",
"lastUpdatedAt": "2014-12-30T09:00:23.340Z",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
|
Add /latest route to api blueprint
|
Add /latest route to api blueprint
|
API Blueprint
|
epl-1.0
|
ezmiller/datemo
|
7341ef299384d7795c7ade9497028b101a4b805e
|
api.apib
|
api.apib
|
FORMAT: 1A
HOST: https://mensa.dreami.ch/v1/
# HSR Mensa API
The HSR Mensa API lets you get information about the menus at the HSR mensa.
It scrapes the HSR Mensa page for you and extracts the needed information. This frees you from keeping your own scraper up-to-date and you can concentrate on actually writing a good app.
# Technical Briefing
The enumeration values for `site` are currently:
* `mensa`
* `forschungszentrum`
The enumeration values for `weekday` are currently:
* `mon`
* `tue`
* `wed`
* `thu`
* `fri`
* `today`: Defaults to today, if on a weekend: `fri`
Note that we can only display upcoming days (if on a weekend, the past week) since we scrap once each day and we don't cache anything from earlier days.
## Get a site [/sites/{site}]
Get information about a site (all upcoming weekdays)
+ Parameters
+ site: mensa (string) - Site name
### Get a single site [GET]
+ Response 200 (application/json)
+ Body
{
"site": "SiteType.MENSA",
"days": [
{
"weekday": "Fr"
"date": "12.05.",
"menus": [
{
"description": "Merrfischchnusperli im Bierteig ",
"title": "Fish & Chips"
},
{
"description": "mit Menusalat",
"title": "Älpler Chääs Hörnli"
},
{
"description": "Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title": "Schweins\u00adsteak vom Grill"
},
{
"description": "- Kabis mit Zwiebeln und Kurkuma",
"title": "Free - Choice Buffet"
}
],
}
], (other days)
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 406 (application/json)
Invalid site value
## Get all sites [/sites/all]
Get information about all sites (upcoming weekdays)
### Get all sites [GET]
+ Response 200 (application/json)
+ Body
{
"sites":[
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
], (other days)
},
{
"site":"SiteType.FORSCHUNGSZENTRUM"
"days":[
{
"weekday":"Fr",
"date":"12.05.",
"menus":[
{
"description":"Spaghetti mit verschiedenen Saucen zur Wahl:",
"title":"Spaghetti-Plausch"
},
{
"description":"mit gehobeltem Pecorino",
"title":"Papardelle al Cinque-Pi"
},
{
"description":"mit gebratenem Poulet, Speck,",
"title":"Caesar Salad Classic"
},
{
"description":"Bunter Blattsalat",
"title":"Farmer Salad"
}
],
}
], (other days)
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
## Get a single day for a single site [/sites/{site}/days/{weekday}]
Get information about a single day at a single site
+ Parameters
+ site: mensa (string) - Site name
+ weekday: tue (string) - Weekday name
### Get a single day for a single site [GET]
+ Response 200 (application/json)
+ Body
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 404 (application/json)
No menu for this day
+ Response 406 (application/json)
Invalid site or weekday value
## Get a single day for all site [/sites/all/days/{weekday}]
Get information about a single day at all sites
+ Parameters
+ weekday: tue (string) - Weekday name
### Get a single day for a single site [GET]
+ Response 200 (application/json)
+ Body
{
"sites":[
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
]
},
{
"site":"SiteType.FORSCHUNGSZENTRUM"
"days":[
{
"weekday":"Fr",
"date":"12.05.",
"menus":[
{
"description":"Spaghetti mit verschiedenen Saucen zur Wahl:",
"title":"Spaghetti-Plausch"
},
{
"description":"mit gehobeltem Pecorino",
"title":"Papardelle al Cinque-Pi"
},
{
"description":"mit gebratenem Poulet, Speck,",
"title":"Caesar Salad Classic"
},
{
"description":"Bunter Blattsalat",
"title":"Farmer Salad"
}
],
}
]
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 404 (application/json)
No menu for this day
+ Response 406 (application/json)
Invalid weekday value
|
FORMAT: 1A
HOST: https://mensa.dreami.ch/v1/
# HSR Mensa API
The HSR Mensa API lets you get information about the menus at the HSR mensa.
It scrapes the HSR Mensa page for you and extracts the needed information. This frees you from keeping your own scraper up-to-date and you can concentrate on actually writing a good app.
# Technical Briefing
The enumeration values for `site` are currently:
* `mensa`
* `forschungszentrum`
The enumeration values for `weekday` are currently:
* `mon`
* `tue`
* `wed`
* `thu`
* `fri`
* `today`: Defaults to today, if on a weekend: `fri`
Note that we can only display upcoming days (if on a weekend, the past week) since we scrap once each day and we don't cache anything from earlier days.
## Get a site [sites/{site}]
Get information about a site (all upcoming weekdays)
+ Parameters
+ site: mensa (string) - Site name
### Get a single site [GET]
+ Response 200 (application/json)
+ Body
{
"site": "SiteType.MENSA",
"days": [
{
"weekday": "Fr"
"date": "12.05.",
"menus": [
{
"description": "Merrfischchnusperli im Bierteig ",
"title": "Fish & Chips"
},
{
"description": "mit Menusalat",
"title": "Älpler Chääs Hörnli"
},
{
"description": "Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title": "Schweins\u00adsteak vom Grill"
},
{
"description": "- Kabis mit Zwiebeln und Kurkuma",
"title": "Free - Choice Buffet"
}
],
}
], (other days)
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 406 (application/json)
Invalid site value
## Get all sites [sites/all]
Get information about all sites (upcoming weekdays)
### Get all sites [GET]
+ Response 200 (application/json)
+ Body
{
"sites":[
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
], (other days)
},
{
"site":"SiteType.FORSCHUNGSZENTRUM"
"days":[
{
"weekday":"Fr",
"date":"12.05.",
"menus":[
{
"description":"Spaghetti mit verschiedenen Saucen zur Wahl:",
"title":"Spaghetti-Plausch"
},
{
"description":"mit gehobeltem Pecorino",
"title":"Papardelle al Cinque-Pi"
},
{
"description":"mit gebratenem Poulet, Speck,",
"title":"Caesar Salad Classic"
},
{
"description":"Bunter Blattsalat",
"title":"Farmer Salad"
}
],
}
], (other days)
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
## Get a single day for a single site [sites/{site}/days/{weekday}]
Get information about a single day at a single site
+ Parameters
+ site: mensa (string) - Site name
+ weekday: tue (string) - Weekday name
### Get a single day for a single site [GET]
+ Response 200 (application/json)
+ Body
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 404 (application/json)
No menu for this day
+ Response 406 (application/json)
Invalid site or weekday value
## Get a single day for all site [sites/all/days/{weekday}]
Get information about a single day at all sites
+ Parameters
+ weekday: tue (string) - Weekday name
### Get a single day for a single site [GET]
+ Response 200 (application/json)
+ Body
{
"sites":[
{
"site":"SiteType.MENSA"
"days":[
{
"weekday":"Fr"
"date":"12.05.",
"menus":[
{
"description":"Merrfischchnusperli im Bierteig ",
"title":"Fish & Chips"
},
{
"description":"mit Menusalat",
"title":"Älpler Chääs Hörnli"
},
{
"description":"Kräuterbutter, Tagesbeilage und Gemüse vom Free Choice",
"title":"Schweins\u00adsteak vom Grill"
},
{
"description":"- Kabis mit Zwiebeln und Kurkuma",
"title":"Free - Choice Buffet"
}
],
}
]
},
{
"site":"SiteType.FORSCHUNGSZENTRUM"
"days":[
{
"weekday":"Fr",
"date":"12.05.",
"menus":[
{
"description":"Spaghetti mit verschiedenen Saucen zur Wahl:",
"title":"Spaghetti-Plausch"
},
{
"description":"mit gehobeltem Pecorino",
"title":"Papardelle al Cinque-Pi"
},
{
"description":"mit gebratenem Poulet, Speck,",
"title":"Caesar Salad Classic"
},
{
"description":"Bunter Blattsalat",
"title":"Farmer Salad"
}
],
}
]
}
]
}
+ Response 503 (application/json)
There is no data (normal on a weekend)
+ Response 404 (application/json)
No menu for this day
+ Response 406 (application/json)
Invalid weekday value
|
Fix double slashes
|
Fix double slashes
|
API Blueprint
|
mit
|
lroellin/hsr-mensa-scraper,lroellin/hsr-mensa-scraper
|
3fc130368e841fe28c6f332f75b5ccb5bbab59a7
|
API.apib
|
API.apib
|
FORMAT: 1A
# DraciDoupe.cz
API for exposing underying public data from DraciDoupe.cz.
## Entry Point [/]
### List available pages [GET]
+ Response 200 (application/json)
{
"creations": [
{
"name": "Tvorba",
"items": [
{
"name": "Články&Eseje",
"type": "article",
"_links": {"self": { "href": "/tvorba/clanky-a-eseje/" }}
},
{
"name": "Galerie",
"type": "photo",
"_links": {"self": { "href": "/tvorba/galerie/" }}
},
{
"name": "Fotogalerie",
"type": "photo",
"_links": {"self": { "href": "/tvorba/fotogalerie/" }}
},
{
"name": "Hřbitov",
"type": "article",
"_links": {"self": { "href": "/tvorba/hrbitov/" }}
}
]
},
{
"name": "Doplňky",
"items": [
{
"name": "Dovednosti",
"type": "skills",
"_links": {"self": { "href": "/doplnky/dovednosti/" }}
},
{
"name": "Nová Povolání",
"type": "article",
"_links": {"self": { "href": "/doplnky/nova-povolani/" }}
},
{
"name": "Nové Rasy",
"type": "article",
"_links": {"self": { "href": "/doplnky/nove-rasy/" }}
}
]
},
{
"name": "Pro PJ",
"items": [
{
"name": "Bestiář",
"type": "monster",
"_links": {"self": { "href": "/pro-pj/nestvury/" }}
},
{
"name": "Dobrodružství",
"type": "adventure",
"_links": {"self": { "href": "/pro-pj/dobrodruzstvi/" }}
},
{
"name": "Předměty",
"type": "game-object",
"_links": {"self": { "href": "/pro-pj/predmety/" }}
}
]
}
],
"news": [
{
"name": "Aktuality",
"items": [
{
"name": "Aktuality",
"type": "news",
"_links": {"self": { "href": "/aktuality/" }}
},
]
}
]
}
## News [/]
### Retrieve all news [GET]
+ Response 200 (application/json)
{
"name": "Aktuality",
"_links": {"self": { "href": "/aktuality/" }},
items: [
{
date: "2017-01-02 02:02:02",
title: "Example News",
text: "Text of news (tm)",
author: {
nick: "Unknown/N",
_url: "/uzivatele/123/"
}
},
{
date: "2017-01-01 01:01:01",
title: "Example News 2",
text: "Text of news (tm), but longer",
author: {
nick: "Unknown/N",
_url: "/uzivatele/123/"
}
}
]
}
|
FORMAT: 1A
# DraciDoupe.cz
API for exposing underying public data from DraciDoupe.cz.
## Entry Point [/]
### List available pages [GET]
+ Response 200 (application/json)
{
"creations": [
{
"name": "Tvorba",
"items": [
{
"name": "Články&Eseje",
"type": "article",
"_links": {"self": { "href": "/tvorba/clanky-a-eseje/" }}
},
{
"name": "Galerie",
"type": "photo",
"_links": {"self": { "href": "/tvorba/galerie/" }}
},
{
"name": "Fotogalerie",
"type": "photo",
"_links": {"self": { "href": "/tvorba/fotogalerie/" }}
},
{
"name": "Hřbitov",
"type": "article",
"_links": {"self": { "href": "/tvorba/hrbitov/" }}
}
]
},
{
"name": "Doplňky",
"items": [
{
"name": "Dovednosti",
"type": "skills",
"_links": {"self": { "href": "/doplnky/dovednosti/" }}
},
{
"name": "Nová Povolání",
"type": "article",
"_links": {"self": { "href": "/doplnky/nova-povolani/" }}
},
{
"name": "Nové Rasy",
"type": "article",
"_links": {"self": { "href": "/doplnky/nove-rasy/" }}
}
]
},
{
"name": "Pro PJ",
"items": [
{
"name": "Bestiář",
"type": "monster",
"_links": {"self": { "href": "/pro-pj/nestvury/" }}
},
{
"name": "Dobrodružství",
"type": "adventure",
"_links": {"self": { "href": "/pro-pj/dobrodruzstvi/" }}
},
{
"name": "Předměty",
"type": "game-object",
"_links": {"self": { "href": "/pro-pj/predmety/" }}
}
]
}
],
"news": [
{
"name": "Aktuality",
"items": [
{
"name": "Aktuality",
"type": "news",
"_links": {"self": { "href": "/aktuality/" }}
},
]
}
]
}
## News [/aktuality/]
### Retrieve all news [GET]
+ Response 200 (application/json)
{
"name": "Aktuality",
"_links": {"self": { "href": "/aktuality/" }},
items: [
{
date: "2017-01-02 02:02:02",
title: "Example News",
text: "Text of news (tm)",
author: {
nick: "Unknown/N",
_url: "/uzivatele/123/"
}
},
{
date: "2017-01-01 01:01:01",
title: "Example News 2",
text: "Text of news (tm), but longer",
author: {
nick: "Unknown/N",
_url: "/uzivatele/123/"
}
}
]
}
|
Fix URL typo
|
Fix URL typo
|
API Blueprint
|
mit
|
dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard
|
024214575b0a47b0b54b048cf5285c8992e32335
|
STATION-METADATA-API-BLUEPRINT.apib
|
STATION-METADATA-API-BLUEPRINT.apib
|
FORMAT: 1A
Station Metadata API
=============================
# General information
This is technical documentation for the Station Metadata API.
This document uses [API blueprint format](https://apiblueprint.org/documentation/).
Station Metadata is a service to get information about stations in GeoJSON format.
### Authentication
All endpoints are **secured** using OAuth2 authorization protocol with transmitting data over HTTPS.
The authorization flows are described here [authorization flow](http://oauthbible.com/#oauth-2-two-legged)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**station-metadata** is the scope which allows to request Point Observation Service.
#### Cache control headers:
if data unchanged since this date using the If-Modified-Since request header
the server will return with an empty body with the 304 response code.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
#Stations Metadata API
## Retrieve station metadata [/stations]
For any request all the GET HTTP parameters are optional.
+ Parameters
+ locatedWithin:
- {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box;
- {"type":"polygon","coordinates":[[-10,10],[10,5],[-5,-5]]} - polygon coordinates.
+ accessVisibility: `public` (string, optional) - parameter that filter **public** or **private** stations to show;
+ providerOrType: `WMO` (string, optional) - describes data provider or type;
+ type: `SKI_RESORT` (string, optional) - describes type of station place;
+ hasForecastData: `true` (boolean, optional) - show only stations that provide forecasts;
+ hasObservationData: `true` (boolean, optional) - show only stations that provide observations;
+ countryIsoCode: `DE` (string, optional) - filter stations by country ISO code.
### Get a stations metadata for Germany [GET]
####An example
'https://station-metadata.weather.mg/stations?countryIsoCode=DE&hasObservationData=true'
'https://station-metadata.weather.mg/stations?locatedWithin={"type":"polygon","coordinates":[[-10,10],[10,5],[-5,-5]]}'
'https://station-metadata.weather.mg/stations?locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}'
+ Response 200 (application/json)
+ Headers
Content-Type: application/json
Cache-Control: max-age=86400
Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"icaoCode": "EDXW",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10018,
"name": "Westerland/Sylt",
"providerStationId": "GWT",
"providerOrType": "AVIATION",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.35,
54.9167,
20
]
}
},
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10020,
"name": "List/Sylt",
"providerOrType": "WMO/DWD",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.4125,
55.0112,
26
]
}
}
]
}
|
FORMAT: 1A
Station Metadata API
=============================
# General information
This is technical documentation for the Station Metadata API.
This document uses [API blueprint format](https://apiblueprint.org/documentation/).
Station Metadata is a service to get information about stations in GeoJSON format.
### Authentication
All endpoints are **secured** using OAuth2 authorization protocol with transmitting data over HTTPS.
The authorization flows are described here [authorization flow](http://oauthbible.com/#oauth-2-two-legged)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**station-metadata** is the scope which allows to request Point Observation Service.
#### Cache control headers:
if data unchanged since this date using the If-Modified-Since request header
the server will return with an empty body with the 304 response code.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
#Stations Metadata API
## Retrieve station metadata [/stations]
For any request all the GET HTTP parameters are optional.
+ Parameters
+ locatedWithin:
- {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box;
- {"type":"polygon","coordinates":[[-10,10],[10,5],[-5,-5]]} - polygon coordinates.
+ accessVisibility: `public` (string, optional) - parameter that filter **public** or **private** stations to show;
+ providerOrType: `WMO` (string, optional) - describes data provider or type;
+ type: `SKI_RESORT` (string, optional) - describes type of station place;
+ hasForecastData: `true` (boolean, optional) - show only stations that provide forecasts;
+ hasObservationData: `true` (boolean, optional) - show only stations that provide observations;
+ countryIsoCode: `DE` (string, optional) - filter stations by country ISO code.
### Get a stations metadata for Germany [GET]
####An example
'https://station-metadata.weather.mg/stations?countryIsoCode=DE&hasObservationData=true'
'https://station-metadata.weather.mg/stations?locatedWithin={"type":"polygon","coordinates":[[-10,10],[10,5],[-5,-5]]}'
'https://station-metadata.weather.mg/stations?locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}'
ATTENTION! **locatedWithin** parameter has to be encoded before putting it to the request. As an example, might be used URL encoder: http://www.url-encode-decode.com/
+ Response 200 (application/json)
+ Headers
Content-Type: application/json
Cache-Control: max-age=86400
Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"icaoCode": "EDXW",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10018,
"name": "Westerland/Sylt",
"providerStationId": "GWT",
"providerOrType": "AVIATION",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.35,
54.9167,
20
]
}
},
{
"type": "Feature",
"properties": {
"accessVisibility": "public",
"countryIsoCode": "DE",
"hasForecastData": true,
"wmoCountryId": 69,
"meteoGroupStationId": 10020,
"name": "List/Sylt",
"providerOrType": "WMO/DWD",
"hasObservationData": true,
"stationTimeZoneName": "Europe/Berlin"
},
"geometry": {
"type": "Point",
"coordinates": [
8.4125,
55.0112,
26
]
}
}
]
}
|
Add information that locatedWithin must be encoded
|
Add information that locatedWithin must be encoded
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
f3dc804ac6d80baa8cd7398f6f7ba117005b63a9
|
source/fixtures/apib/composer.apib
|
source/fixtures/apib/composer.apib
|
FORMAT: 1A
# Hello API
## Group
### /message
#### GET
+ Response 200 (text/plain)
Hello World!
|
FORMAT: 1A
# Hello API
### /message
#### GET
+ Response 200 (text/plain)
Hello World!
|
Update composer fixture to remove empty group
|
fix: Update composer fixture to remove empty group
This was fixed in [email protected]
|
API Blueprint
|
mit
|
apiaryio/api.apiblueprint.org,apiaryio/api.apiblueprint.org
|
f7ca84f565846f4a3ca0ce2f7007e8c403d61ebf
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
Category related resources of the **Money Advice Service**.
## Category [/{locale}/categories/{id}]
A single category object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Category.
+ Values
+ `en`
+ `cy`
+ id (required, string, `life-events`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"contents":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
FORMAT: 1A
HOST: https://www.moneyadviceservice.org.uk
# Money Advice Service
API for the Money Advice Service, to be consumed by the responsive frontend.
# Group Categories
Category related resources of the **Money Advice Service**.
## Categories Collection [/{locale}/categories]
A collection of categories including their subcategories
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Categories.
+ Values
+ `en`
+ `cy`
### Retrieve all Categories [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/categories>; rel="alternate"; hreflang="cy"
+ Body
{
"id": "life-events",
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"subCategories": [
{
"id": "setting-up-home",
"title": "Setting up home",
"description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n",
"subCategories": [
]
}
]
}
## Category [/{locale}/categories/{id}]
A single category object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Category.
+ Values
+ `en`
+ `cy`
+ id (required, string, `life-events`) ... ID of the Category.
### Retrieve a Category [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd"
+ Body
{
"title": "Life events",
"description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n",
"id":"life-events",
"contents":[
{
"id":"setting-up-home",
"type":"category",
"title":"Setting up home",
"description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n"
},
{
"id":"how-much-rent-can-you-afford",
"type":"guide",
"title":"How much rent can you afford?",
"description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in"
}
]
}
# Group Articles
Article related resources of the **Money Advice Service**.
## Article [/{locale}/articles/{id}]
A single Article object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Article.
+ Values
+ `en`
+ `cy`
+ id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article.
### Retrieve an Article [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled"
+ Body
{
"title": "Where to go to get free debt advice",
"description": "Find out where you can get free, confidential help if you are struggling with debt",
"body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>"
}
# Group Action Plans
Action Plan related resources of the **Money Advice Service**.
## Action Plan [/{locale}/action_plans/{id}]
A single Action Plan object with all its details
+ Parameters
+ locale = `en` (optional, string, `en`) ... Locale of the Action Plan.
+ Values
+ `en`
+ `cy`
### Retrieve an Action Plan [GET]
+ Response 200 (application/json)
+ Header
Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol"
+ Body
{
"title": "Prepare for the cost of having a baby",
"description": "A handy action plan which can help with planning of the costs involved in having a new baby",
"body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>"
}
|
Document /categories endpoint
|
Document /categories endpoint
|
API Blueprint
|
mit
|
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
|
62b5dcdae79599c5009956b674b54191f840f488
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://d.kukua.tech:8080/
# ConCaVa API
The ConCaVa API allows you to manage ConCaVa metadata.
The documentation for ConCaVa can be found here: https://kukua.github.io/concava/.
## Query parameters [/query-params]
### Filtering [GET /v1/devices?filter=template_id:2]
Use the `filter` query parameter. Use `key:value` pairs. Comma separated.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
[
{
"id": 3,
"template_id": 1,
...
},
{
"id": 4,
"template_id": 2,
...
},
{
"id": 5,
"template_id": 3,
...
},
...
}
### Ordering [GET /v1/devices?order=name]
Use the `order` query parameter. Comma separated.
For a descending order prefix with a dash, like: `-udid`.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
[
{
"name": "Template A",
"udid": "0000000000000001",
...
},
{
"name": "Template B",
"udid": "0000000000000002",
...
},
...
}
### Including relationships [GET /v1/devices?include=template]
Use the `include` query parameter. Comma separated.
Use dots for including sub relations, like: `template.attributes`.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
{
"id": 4,
"udid": "0000000000000001",
...
"template": {
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
}
## Error responses [/errors]
General error responses that apply to all resources. These examples are for the devices.
### Unauthorized request [GET /v1/devices/1]
+ Request
+ Headers
Authorization: Token <invalid token>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Unauthorized."
}
### Find/Update/Delete Non-Existing Device [GET /v1/devices/1234]
+ Request
+ Headers
Authorization: Token <token>
+ Response 404 (application/json)
{
"status": 404,
"code": 0,
"message": "Entity not found."
}
### Create Device [POST /v1/devices]
+ Request (application/json)
{
"name": "John Doe"
}
+ Response 400 (application/json)
{
"messages": {
"email": ["The email field is required."],
"password": ["The password field is required."]
}
}
### Delete Device Of Other Account [DELETE /v1/devices/1]
+ Request
+ Headers
Authorization: Token <token>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Not allowed to delete entity."
}
## Users [/v1/users]
Relationships: `devices`, `templates`, and `tokens`.
### Log In User [GET /v1/users/login]
Retrieve user information by providing a Basic Authentication header.
The token can be used for authenticating subsequent requests.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"is_active": true,
"is_admin": false,
"token": "d352d3843fe50e5dc14a3fe0d228da25",
"last_login": "2016-07-12 14:41:48",
"created_at": "2016-07-12 14:41:48",
"updated_at": "2016-07-12 14:41:48",
}
+ Request
+ Headers
Authorization: Basic <base64 encoded <invalid email>:<invalid password>>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Invalid credentials."
}
### Register User [POST]
Registering your own user account is required to create and modify the other entities.
The API has an option for open registration,
so everyone can use the API (found in the `www/.env` file).
+ Request (application/json)
{
"name": "John Doe",
"email": "[email protected]",
"password": "securepassword"
}
+ Response 200 (application/json)
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"is_active": true,
"is_admin": false,
"token": "d352d3843fe50e5dc14a3fe0d228da25",
"last_login": "2016-07-12 14:41:48",
"created_at": "2016-07-12 14:41:48",
"updated_at": "2016-07-12 14:41:48",
}
## Templates [/v1/templates]
Relationships: `user`, `devices`, and `attributes`.
### List Templates [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
},
...
]
### Get Template [GET /v1/templates/{id}]
+ Parameters
+ id (number) - ID of the template
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Create Template [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "My Template"
}
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Update Template [PUT /v1/templates/{id}]
+ Parameters
+ id (number) - ID of the template
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "Other Name For My Template"
}
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "Other Name For My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Delete Template [DELETE /v1/templates/{id}]
Deleting a template also deletes it's attributes.
+ Parameters
+ id (number) - ID of the template
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
## Attributes [/v1/attributes]
Relationships: `template`, `converters`, `calibrators`, and `validators`.
### List Attributes [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
},
...
]
### Get Attribute [GET /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Create Attribute [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"name": "temperature",
"order": 0,
"converter": "int16le",
"calibrator": "return val / 10",
"validators": "min=-100 max=100"
}
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Update Attribute [PUT /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "temp"
}
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temp",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Delete Attribute [DELETE /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Reorder Attributes [PUT /v1/attributes/reorder]
Specify attribute order by providing a template ID and array with attribute IDs.
+ Request
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"order": [3, 2, 1]
}
+ Response 200 (application/json)
{}
## Devices [/v1/devices]
Relationships: `users` and `template`.
### List Devices [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
},
...
]
### Get Device [GET /v1/devices/{id}]
+ Parameters
+ id (number) - ID of the device
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Create Device [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
}
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Update Device [PUT /v1/devices/{id}]
+ Parameters
+ id (number) - ID of the device
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "Other Name For My Device"
}
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "Other Name For My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Delete Device [DELETE /v1/devices/{id}]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
|
FORMAT: 1A
HOST: http://d.kukua.tech:8080/
# ConCaVa API
The ConCaVa API allows you to manage ConCaVa metadata.
The documentation for ConCaVa can be found here: https://kukua.github.io/concava/.
## Query parameters [/query-params]
### Filtering [GET /v1/devices?filter=template_id:2]
Use the `filter` query parameter. Use `key:value` pairs. Comma separated.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
[
{
"id": 3,
"template_id": 1,
...
},
{
"id": 4,
"template_id": 2,
...
},
{
"id": 5,
"template_id": 3,
...
},
...
}
### Ordering [GET /v1/devices?order=name]
Use the `order` query parameter. Comma separated.
For a descending order prefix with a dash, like: `-udid`.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
[
{
"name": "Template A",
"udid": "0000000000000001",
...
},
{
"name": "Template B",
"udid": "0000000000000002",
...
},
...
}
### Including relationships [GET /v1/devices?include=template]
Use the `include` query parameter. Comma separated.
Use dots for including sub relations, like: `template.attributes`.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
{
"id": 4,
"udid": "0000000000000001",
...
"template": {
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
}
## Error responses [/errors]
General error responses that apply to all resources. These examples are for the devices.
### Unauthorized request [GET /v1/devices/1]
+ Request
+ Headers
Authorization: Token <invalid token>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Unauthorized."
}
### Find/Update/Delete Non-Existing Device [GET /v1/devices/1234]
+ Request
+ Headers
Authorization: Token <token>
+ Response 404 (application/json)
{
"status": 404,
"code": 0,
"message": "Entity not found."
}
### Create Device [POST /v1/devices]
+ Request (application/json)
{
"name": "John Doe"
}
+ Response 400 (application/json)
{
"messages": {
"email": ["The email field is required."],
"password": ["The password field is required."]
}
}
### Delete Device Of Other Account [DELETE /v1/devices/1]
+ Request
+ Headers
Authorization: Token <token>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Not allowed to delete entity."
}
## Users [/v1/users]
Relationships: `devices`, `templates`, and `tokens`.
### Log In User [GET /v1/users/login]
Retrieve user information by providing a Basic Authentication header.
The token can be used for authenticating subsequent requests.
+ Request
+ Headers
Authorization: Basic <base64 encoded <email>:<password>>
+ Response 200 (application/json)
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"is_active": true,
"is_admin": false,
"token": "d352d3843fe50e5dc14a3fe0d228da25",
"last_login": "2016-07-12 14:41:48",
"created_at": "2016-07-12 14:41:48",
"updated_at": "2016-07-12 14:41:48",
}
+ Request
+ Headers
Authorization: Basic <base64 encoded <invalid email>:<invalid password>>
+ Response 401 (application/json)
{
"status": 401,
"code": 0,
"message": "Invalid credentials."
}
### Register User [POST]
Registering your own user account is required to create and modify the other entities.
The API has an option for open registration,
so everyone can use the API (found in the `www/.env` file).
+ Request (application/json)
{
"name": "John Doe",
"email": "[email protected]",
"password": "securepassword"
}
+ Response 200 (application/json)
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"is_active": true,
"is_admin": false,
"token": "d352d3843fe50e5dc14a3fe0d228da25",
"last_login": "2016-07-12 14:41:48",
"created_at": "2016-07-12 14:41:48",
"updated_at": "2016-07-12 14:41:48",
}
## Templates [/v1/templates]
Relationships: `user`, `devices`, and `attributes`.
### List Templates [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
},
...
]
### Get Template [GET /v1/templates/{id}]
+ Parameters
+ id (number) - ID of the template
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Create Template [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "My Template"
}
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Update Template [PUT /v1/templates/{id}]
+ Parameters
+ id (number) - ID of the template
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "Other Name For My Template"
}
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "Other Name For My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Delete Template [DELETE /v1/templates/{id}]
Deleting a template also deletes it's attributes.
+ Parameters
+ id (number) - ID of the template
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 2,
"user_id": 1,
"name": "My Template",
"created_at": "2016-07-12 15:21:05",
"updated_at": "2016-07-12 15:21:05"
}
### Duplicate Template [POST /v1/templates/{id}/duplicate]
+ Parameters
+ id (number) - ID of the template
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 3,
"user_id": 1,
"name": "My Template (copy)",
"created_at": "2016-08-02 14:15:43",
"updated_at": "2016-08-02 14:15:43"
}
## Attributes [/v1/attributes]
Relationships: `template`, `converters`, `calibrators`, and `validators`.
### List Attributes [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
},
...
]
### Get Attribute [GET /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Create Attribute [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"name": "temperature",
"order": 0,
"converter": "int16le",
"calibrator": "return val / 10",
"validators": "min=-100 max=100"
}
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Update Attribute [PUT /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "temp"
}
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temp",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Delete Attribute [DELETE /v1/attributes/{id}]
+ Parameters
+ id (number) - ID of the attribute
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 3,
"template_id": 2,
"name": "temperature",
"order": 0,
"created_at": "2016-07-12 15:27:21",
"updated_at": "2016-07-12 15:27:21"
}
### Reorder Attributes [PUT /v1/attributes/reorder]
Specify attribute order by providing a template ID and array with attribute IDs.
+ Request
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"order": [3, 2, 1]
}
+ Response 200 (application/json)
{}
## Devices [/v1/devices]
Relationships: `users` and `template`.
### List Devices [GET]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
[
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
},
...
]
### Get Device [GET /v1/devices/{id}]
+ Parameters
+ id (number) - ID of the device
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Create Device [POST]
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
}
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Update Device [PUT /v1/devices/{id}]
+ Parameters
+ id (number) - ID of the device
+ Request (application/json)
+ Headers
Authorization: Token <token>
+ Body
{
"name": "Other Name For My Device"
}
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "Other Name For My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
### Delete Device [DELETE /v1/devices/{id}]
+ Request
+ Headers
Authorization: Token <token>
+ Response 200 (application/json)
{
"id": 4,
"template_id": 2,
"name": "My Device",
"udid": "0000000000000001"
"created_at": "2016-07-12 15:29:45",
"updated_at": "2016-07-12 15:29:45"
}
|
Add template duplicate route to documentation.
|
Add template duplicate route to documentation.
|
API Blueprint
|
mit
|
kukua/concava-api
|
e67f8cf5d1ff87a62dadab295cb890c791144525
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# Coolector
API to collect different taggable items in sets.
## List and Add items to a set [/items]
### List items [GET]
+ Response 200 (application/json)
[
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
},
{
"id": 2
"url": "http://www.domain.name/resource_normalized_by_server_2.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
]
### Create a new item [POST]
You may create your own question using this action. It takes a JSON
object containing a question and a collection of answers in the
form of choices.
+ Request (application/json)
{
"url": "http://www.domain.name/resource.html",
"tags": [
"friends",
"vacation"
],
"collectors": [
{
"name": "jquery",
"value": "<html>|http://www.image.jpg"
}
]
}
+ Response 201 (application/json)
+ Headers
Location: /items/1
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-05 08:40:51+01:00",
"tags": [
"friends",
"vacation"
]
}
## Get, Update or Delete existing items [/items/{item_id}]
+ Parameters
+ item_id: 1 (number) - ID of the item that you need to update
### Get an item by ID [GET]
+ Response 201 (application/json)
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
### Update an existing item [PUT]
Updating an existing item is restricted in updating only the list of tags that describe that particular item.
The only other option to update the URL is to delete curent item and create a new one.
+ Request (application/json)
{
"tags": [
"friends",
"cool"
]
}
+ Response 201 (application/json)
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
|
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# Coolector
API to collect different taggable items in sets.
## Registration [/register]
### Register [POST]
Create new user simply providing an email and a password
+ Request (application/json)
{
"email": "username",
"password": "password"
}
+ Response 204 (application/json)
+ Response 409 (application/json)
{
"message": "Email address already exists"
}
## Authentication [/authenticate]
### Authenticate [POST]
Generate a new JSON Web Token
+ Request (application/json)
{
"email": "username",
"password": "password"
}
+ Response 200 (application/json)
{
"token: "JSON_Web_Token"
}
+ Response 404 (application/json)
{
"message": "Email or Password incorrect"
}
## List and Add items to a set [/items]
### List items [GET]
+ Request (application/json)
+ Headers
Authorization: Bearer JSON_Web_Token
+ Response 200 (application/json)
[
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
},
{
"id": 2
"url": "http://www.domain.name/resource_normalized_by_server_2.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
]
### Create a new item [POST]
You may create your own question using this action. It takes a JSON
object containing a question and a collection of answers in the
form of choices.
+ Request (application/json)
+ Headers
Authorization: Bearer JSON_Web_Token
+ Body
{
"url": "http://www.domain.name/resource.html",
"tags": [
"friends",
"vacation"
],
"collectors": [
{
"name": "jquery",
"value": "<html>|http://www.image.jpg"
}
]
}
+ Response 201 (application/json)
+ Headers
Location: /items/1
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-05 08:40:51+01:00",
"tags": [
"friends",
"vacation"
]
}
## Get, Update or Delete existing items [/items/{item_id}]
+ Parameters
+ item_id: 1 (number) - ID of the item that you need to update
### Get an item by ID [GET]
+ Request (application/json)
+ Headers
Authorization: Bearer JSON_Web_Token
+ Response 201 (application/json)
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
### Update an existing item [PUT]
Updating an existing item is restricted in updating only the list of tags that describe that particular item.
The only other option to update the URL is to delete curent item and create a new one.
+ Request (application/json)
+ Headers
Authorization: Bearer JSON_Web_Token
+ Body
{
"tags": [
"friends",
"cool"
]
}
+ Response 201 (application/json)
+ Body
{
"id": 1,
"url": "http://www.domain.name/resource_normalized_by_server.html",
"created_at": "2015-08-05 08:40:51+01:00",
"updated_at": "2015-08-06 08:40:51+01:00",
"tags": [
"friends",
"cool"
]
}
|
Add authorization and register endpoints
|
Add authorization and register endpoints
|
API Blueprint
|
mit
|
coolector/api,coolector/api
|
190c4ea3ffc144a1bdcbd0a9efe7b384538e9999
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
HOST: https://orgmanager.miguelpiedrafita.com/api
# Orgmanager API
The Orgmanager API allows you to integrate Orgmanager with other applications and projects.
## User Data [/user]
### Get user info [GET]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id":1,
"name":"Miguel Piedrafita",
"email":"[email protected]",
"github_username":"m1guelpf",
"created_at":"2017-01-25 18:44:32",
"updated_at":"2017-02-16 19:40:50"
}
## User Organizations [/user/orgs]
### Get user organizations [GET]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id":1,
"name":"Test Organization",
"url":"https:\/\/api.github.com\/orgs\/test-org",
"description":null,
"avatar":"https:\/\/miguelpiedrafita.com\/logo.png",
"invitecount":100
}
|
FORMAT: 1A
HOST: https://orgmanager.miguelpiedrafita.com/api
# Orgmanager API
The Orgmanager API allows you to integrate Orgmanager with other applications and projects.
## User Data [/user]
### Get user info [GET]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id":1,
"name":"Miguel Piedrafita",
"email":"[email protected]",
"github_username":"m1guelpf",
"created_at":"2017-01-25 18:44:32",
"updated_at":"2017-02-16 19:40:50"
}
## User Organizations [/user/orgs]
### Get user organizations [GET]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id":1,
"name":"Test Organization",
"url":"https:\/\/api.github.com\/orgs\/test-org",
"description":null,
"avatar":"https:\/\/miguelpiedrafita.com\/logo.png",
"invitecount":100
}
## Organizations [/org/{id}]
### Get organization info [GET]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id": 1,
"name": "Test Org",
"url": "https://api.github.com/orgs/test-org",
"description": null,
"avatar": "https://avatars.githubusercontent.com/1",
"invitecount": 0
}
### Change organization password [POST]
+ Request
{
"password": "{newpassword}"
}
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 200 (application/json)
{
"id": 1,
"name": "Test Org",
"url": "https://api.github.com/orgs/test-org",
"description": null,
"avatar": "https://avatars.githubusercontent.com/1",
"invitecount": 0,
"password": "{newpassword}"
}
### Update organization [PUT]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 204 (text/html; charset=UTF-8)
### Delete organization [DELETE]
+ Request
+ Headers
Content-Type: application/json
Accept: application/json
Authorization: bearer {token}
+ Response 204 (text/html; charset=UTF-8)
|
Add ORG endpoints to the API documentation
|
:memo: Add ORG endpoints to the API documentation
|
API Blueprint
|
mpl-2.0
|
orgmanager/orgmanager,orgmanager/orgmanager,orgmanager/orgmanager
|
f9a74b5b95afc9438fb1ffb9f3b65545da343bba
|
xos/tests/api/apiary.apib
|
xos/tests/api/apiary.apib
|
FORMAT: 1A
# XOS
# Group Example
## Example Services Collection [/api/service/exampleservice/]
### List all Example Services [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "MyExample",
"id": 1,
"service_message": "This is the test message"
}
]
# Group ONOS Services
## ONOS Services Collection [/api/service/onos/]
### List all ONOS Services [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "service_ONOS_vBNG",
"id": 5,
"rest_hostname": "",
"rest_port": "8181",
"no_container": false,
"node_key": ""
}
]
# Group vSG
## vSG Collection [/api/service/vsg/]
### List all vSGs [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "service_vsg",
"id": 2,
"wan_container_gateway_ip": "",
"wan_container_gateway_mac": "",
"dns_servers": "8.8.8.8",
"url_filter_kind": null,
"node_label": null
}
]
# Group Subscribers
Resource related to the CORD Subscribers.
## Subscribers Collection [/api/tenant/cord/subscriber/]
### List All Subscribers [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "cordSubscriber-1",
"id": 1,
"features": {
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": false,
"status": "enabled"
},
"identity": {
"account_num": "123",
"name": "My House"
},
"related": {
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"compute_node_name": "node2.opencloud.us",
"c_tag": "432",
"instance_id": 1,
"wan_container_ip": null,
"volt_id": 3,
"s_tag": "222"
}
}
]
## Subscriber Detail [/api/tenant/cord/subscriber/{subscriber_id}/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
### View a Subscriber Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "cordSubscriber-1",
"id": 1,
"features": {
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": false,
"status": "enabled"
},
"identity": {
"account_num": "123",
"name": "My House"
},
"related": {
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"compute_node_name": "node2.opencloud.us",
"c_tag": "432",
"instance_id": 1,
"wan_container_ip": null,
"volt_id": 3,
"s_tag": "222"
}
}
### Delete a Subscriber [DELETE]
+ Response 204
### Subscriber features [/api/tenant/cord/subscriber/{subscriber_id}/features/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
### View a Subscriber Features Detail [GET]
+ Response 200 (application/json)
{
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": true,
"status": "enabled"
}
#### Subscriber features uplink_speed [/api/tenant/cord/subscriber/{subscriber_id}/features/uplink_speed/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber uplink_speed [GET]
+ Response 200 (application/json)
{
"uplink_speed": 1000000000
}
#### Update Subscriber uplink_speed [PUT]
+ Request 200 (application/json)
{
"uplink_speed": 1000000000
}
+ Response 200 (application/json)
{
"uplink_speed": 1000000000
}
#### Subscriber features downlink_speed [/api/tenant/cord/subscriber/{subscriber_id}/features/downlink_speed/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber downlink_speed [GET]
+ Response 200 (application/json)
{
"downlink_speed": 1000000000
}
#### Update Subscriber downlink_speed [PUT]
+ Request 200 (application/json)
{
"downlink_speed": 1000000000
}
+ Response 200 (application/json)
{
"downlink_speed": 1000000000
}
#### Subscriber features cdn [/api/tenant/cord/subscriber/{subscriber_id}/features/cdn/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber cdn [GET]
+ Response 200 (application/json)
{
"cdn": false
}
#### Update Subscriber cdn [PUT]
+ Request 200 (application/json)
{
"cdn": false
}
+ Response 200 (application/json)
{
"cdn": false
}
#### Subscriber features uverse [/api/tenant/cord/subscriber/{subscriber_id}/features/uverse/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber uverse [GET]
+ Response 200 (application/json)
{
"uverse": false
}
#### Update Subscriber uverse [PUT]
+ Request 200 (application/json)
{
"uverse": false
}
+ Response 200 (application/json)
{
"uverse": false
}
#### Subscriber features status [/api/tenant/cord/subscriber/{subscriber_id}/features/status/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber status [GET]
+ Response 200 (application/json)
{
"status": "enabled"
}
#### Update Subscriber status [PUT]
+ Request 200 (application/json)
{
"status": "enabled"
}
+ Response 200 (application/json)
{
"status": "enabled"
}
# Group Truckroll
Virtual Truckroll, enable to perform basic test on user connectivity such as ping, traceroute and tcpdump.
## Truckroll Collection [/api/tenant/truckroll/]
### List all Truckroll [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "vTR-tenant-9",
"id": 9,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": "",
"result_code": "",
"is_synced": false,
"backend_status": "2 - Exception('Unreachable results in ansible recipe',)"
}
]
### Create a Truckroll [POST]
+ Request (application/json)
{
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8"
}
+ Response 201 (application/json)
{
"humanReadableName": "vTR-tenant-1",
"id": 1,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": null,
"result_code": null,
"is_synced": false,
"backend_status": "0 - Provisioning in progress"
}
## Truckroll Detail [/api/tenant/truckroll/{truckroll_id}/]
A virtual truckroll is complete once is_synced equal true
+ Parameters
+ truckroll_id: 1 (number) - ID of the Truckroll in the form of an integer
### View a Truckroll Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "vTR-tenant-10",
"id": 10,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": null,
"result_code": null,
"is_synced": false,
"backend_status": "0 - Provisioning in progress"
}
### Delete a Truckroll Detail [DELETE]
+ Response 204
# Group vOLT
OLT devices aggregate a set of subscriber connections
## vOLT Collection [/api/tenant/cord/volt/]
### List all vOLT [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
]
### Create a vOLT [POST]
+ Request (application/json)
{
"s_tag": "222",
"c_tag": "432",
"subscriber": 1
}
+ Response 201 (application/json)
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
## vOLT Detail [/api/tenant/cord/volt/{volt_id}/]
A virtual volt is complete once is_synced equal true
+ Parameters
+ volt_id: 1 (number) - ID of the vOLT in the form of an integer
### View a vOLT Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
# Group ONOS Apps
## app Collection [/api/tenant/onos/app/]
### List all apps [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "onos-tenant-7",
"id": 7,
"name": "vBNG_ONOS_app",
"dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
}
]
|
FORMAT: 1A
# XOS
# Group Example
## Example Services Collection [/api/service/exampleservice/]
### List all Example Services [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "MyExample",
"id": 1,
"service_message": "This is the test message"
}
]
# Group ONOS Services
## ONOS Services Collection [/api/service/onos/]
### List all ONOS Services [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "service_ONOS_vBNG",
"id": 5,
"rest_hostname": "",
"rest_port": "8181",
"no_container": false,
"node_key": ""
}
]
# Group vSG
## vSG Collection [/api/service/vsg/]
### List all vSGs [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "service_vsg",
"id": 2,
"dns_servers": "8.8.8.8",
"url_filter_kind": null,
"node_label": null
}
]
# Group Subscribers
Resource related to the CORD Subscribers.
## Subscribers Collection [/api/tenant/cord/subscriber/]
### List All Subscribers [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "cordSubscriber-1",
"id": 1,
"features": {
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": false,
"status": "enabled"
},
"identity": {
"account_num": "123",
"name": "My House"
},
"related": {
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"compute_node_name": "node2.opencloud.us",
"c_tag": "432",
"instance_id": 1,
"wan_container_ip": null,
"volt_id": 3,
"s_tag": "222"
}
}
]
## Subscriber Detail [/api/tenant/cord/subscriber/{subscriber_id}/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
### View a Subscriber Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "cordSubscriber-1",
"id": 1,
"features": {
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": false,
"status": "enabled"
},
"identity": {
"account_num": "123",
"name": "My House"
},
"related": {
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"compute_node_name": "node2.opencloud.us",
"c_tag": "432",
"instance_id": 1,
"wan_container_ip": null,
"volt_id": 3,
"s_tag": "222"
}
}
### Delete a Subscriber [DELETE]
+ Response 204
### Subscriber features [/api/tenant/cord/subscriber/{subscriber_id}/features/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
### View a Subscriber Features Detail [GET]
+ Response 200 (application/json)
{
"cdn": false,
"uplink_speed": 1000000000,
"downlink_speed": 1000000000,
"uverse": true,
"status": "enabled"
}
#### Subscriber features uplink_speed [/api/tenant/cord/subscriber/{subscriber_id}/features/uplink_speed/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber uplink_speed [GET]
+ Response 200 (application/json)
{
"uplink_speed": 1000000000
}
#### Update Subscriber uplink_speed [PUT]
+ Request 200 (application/json)
{
"uplink_speed": 1000000000
}
+ Response 200 (application/json)
{
"uplink_speed": 1000000000
}
#### Subscriber features downlink_speed [/api/tenant/cord/subscriber/{subscriber_id}/features/downlink_speed/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber downlink_speed [GET]
+ Response 200 (application/json)
{
"downlink_speed": 1000000000
}
#### Update Subscriber downlink_speed [PUT]
+ Request 200 (application/json)
{
"downlink_speed": 1000000000
}
+ Response 200 (application/json)
{
"downlink_speed": 1000000000
}
#### Subscriber features cdn [/api/tenant/cord/subscriber/{subscriber_id}/features/cdn/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber cdn [GET]
+ Response 200 (application/json)
{
"cdn": false
}
#### Update Subscriber cdn [PUT]
+ Request 200 (application/json)
{
"cdn": false
}
+ Response 200 (application/json)
{
"cdn": false
}
#### Subscriber features uverse [/api/tenant/cord/subscriber/{subscriber_id}/features/uverse/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber uverse [GET]
+ Response 200 (application/json)
{
"uverse": false
}
#### Update Subscriber uverse [PUT]
+ Request 200 (application/json)
{
"uverse": false
}
+ Response 200 (application/json)
{
"uverse": false
}
#### Subscriber features status [/api/tenant/cord/subscriber/{subscriber_id}/features/status/]
+ Parameters
+ subscriber_id: 1 (number) - ID of the Subscriber in the form of an integer
#### Read Subscriber status [GET]
+ Response 200 (application/json)
{
"status": "enabled"
}
#### Update Subscriber status [PUT]
+ Request 200 (application/json)
{
"status": "enabled"
}
+ Response 200 (application/json)
{
"status": "enabled"
}
# Group Truckroll
Virtual Truckroll, enable to perform basic test on user connectivity such as ping, traceroute and tcpdump.
## Truckroll Collection [/api/tenant/truckroll/]
### List all Truckroll [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "vTR-tenant-9",
"id": 9,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": "",
"result_code": "",
"is_synced": false,
"backend_status": "2 - Exception('Unreachable results in ansible recipe',)"
}
]
### Create a Truckroll [POST]
+ Request (application/json)
{
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8"
}
+ Response 201 (application/json)
{
"humanReadableName": "vTR-tenant-1",
"id": 1,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": null,
"result_code": null,
"is_synced": false,
"backend_status": "0 - Provisioning in progress"
}
## Truckroll Detail [/api/tenant/truckroll/{truckroll_id}/]
A virtual truckroll is complete once is_synced equal true
+ Parameters
+ truckroll_id: 1 (number) - ID of the Truckroll in the form of an integer
### View a Truckroll Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "vTR-tenant-10",
"id": 10,
"provider_service": 6,
"target_id": 2,
"scope": "container",
"test": "ping",
"argument": "8.8.8.8",
"result": null,
"result_code": null,
"is_synced": false,
"backend_status": "0 - Provisioning in progress"
}
### Delete a Truckroll Detail [DELETE]
+ Response 204
# Group vOLT
OLT devices aggregate a set of subscriber connections
## vOLT Collection [/api/tenant/cord/volt/]
### List all vOLT [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
]
### Create a vOLT [POST]
+ Request (application/json)
{
"s_tag": "222",
"c_tag": "432",
"subscriber": 1
}
+ Response 201 (application/json)
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
## vOLT Detail [/api/tenant/cord/volt/{volt_id}/]
A virtual volt is complete once is_synced equal true
+ Parameters
+ volt_id: 1 (number) - ID of the vOLT in the form of an integer
### View a vOLT Detail [GET]
+ Response 200 (application/json)
{
"humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
"subscriber": 1,
"related": {
"instance_id": 1,
"instance_name": "mysite_vcpe",
"vsg_id": 4,
"wan_container_ip": null,
"compute_node_name": "node2.opencloud.us"
}
}
# Group ONOS Apps
## app Collection [/api/tenant/onos/app/]
### List all apps [GET]
+ Response 200 (application/json)
[
{
"humanReadableName": "onos-tenant-7",
"id": 7,
"name": "vBNG_ONOS_app",
"dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
}
]
|
remove fields that are no longer present in vSG service
|
remove fields that are no longer present in vSG service
|
API Blueprint
|
apache-2.0
|
cboling/xos,cboling/xos,jermowery/xos,jermowery/xos,cboling/xos,xmaruto/mcord,jermowery/xos,jermowery/xos,xmaruto/mcord,xmaruto/mcord,xmaruto/mcord,cboling/xos,cboling/xos
|
542efdcc7d9859a4b4e4a15a95bfe1d125bb3c88
|
apiary.apib
|
apiary.apib
|
FORMAT: 1A
# elasticthought
REST API wrapper for Caffe
# Group User
Related resources of the **User API**
## Users Collection [/users]
### Create a User [POST]
+ Request (application/json)
{
"username": "foo",
"email": "[email protected]",
"password": "bar"
}
+ Response 201
# Group Data
Related resources of the **Data API**
## Datafiles Collection [/datafiles]
### Create a Datafile [POST]
The url passed in the JSON must point to a .tar.gz file. That is currently the only format allowed.
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{ "url": "http://s3.com/mnist-data.tar.gz" }
+ Response 201 (application/json)
{ "id": "datafile-uuid" }
## Datasets Collection [/datasets]
### Create a Dataset [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"datafile-id": "datafile-uuid",
"training": {
"split-percentage": 0.7
},
"testing": {
"split-percentage": 0.3
}
}
+ Response 201 (application/json)
{
"_id": "dataset-uuid"
"datafile-id": "datafile-uuid",
"processing-state": "pending",
"training": {
"split-percentage": 0.7
},
"testing": {
"split-percentage": 0.3
}
}
# Group Training
Related resources of the **Training API**
## Solvers Collection [/solvers]
### Create a Solver [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"dataset-id": "<dataset-uuid>",
"specification-url": "http://s3.com/mnist_solver.prototxt",
"specification-net-url": "http://s3.com/mnist_train_test.prototxt"
}
+ Response 201 (application/json)
{ "id": "solver-uuid" }
## Training Jobs Collection [/training-jobs]
After a solver is defined, create a training job that will use the solver to train a model.
### Create a Training Job [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"solver": "solver-uuid"
}
+ Response 201 (application/json)
{
"id": "training-job-uuid",
"processing-state": "pending"
}
## Training Job Status [/training-jobs/{id}/status]
The status of the Training Job
+ Parameters
+ id (required, string, `training-job-uuid`) ... The id of the training job.
### Training Job Status [GET]
+ Request
+ Headers
Authorization: Token 527d11fe429f3426cb8dbeba183a0d80
+ Response 200 (application/json)
{
"id": "training-job-uuid",
"state": "running",
"loss": 0.0013,
"last-iteration": 2000,
"max-iterations": 10000,
"logs": "/training-jobs/{training-job-uuid}/logs"
}
## Training Job Logs [/training-jobs/{id}/logs]
The logs of the Training Job. Currently returns entire text file, but in the future
it will support websocket streaming.
+ Parameters
+ id (required, string, `training-job-uuid`) ... The id of the training job.
### Training Job Logs [GET]
+ Request
+ Headers
Authorization: Token 527d11fe429f3426cb8dbeba183a0d80
+ Response 200 (text/plain)
# Group Prediction
Related resources of the **Prediction API**
|
FORMAT: 1A
# elasticthought
REST API wrapper for Caffe
# Group User
Related resources of the **User API**
## Users Collection [/users]
### Create a User [POST]
+ Request (application/json)
{
"username": "foo",
"email": "[email protected]",
"password": "bar"
}
+ Response 201
# Group Data
Related resources of the **Data API**
## Datafiles Collection [/datafiles]
### Create a Datafile [POST]
The url passed in the JSON must point to a .tar.gz file. That is currently the only format allowed.
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{ "url": "http://s3.com/mnist-data.tar.gz" }
+ Response 201 (application/json)
{ "id": "datafile-uuid" }
## Datasets Collection [/datasets]
### Create a Dataset [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"datafile-id": "datafile-uuid",
"training": {
"split-percentage": 0.7
},
"testing": {
"split-percentage": 0.3
}
}
+ Response 201 (application/json)
{
"_id": "dataset-uuid"
"datafile-id": "datafile-uuid",
"processing-state": "pending",
"training": {
"split-percentage": 0.7
},
"testing": {
"split-percentage": 0.3
}
}
# Group Training
Related resources of the **Training API**
## Solvers Collection [/solvers]
### Create a Solver [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"dataset-id": "<dataset-id>",
"specification-url": "http://s3.com/mnist_solver.prototxt",
"specification-net-url": "http://s3.com/mnist_train_test.prototxt"
}
+ Response 201 (application/json)
{ "id": "solver-uuid" }
## Training Jobs Collection [/training-jobs]
After a solver is defined, create a training job that will use the solver to train a model.
### Create a Training Job [POST]
+ Request (application/json)
+ Header
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ Body
{
"solver": "solver-uuid"
}
+ Response 201 (application/json)
{
"id": "training-job-uuid",
"processing-state": "pending"
}
## Training Job Status [/training-jobs/{id}/status]
The status of the Training Job
+ Parameters
+ id (required, string, `training-job-uuid`) ... The id of the training job.
### Training Job Status [GET]
+ Request
+ Headers
Authorization: Token 527d11fe429f3426cb8dbeba183a0d80
+ Response 200 (application/json)
{
"id": "training-job-uuid",
"state": "running",
"loss": 0.0013,
"last-iteration": 2000,
"max-iterations": 10000,
"logs": "/training-jobs/{training-job-uuid}/logs"
}
## Training Job Logs [/training-jobs/{id}/logs]
The logs of the Training Job. Currently returns entire text file, but in the future
it will support websocket streaming.
+ Parameters
+ id (required, string, `training-job-uuid`) ... The id of the training job.
### Training Job Logs [GET]
+ Request
+ Headers
Authorization: Token 527d11fe429f3426cb8dbeba183a0d80
+ Response 200 (text/plain)
# Group Prediction
Related resources of the **Prediction API**
|
Update api
|
Update api
|
API Blueprint
|
apache-2.0
|
tleyden/elastic-thought,aaam/elastic-thought,tleyden/elastic-thought,aaam/elastic-thought,tleyden/elastic-thought,aaam/elastic-thought
|
dfc008251be2b615264c05937b572a1fb5691905
|
LIGHTNING-API-BLUEPRINT.apib
|
LIGHTNING-API-BLUEPRINT.apib
|
FORMAT: 1A
Weather API
=============================
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `lightning`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials with http basic auth).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**lightning** is the scope which allows to request Lightning Service.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
# Group Lightning
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}&startPosition={startPosition}]
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z&occurredUntil=2017-01-05T12:21:15Z&startPosition=30000
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]
##### Limitation
Due to some technical constraints, the response payload size is limited to max. 6MB - this is equivalent to ca. 30000 lightning events. If there are more than 30000 results in storage which comply to the search criteria, they can be retrieved using pagination.
In such case the response payload contains [HAL](http://stateless.co/hal_specification.html)-compatible `_link` object which contains links to the next page and the response type is application/hal+json.
If locationWithin is worldwide [-180, 90][180, -90] and occurrence ~3 days
### Observed lightning for a given boundingBox and time period
This resource provides data from existing lightning observation providers.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ provider: `ENGLN,NOWCAST` (string, required)
- lightning providers.
+ startPosition: `60000` (not negative integer, optional)
- Is used for pagination. It is recommnded to set it as multiple of 30 000.
+ Response 200 (application/hal+json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"lightnings":[
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"NOWCAST",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4500,
"location":[
9.6345,
19.3064
]
},
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"ENGLN",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4700,
"location":[
8.6345,
20.3064
]
},
{
"provider": "NOWCAST",
"occurredAt": "2017-01-05T12:20:14.974Z",
"elevationInKilometers": 0,
"lightningType": "CLOUD_TO_GROUND",
"currentInAmpere": -3500,
"location": [
9.3345,
19.7064
]
}
],
"lightningsTotal": 164256,
"lightningsInResponse": 30000,
"_links": {
"self": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=60000&locationWithin=[-180,90],[180,-90]"
},
"next": {
"href": "https://lightning.weather.mg/search?provider=ENGLN&startPosition=90000&locationWithin=[-180,90],[180,-90]"
}
}
}
#
# Weighted Lightning
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}]
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z&occurredUntil=2017-01-05T12:21:15Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]
### Observed weighted lightning for a given boundingBox, time period, weighted by time span and spatial resolution
This resource provides data from existing lightning observation providers: NOWCAST and ENGLN.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
-##### Limitation
- Due to thenchnical reasons, the maximum allowed response time is 30 seconds and it is possible to process lightning events in a batch of 200 000 lightnings only.
+ Parameters
+ temporalResolution: 'PT15M, PT5M, PT1M' in minutes(string required)
- time span interval in which lightning should be weighted
+ spatialResolution '0.5, 0.25, 0.05' degree(string required)
- spatial resolution within which lightning should be weighted
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ Response 200 (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"weightedLightnings": [{
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 8000,
"weightedLocation": [9.5033, 19.4814],
"numberOfLightnings": 2,
"temporalResolution": "PT15M",
"region": [[9.25, 19.75], [9.75, 19.25]],
"weightedOccurrence": "2017-01-05T12:20:47.000Z"
}, {
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 4700,
"weightedLocation": [8.6345, 20.3064],
"numberOfLightnings": 1,
"temporalResolution": "PT15M",
"region": [[8.25, 20.75], [8.75, 20.25]],
"weightedOccurrence": "2017-01-05T12:21:14.000Z"
}
]
}
#
|
FORMAT: 1A
Weather API
=============================
# General information
This technical document was created for developers who are creating applications based on weather data provided by this API.
This document is using [API blueprint format](https://apiblueprint.org/documentation/).
### Authentication
To access active-warning-service the request has to be authorised with a valid
JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server
`https://auth.weather.mg/oauth/token` with according client credentials. The
required scope is `lightning`.
The documentation about how to authenticate against MeteoGroup Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
#### Client Credentials
Before getting an access to any endpoints, need to obtain **client id** and **client secret**.
For achieving this, please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951).
#### Authorization Token
Once you have your client credentials (Client-ID + Password), you can request a token on
[Authorization server](https://auth.weather.mg/oauth/token?grant_type=client_credentials with http basic auth).
The token will be in the return message, encrypted with a key from the authorization service.
It will contain the client-ID, scopes and expiration date.
The token is only a valid for a limited time, after this it will expired and you have to request a new token again.
#### Using Authorization Token
HTTP GET request to the endpoints needs to provide Authorization Token into **Authorization** HTTP Header.
More information about JWT token might be found here: https://en.wikipedia.org/wiki/JSON_Web_Token.
HTTP Header: **Authorization** : **Bearer {ENCRYPTED TOKEN HERE}**
The Authorization token contains the Scopes which the client is allowed to have.
**lightning** is the scope which allows to request Lightning Service.
### Backward compatibility
Every endpoint may add one or more response parameters in the future.
Clients should ignore unknown parameters, to avoid technical issues.
# Group Lightning
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}&startPosition={startPosition}]
## Retrieve lightning observation [?provider={provider1,provider2}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z&occurredUntil=2017-01-05T12:21:15Z&startPosition=30000
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:21:14Z
https://lightning.weather.mg/search?provider=NOWCAST&locationWithin=[-10,80],[10,5]
##### Limitation
Due to some technical constraints, the response payload size is limited to max. 6MB - this is equivalent to ca. 30000 lightning events. If there are more than 30000 results in storage which comply to the search criteria, they can be retrieved using pagination.
In such case the response payload contains [HAL](http://stateless.co/hal_specification.html)-compatible `_link` object which contains links to the next page and the response type is application/hal+json.
If locationWithin is worldwide [-180, 90][180, -90] and occurrence ~3 days
### Observed lightning for a given boundingBox and time period
This resource provides data from existing lightning observation providers.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
+ Parameters
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ provider: `ENTLN,NOWCAST` (string, required)
- lightning providers.
+ startPosition: `60000` (not negative integer, optional)
- Is used for pagination. It is recommnded to set it as multiple of 30 000.
+ Response 200 (application/hal+json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"lightnings":[
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"NOWCAST",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4500,
"location":[
9.6345,
19.3064
]
},
{
"occurredAt":"2017-01-05T12:21:14.974Z",
"provider":"ENTLN",
"lightningType":"CLOUD_TO_GROUND",
"elevationInKilometers":0,
"currentInAmpere":4700,
"location":[
8.6345,
20.3064
]
},
{
"provider": "NOWCAST",
"occurredAt": "2017-01-05T12:20:14.974Z",
"elevationInKilometers": 0,
"lightningType": "CLOUD_TO_GROUND",
"currentInAmpere": -3500,
"location": [
9.3345,
19.7064
]
}
],
"lightningsTotal": 164256,
"lightningsInResponse": 30000,
"_links": {
"self": {
"href": "https://lightning.weather.mg/search?provider=ENTLN&startPosition=60000&locationWithin=[-180,90],[180,-90]"
},
"next": {
"href": "https://lightning.weather.mg/search?provider=ENTLN&startPosition=90000&locationWithin=[-180,90],[180,-90]"
}
}
}
#
# Weighted Lightning
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}&occurredUntil={endTime}]
## Retrieve weighted lightning observation [?temporalResolution={temporalResolution}&spatialResolution={resolution}&locationWithin={lonTopLeft,latTopLeft,lonBottomRight,latBottomRight}&occurredFrom={startTime}]
#### Example
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z&occurredUntil=2017-01-05T12:21:15Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]&occurredFrom=2017-01-05T12:19:14Z
https://lightning.weather.mg/weighted?&temporalResolution=PT15M&spatialResolution=0.5&locationWithin=[-10,80],[10,5]
### Observed weighted lightning for a given boundingBox, time period, weighted by time span and spatial resolution
This resource provides data from existing lightning observation providers: NOWCAST and ENTLN.
For any request service returns a set of lightnings occurred in geographical
bounding box locations during period of time specified in parameters.
-##### Limitation
- Due to thenchnical reasons, the maximum allowed response time is 30 seconds and it is possible to process lightning events in a batch of 200 000 lightnings only.
+ Parameters
+ temporalResolution: 'PT15M, PT5M, PT1M' in minutes(string required)
- time span interval in which lightning should be weighted
+ spatialResolution '0.5, 0.25, 0.05' degree(string required)
- spatial resolution within which lightning should be weighted
+ locationWithin: `[-10,80],[10,5]` (longitude top left,
latitude top left,
longitude bottom right,
latitude bottom_right, required)
- longitude in degree numeric format and in range <-180,180> eg. -123.454, 179.864
- latitude in degree numeric format and in range <-90,90> eg. -85.541, 5.32,
+ occurredFrom: `2017-01-05T12:21:14Z` (start time range, optional)
- start lightning observation time. End time is current time by default, setup by the service.
+ occurredUntil: `2017-01-05T12:21:15Z` (end time range, optional)
- time range period for lightning observation.
+ Response 200 (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Body
{
"weightedLightnings": [{
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 8000,
"weightedLocation": [9.5033, 19.4814],
"numberOfLightnings": 2,
"temporalResolution": "PT15M",
"region": [[9.25, 19.75], [9.75, 19.25]],
"weightedOccurrence": "2017-01-05T12:20:47.000Z"
}, {
"occurredFrom": "2017-01-05T12:15:00.000Z",
"occurredUntil": "2017-01-05T12:30:00.000Z",
"totalCurrentInAmpere": 4700,
"weightedLocation": [8.6345, 20.3064],
"numberOfLightnings": 1,
"temporalResolution": "PT15M",
"region": [[8.25, 20.75], [8.75, 20.25]],
"weightedOccurrence": "2017-01-05T12:21:14.000Z"
}
]
}
#
|
Rename ENGLN provider to ENTLN
|
[BBCDD-971] Rename ENGLN provider to ENTLN
|
API Blueprint
|
apache-2.0
|
MeteoGroup/weather-api,MeteoGroup/weather-api
|
551dd4343032290b96d91cae433d560400cf2ca2
|
blueprint/notifications.apib
|
blueprint/notifications.apib
|
FORMAT: 1A
HOST: https://api.thegrid.io/
# Group Registering for Notifications
Notifications allow applications to instantly know when certain data has changed,
or certain user actions has been performed. Correct implementation of notifications
allows user to use multiple devices, with the data always being up-to-date.
To receive notifications, the Grid app needs to be registered as a client application.
The notifications sent to clients follow the [notifications schema](schema/notification.json).
For how to deal with particular notifications, see the recommendations found below.
When reacting to an action the client needs to make the request using the regular Bearer token.
## User clients [/client]
### List user's active client apps [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/client-gcm.json) -->
<!-- include(examples/client-apn.json) -->
]
```
### Register a new client app [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/client-gcm.json) -->
```
+ Schema
```
<!-- include(schema/client.json) -->
```
+ Response 201
+ Headers
Location: /client/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Client app [/client/{id}]
+ Parameters
+ id (required, string) - Site UUID
### Remove a client app [DELETE]
+ Response 204
## Notifications testing [/molly/repeat]
### Send a test notification [POST]
For development purposes, you can make Molly talk to you over the registered notification channels (like Google Cloud Messaging).
A push message will be sent to the user's all registered clients.
+ Request (application/json)
+ Schema
```
<!-- include(schema/notification.json) -->
```
+ Response 202
# Group Available Notifications
## Synchronization
These notification payloads are intended for API clients to refresh changed data from the server. They are not indended to be visualized except for possible data changes in the UI (new items appearing, site configs changing, etc).
User events:
* `user_merge`: user account has been merged with another one. All data should be re-fetched
* `user_removed`: the user account has been disabled. Remove data and disable application usage
* `user_activated`: the authenticated user's account has been activated. Re-fetch data and enable full application usage. This one may be worthy of notifying user visually
Item events:
* `new_item`: new item has been created, fetch with `id`
* `updated_item`: item has been updated, fetch with `id`
* `published_item`: item has been published to `sites`, update display accordingly. Fetch with `id` if needed
* `unpublished_item`: item has been unpublished from `sites`, update display accordingly. Fetch with `id` if needed
* `removed_item`: item has been deleted. Remove from app
Site events:
* `new_site`: new site has been created, fetch with `id` or use `repo`
* `updated_site`: site has been updated, fetch with `id` or use `repo`. These can be also caused by site publishing process
* `removed_site`: site has been deleted. Remove from app
Redesign events:
* `new_redesign`: new redesign is available for the site, fetch with `id`
* `updated_redesign`: redesign has been updated (usually with a rating), fetch with `id`
* `removed_redesign`: redesign has been removed. Remove from app
## Job status
The job status notifications are related to long-running operations initiated by the user or a back-end process that the user should be aware of. These should be shown with persistent progress indicators either in the system's notifications are or in the context of the action made (for example, a "loading" item card).
Job events contain the following information:
* `job_id`: identifier for the long-running job, can be used for polling the job endpoint
* `item`: item ID associated with the job, if any
* `job_type`: type of the job, currently either `share` or `publish`
Job status changes cause the following events to be sent:
* `started_job`: job has started. Show progress notification accordingly
* `updated_job`: there has been progress on the job. Possibly move progress indicator one step forward
* `failed_job`: job has failed. Replace progress notification with a failure indicator
* `completed_job`: job has completed. Remove progress notification or replace with a success indicator
## Actionable notifications
These notifications are related to something urgent the user should be able to react to. They should be shown as OS-level notifications that may have additional information like screenshots or action buttons associated with them.
Notifications from the `molly` AI:
These notifications are meant to be shown visually, and contain the texts written by the AI to the user. In general, they have the `molly` collapse key if available on the platform.
Molly notifications contain the following keys:
* `type`: subtype of the notification, for example `review` or `publish`
* `title`: textual title for the notification
* `text`: full notification text
* `url`: URL that the user can visit to see more related to the notification, for example a newly redesigned website of theirs
* `preview`: Screenshot for the URL above, if any
* `ipfs`: IPFS hash for the URL, if any
* `site`: ID of the site associated with the notification
* `job`: ID of the job associated with the notification, if any. Can be used to morph job progress to visual notification
* `actions`: array of potential additional actions that user can perform, each containing `label`, `icon`, `path`, `method`, and `payload`
Molly notification types:
* `review`: The AI has multiple designs for the user to review and choose from
* `publish`: A new version of the site or some pages within is now live
|
FORMAT: 1A
HOST: https://api.thegrid.io/
# Group Registering for Notifications
Notifications allow applications to instantly know when certain data has changed,
or certain user actions has been performed. Correct implementation of notifications
allows user to use multiple devices, with the data always being up-to-date.
To receive notifications, the Grid app needs to be registered as a client application.
The notifications sent to clients follow the [notifications schema](schema/notification.json).
For how to deal with particular notifications, see the recommendations found below.
When reacting to an action the client needs to make the request using the regular Bearer token.
## User clients [/client]
### List user's active client apps [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/client-gcm.json) -->
<!-- include(examples/client-apn.json) -->
]
```
### Register a new client app [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/client-gcm.json) -->
```
+ Schema
```
<!-- include(schema/client.json) -->
```
+ Response 201
+ Headers
Location: /client/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Client app [/client/{id}]
+ Parameters
+ id (required, string) - Site UUID
### Remove a client app [DELETE]
+ Response 204
## Notifications testing [/molly/repeat]
### Send a test notification [POST]
For development purposes, you can make Molly talk to you over the registered notification channels (like Google Cloud Messaging).
A push message will be sent to the user's all registered clients.
+ Request (application/json)
+ Schema
```
<!-- include(schema/notification.json) -->
```
+ Response 202
# Group Available Notifications
## Synchronization
These notification payloads are intended for API clients to refresh changed data from the server. They are not indended to be visualized except for possible data changes in the UI (new items appearing, site configs changing, etc).
User events:
* `user_merge`: user account has been merged with another one. All data should be re-fetched
* `user_removed`: the user account has been disabled. Remove data and disable application usage
* `user_activated`: the authenticated user's account has been activated. Re-fetch data and enable full application usage. This one may be worthy of notifying user visually
Item events:
* `new_item`: new item has been created, fetch with `id`
* `updated_item`: item has been updated, fetch with `id`
* `published_item`: item has been published to `sites`, update display accordingly. Fetch with `id` if needed
* `unpublished_item`: item has been unpublished from `sites`, update display accordingly. Fetch with `id` if needed
* `removed_item`: item has been deleted. Remove from app
Site events:
* `new_site`: new site has been created, fetch with `id` or use `repo`
* `updated_site`: site has been updated, fetch with `id` or use `repo`. These can be also caused by site publishing process
* `removed_site`: site has been deleted. Remove from app
Redesign events:
* `started_redesign`: new redesign is being worked on, available from listing with `?inflight=true`
* `new_redesign`: new redesign is available for the site, fetch with `id`
* `updated_redesign`: redesign has been updated (usually with a rating), fetch with `id`
* `removed_redesign`: redesign has been removed. Remove from app
## Job status
The job status notifications are related to long-running operations initiated by the user or a back-end process that the user should be aware of. These should be shown with persistent progress indicators either in the system's notifications are or in the context of the action made (for example, a "loading" item card).
Job events contain the following information:
* `job_id`: identifier for the long-running job, can be used for polling the job endpoint
* `item`: item ID associated with the job, if any
* `job_type`: type of the job, currently either `share` or `publish`
Job status changes cause the following events to be sent:
* `started_job`: job has started. Show progress notification accordingly
* `updated_job`: there has been progress on the job. Possibly move progress indicator one step forward
* `failed_job`: job has failed. Replace progress notification with a failure indicator
* `completed_job`: job has completed. Remove progress notification or replace with a success indicator
## Actionable notifications
These notifications are related to something urgent the user should be able to react to. They should be shown as OS-level notifications that may have additional information like screenshots or action buttons associated with them.
Notifications from the `molly` AI:
These notifications are meant to be shown visually, and contain the texts written by the AI to the user. In general, they have the `molly` collapse key if available on the platform.
Molly notifications contain the following keys:
* `type`: subtype of the notification, for example `review` or `publish`
* `title`: textual title for the notification
* `text`: full notification text
* `url`: URL that the user can visit to see more related to the notification, for example a newly redesigned website of theirs
* `preview`: Screenshot for the URL above, if any
* `ipfs`: IPFS hash for the URL, if any
* `site`: ID of the site associated with the notification
* `job`: ID of the job associated with the notification, if any. Can be used to morph job progress to visual notification
* `actions`: array of potential additional actions that user can perform, each containing `label`, `icon`, `path`, `method`, and `payload`
Molly notification types:
* `review`: The AI has multiple designs for the user to review and choose from
* `publish`: A new version of the site or some pages within is now live
|
Document started_redesign
|
Document started_redesign
|
API Blueprint
|
mit
|
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.