Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
b9d3b03d
Commit
b9d3b03d
authored
Jul 14, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added flushCache
parent
1761e049
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
+60
-0
zimbra-admin-api.js
lib/zimbra-admin-api.js
+28
-0
index.js
src/index.js
+22
-0
test.js
test/js/spec/test.js
+10
-0
No files found.
lib/zimbra-admin-api.js
View file @
b9d3b03d
...
...
@@ -428,6 +428,34 @@ return /******/ (function(modules) { // webpackBootstrap
var resource_data = this.buildResourceData(name, attributes);
return this.create('DistributionList', resource_data, callback);
}
// flushData = {
// type: Comma separated list of cache types. e.g. from skin|locale|account|cos|domain|server|zimlet,
// allServers: 0|1,
// entry: Name or Id of the object, should be relevant to type
// }
}, {
key: 'flushCache',
value: function flushCache() {
var flushData = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var callback = arguments[1];
var request_data = this.buildRequestData('FlushCache', callback);
request_data.parse_response = ResponseParser.emptyResponse;
request_data.params.params = {
cache: {
type: flushData.type,
allServers: flushData.allServers || 0,
'_content': { entry: {} }
}
};
if (flushData.entry) request_data.params.params.cache._content.entry = {
'by': this.dictionary.byIdOrName(flushData.entry),
'_content': flushData.entry
};
return this.performRequest(request_data);
}
}, {
key: 'getAllDomains',
value: function getAllDomains(callback, query_object) {
...
...
src/index.js
View file @
b9d3b03d
...
...
@@ -322,6 +322,28 @@ class ZimbraAdminApi {
return
this
.
create
(
'DistributionList'
,
resource_data
,
callback
);
}
// flushData = {
// type: Comma separated list of cache types. e.g. from skin|locale|account|cos|domain|server|zimlet,
// allServers: 0|1,
// entry: Name or Id of the object, should be relevant to type
// }
flushCache
(
flushData
=
{},
callback
)
{
const
request_data
=
this
.
buildRequestData
(
'FlushCache'
,
callback
);
request_data
.
parse_response
=
ResponseParser
.
emptyResponse
;
request_data
.
params
.
params
=
{
cache
:
{
type
:
flushData
.
type
,
allServers
:
(
flushData
.
allServers
||
0
),
'_content'
:
{
entry
:
{
}
}
}
};
if
(
flushData
.
entry
)
request_data
.
params
.
params
.
cache
.
_content
.
entry
=
{
'by'
:
this
.
dictionary
.
byIdOrName
(
flushData
.
entry
),
'_content'
:
flushData
.
entry
}
return
this
.
performRequest
(
request_data
);
}
getAllDomains
(
callback
,
query_object
)
{
query_object
=
query_object
||
{};
query_object
.
types
=
'domains'
;
...
...
test/js/spec/test.js
View file @
b9d3b03d
...
...
@@ -24,6 +24,16 @@
});
});
it
(
'Should Flush the Cache'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
const
flush_data
=
{
type
:
'domain'
,
allServers
:
1
,
entry
:
'zboxapp.dev'
};
api
.
flushCache
(
flush_data
,
function
(
err
,
data
){
if
(
err
)
console
.
log
(
err
);
expect
(
err
).
to
.
not
.
exist
;
done
();
})
});
it
(
'should get all domains'
,
function
(
done
)
{
let
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getAllDomains
(
function
(
err
,
data
){
...
...
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