File size: 2,542 Bytes
2ece5ff
76fd605
2ece5ff
 
 
 
 
 
 
76fd605
2ece5ff
76fd605
 
 
2ece5ff
 
 
 
76fd605
 
2ece5ff
 
 
 
b85eeeb
 
 
2ece5ff
 
 
 
b85eeeb
 
2ece5ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2647683
 
0ad66b3
2ece5ff
 
 
 
2647683
 
2ece5ff
 
817b819
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63086c2
2ece5ff
d5c64bc
 
 
2ece5ff
 
 
63086c2
d5c64bc
 
2ece5ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import funciones
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def start(): 
    return {"Status":"Deployed"}

## GET DATA (USERS) ##
#Vía Path
@app.get("/getData/{aplicacion}")
def getData(aplicacion: str):
    data = funciones.getData(aplicacion)    
    return data

#Vía Query 
@app.get("/getDataQ/")
def getData(aplicacion: str):
    data = funciones.getData(aplicacion)
    return data

## GET TOKENS ##
#Vía Path
@app.get("/getTokens/{userfile}/{env}")
def getTokens(userfile: str, env: str):
    tokens = funciones.getTokens(userfile, env)
    return tokens

#Vía Query 
@app.get("/getTokensQ/")
def getTokens(userfile: str = "gAAAAABmEZA4SLBC2YczouOrjIEi9WNCNGOIvyUcqBUnzxNsftXTdy54KaX9x8mAjFkABSI6FJrdZDQKk_5lpJOgJoMChxlniw==", env: str = "dev"):
    tokens = funciones.getTokens(userfile, env)
    return tokens

## AUTHORIZE WORK ##
#Vía Parameters
@app.get("/authorize/{tokens}/{work}")
def authorize(tokens: int, work: str):
    autorizacion = funciones.authorize(tokens, work)
    return autorizacion

#Vía Query
@app.get("/authorizeQ/")
def authorize(tokens: int, work: str = "picswap"):
    autorizacion = funciones.authorize(tokens,work) 
    return autorizacion


## DEBIT TOKENS ##
#Vía Parámeters
@app.get("/debitTokens/{userfile}/{work}/{env}")
def debitTokens(userfile: str, work: str, env: str):
    tokens = funciones.debitTokens(userfile,work, env)
    return tokens

#Vía Query
@app.get("/debitTokensQ/")
def debitTokens(userfile: str, work: str = "picswap", env: str = "dev"):
    tokens = funciones.debitTokens(userfile,work, env) 
    return tokens

## CONTROL QUOTA ##
#Vía Parámeters
@app.get("/getQuota/")
def getQuota():
    quota = funciones.getQuota() 
    return quota

#Vía Query
@app.get("/getQuota/")
def getQuota():
    quota = funciones.getQuota() 
    return quota

#Vía Parámeters
@app.get("/updateQuota/{costo_proceso}")
def updateQuota(costo_proceso: int):
    quota = funciones.updateQuota(costo_proceso) 
    return quota

#Vía Query
@app.get("/updateQuota/")
def updateQuota(costo_proceso: int):
    quota = funciones.updateQuota(costo_proceso) 
    return quota

## GET USER Novelty ##
#Vía Parámeters
@app.get("/getUserNovelty/{userfile}/{aplicacion}")
def getUserNovelty(userfile: str, aplicacion: str):
    novelty = funciones.getUserNovelty(userfile, aplicacion) 
    return novelty

#Vía Query
@app.get("/getUserNovelty/")
def getUserNovelty(userfile: str, aplicacion: str):
    novelty = funciones.getUserNovelty(userfile, aplicacion) 
    return novelty