Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
b1b725b0
Commit
b1b725b0
authored
Apr 22, 2015
by
Matija Obreza
Browse files
webapi JS bugfix
parent
8b1032c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/sourceapp/js/webapi.js
View file @
b1b725b0
...
...
@@ -17,49 +17,50 @@ var GenesysPGR = function(baseUrl, clientId) {
clientId
:
clientId
,
baseUrl
:
baseUrl
,
clientSecret
:
null
,
defaultOptions
:
defaultOptions
};
};
defaultOptions
:
defaultOptions
,
getUrl
:
function
(
apiCall
)
{
return
this
.
baseUrl
+
'
/webapi
'
+
apiCall
+
'
?client_id=
'
+
this
.
clientId
+
(
this
.
clientSecret
!==
null
?
'
&client_secret=
'
+
this
.
clientSecret
:
''
);
},
listAccessions
:
function
(
filter
,
opts
)
{
var
o
=
$
.
extend
({},
GenesysPGR
.
defaultOptions
,
opts
);
var
json
=
{
filter
:
JSON
.
stringify
(
filter
),
startAt
:
Math
.
max
(
1
,
o
.
startAt
),
maxRecords
:
o
.
maxRecords
};
GenesysPGR
.
prototype
.
getUrl
=
function
(
apiCall
)
{
return
this
.
baseUrl
+
'
/webapi
'
+
apiCall
+
'
?client_id=
'
+
this
.
clientId
+
(
this
.
clientSecret
!==
null
?
'
&client_secret=
'
+
this
.
clientSecret
:
''
);
};
GenesysPGR
.
prototype
.
listAccessions
=
function
(
filter
,
opts
)
{
var
o
=
$
.
extend
({},
GenesysPGR
.
defaultOptions
,
opts
);
var
json
=
{
filter
:
JSON
.
stringify
(
filter
),
startAt
:
Math
.
max
(
1
,
o
.
startAt
),
maxRecords
:
o
.
maxRecords
};
$
.
ajax
(
this
.
getUrl
(
'
/v0/acn/filter
'
),
{
dataType
:
'
json
'
,
type
:
'
POST
'
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
json
),
$
.
ajax
(
this
.
getUrl
(
'
/v0/acn/filter
'
),
{
dataType
:
'
json
'
,
type
:
'
POST
'
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
json
),
success
:
function
(
accessions
)
{
o
.
success
(
accessions
);
},
success
:
function
(
accessions
)
{
o
.
success
(
accessions
);
},
error
:
function
(
errorAsync
)
{
o
.
error
(
errorAsync
);
}
});
},
overview
:
function
(
filter
,
opts
)
{
var
o
=
$
.
extend
({},
GenesysPGR
.
defaultOptions
,
opts
);
error
:
function
(
errorAsync
)
{
o
.
error
(
errorAsync
);
}
});
};
$
.
ajax
(
this
.
getUrl
(
'
/v0/acn/overview
'
),
{
dataType
:
'
json
'
,
type
:
'
POST
'
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
filter
),
GenesysPGR
.
prototype
.
overview
=
function
(
filter
,
opts
)
{
var
o
=
$
.
extend
({},
GenesysPGR
.
defaultOptions
,
opts
);
success
:
function
(
accessions
)
{
o
.
success
(
accessions
);
},
$
.
ajax
(
this
.
getUrl
(
'
/v0/acn/overview
'
),
{
dataType
:
'
json
'
,
type
:
'
POST
'
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
filter
),
success
:
function
(
accessions
)
{
o
.
success
(
accessions
);
},
error
:
function
(
errorAsync
)
{
o
.
error
(
errorAsync
);
}
});
error
:
function
(
errorAsync
)
{
o
.
error
(
errorAsync
);
}
});
}
};
};
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment