Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
MP-Tsel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dzulfiqar Ridha
MP-Tsel
Commits
8c8baa05
Commit
8c8baa05
authored
Apr 10, 2019
by
Dzulfqar Ridha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update reporting
parent
644eeaf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
221 additions
and
9 deletions
+221
-9
ReportingController.php
app/Http/Controllers/ReportingController.php
+203
-0
web.php
routes/web.php
+18
-9
No files found.
app/Http/Controllers/ReportingController.php
0 → 100644
View file @
8c8baa05
<?php
/**
* Created by PhpStorm.
* User: gets
* Date: 4/4/2019
* Time: 3:24 PM
*/
namespace
App\Http\Controllers
;
use
App\Classes\MResponse
;
class
ApplicationController
extends
BaseController
{
public
function
callsDevActivityForService
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/developer_activity/service/yn7qb677qd3734sfd8wj2uzy'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
,
'limit'
=>
'1000'
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
public
function
callsStatusForService
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/status/service/yn7qb677qd3734sfd8wj2uzy'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
,
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
public
function
callsMethodsForService
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/methods/service/yn7qb677qd3734sfd8wj2uzy'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
,
'method_limit'
=>
'5'
,
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
public
function
callsStatusForServiceForDev
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/status/service/yn7qb677qd3734sfd8wj2uzy/developer/q5qkbdsuza46gyvp5htp8xga'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
public
function
callsMethodsForServiceForDev
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/methods/service/yn7qb677qd3734sfd8wj2uzy/developer/q5qkbdsuza46gyvp5htp8xga'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
public
function
callsErrocodesForServiceForDev
(){
$mResponse
=
new
MResponse
();
$statusCode
=
200
;
try
{
$response
=
$this
->
masheryClient
()
->
request
(
'GET'
,
'https://api.mashery.com/v3/rest/reports/calls/errorcodes/service/yn7qb677qd3734sfd8wj2uzy/developer/q5qkbdsuza46gyvp5htp8xga'
,
[
'query'
=>
[
'start_date'
=>
'2019-02-01T00%3A00%3A00Z'
,
'end_date'
=>
'2019-02-07T00%3A00%3A00Z'
,
'format'
=>
'csv'
,
'errorcode_limit'
=>
'5'
,
]
]);
$resBody
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
$statusCode
=
$response
->
getStatusCode
();
$mResponse
->
message
=
$resBody
;
}
else
{
$mResponse
->
success
=
true
;
$mResponse
->
message
=
'success'
;
$mResponse
->
data
=
$resBody
;
}
}
catch
(
\Exception
$e
)
{
$statusCode
=
500
;
$mResponse
->
message
=
$e
->
getMessage
();
}
return
response
()
->
json
(
$mResponse
,
$statusCode
);
}
}
routes/web.php
View file @
8c8baa05
...
...
@@ -30,10 +30,10 @@ $router->group(['middleware' => 'client.auth'], function () use ($router) {
$router
->
group
([
'prefix'
=>
'application'
],
function
()
use
(
$router
)
{
$router
->
post
(
'create'
,
'ApplicationController@create'
);
$router
->
p
os
t
(
'update'
,
'ApplicationController@update'
);
$router
->
post
(
'delete'
,
'ApplicationController@delete'
);
$router
->
pos
t
(
'by-userid'
,
'ApplicationController@getByUserId'
);
$router
->
pos
t
(
'by-appid'
,
'ApplicationController@getByAppId'
);
$router
->
p
u
t
(
'update'
,
'ApplicationController@update'
);
$router
->
del
(
'delete'
,
'ApplicationController@delete'
);
$router
->
ge
t
(
'by-userid'
,
'ApplicationController@getByUserId'
);
$router
->
ge
t
(
'by-appid'
,
'ApplicationController@getByAppId'
);
});
$router
->
group
([
'prefix'
=>
'package'
],
function
()
use
(
$router
)
{
...
...
@@ -44,10 +44,19 @@ $router->group(['middleware' => 'client.auth'], function () use ($router) {
$router
->
group
([
'prefix'
=>
'packageKey'
],
function
()
use
(
$router
)
{
$router
->
post
(
'create'
,
'PackageKeyController@create'
);
$router
->
post
(
'activate'
,
'PackageKeyController@activate'
);
$router
->
post
(
'disable'
,
'PackageKeyController@disable'
);
$router
->
post
(
'delete'
,
'PackageKeyController@delete'
);
$router
->
post
(
'by-username'
,
'PackageKeyController@getByUser'
);
$router
->
post
(
'update-plan'
,
'PackageKeyController@updatePlan'
);
$router
->
put
(
'activate'
,
'PackageKeyController@activate'
);
$router
->
put
(
'disable'
,
'PackageKeyController@disable'
);
$router
->
del
(
'delete'
,
'PackageKeyController@delete'
);
$router
->
get
(
'by-username'
,
'PackageKeyController@getByUser'
);
$router
->
put
(
'update-plan'
,
'PackageKeyController@updatePlan'
);
});
$router
->
group
([
'prefix'
=>
'report'
],
function
()
use
(
$router
)
{
$router
->
get
(
'devact-serv'
,
'ReportingController@callsDevActivityForService'
);
$router
->
get
(
'status-serv'
,
'ReportingController@callsStatusForService'
);
$router
->
get
(
'method-serv'
,
'ReportingController@callsMethodsForService'
);
$router
->
get
(
'status-serv-dev'
,
'ReportingController@callsStatusForServiceForDev'
);
$router
->
get
(
'method-serv-dev'
,
'ReportingController@callsMethodsForServiceForDev'
);
$router
->
get
(
'error-serv-dev'
,
'ReportingController@callsErrocodesForServiceForDev'
);
});
});
Write
Preview
Markdown
is supported
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