FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithmia-nodejs/src/AlgorithmExecutable.ts at master · algorithmiaio/algorithmia-nodejs · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
algorithmiaio
/
algorithmia-nodejs
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
39
Code
Issues
2
Pull requests
16
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithmia-nodejs
/
src
/
AlgorithmExecutable.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (45 loc) · 1.14 KB
Breadcrumbs
algorithmia-nodejs
/
src
/
AlgorithmExecutable.ts
Copy path
File metadata and controls
56 lines (45 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
{
HttpClient
}
from
'./HttpClient'
;
import
{
getContentType
,
Input
,
Json
}
from
'./ContentTypeHelper'
;
import
{
URLSearchParams
}
from
'url'
;
class
AlgorithmExecutable
{
private
client
:
HttpClient
;
private
path
:
string
;
public
constructor
(
client
:
HttpClient
,
path
:
string
)
{
this
.
client
=
client
;
this
.
path
=
path
;
}
pipe
(
input
:
Input
,
version
?:
string
,
output
=
'raw'
,
stdout
=
false
,
timeout
=
300
)
{
const
contentType
=
getContentType
(
input
)
;
const
pathname
=
version
?
`
${
this
.
path
}
/
${
version
}
/`
:
`
${
this
.
path
}
/`
;
const
params
=
new
URLSearchParams
(
{
timeout
:
timeout
.
toString
(
)
,
stdout
:
stdout
.
toString
(
)
,
output
,
}
)
;
const
fullPath
=
`
${
pathname
}
?
${
params
.
toString
(
)
}
`
;
return
this
.
client
.
post
(
fullPath
,
input
,
contentType
)
;
}
}
interface
AlgoResponse
{
async
?:
boolean
;
error
?:
Error
;
metadata
?:
MetaData
;
request_id
?:
string
;
result
?:
string
|
Json
;
}
interface
Error
{
message
:
string
;
stacktrace
:
string
;
}
interface
MetaData
{
content_type
:
string
;
duration
:
string
;
stdout
:
string
;
}
export
{
AlgorithmExecutable
,
AlgoResponse
}
;
Back
|
FazBrowse Home
|
New Git URL