2018-10-12 15:26:04 +02:00
|
|
|
/* tslint:disable:no-unused-expression */
|
|
|
|
|
2018-11-19 17:36:20 +01:00
|
|
|
import { makeGetRequest, makeDeleteRequest, makePostBodyRequest } from '../requests/requests'
|
2018-10-12 15:26:04 +02:00
|
|
|
|
|
|
|
function getAccountBlocklistByAccount (
|
|
|
|
url: string,
|
|
|
|
token: string,
|
|
|
|
start: number,
|
|
|
|
count: number,
|
|
|
|
sort = '-createdAt',
|
|
|
|
statusCodeExpected = 200
|
|
|
|
) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/accounts'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
token,
|
|
|
|
query: { start, count, sort },
|
|
|
|
path,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAccountToAccountBlocklist (url: string, token: string, accountToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/accounts'
|
|
|
|
|
|
|
|
return makePostBodyRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
fields: {
|
|
|
|
accountName: accountToBlock
|
|
|
|
},
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeAccountFromAccountBlocklist (url: string, token: string, accountToUnblock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/accounts/' + accountToUnblock
|
|
|
|
|
|
|
|
return makeDeleteRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function getServerBlocklistByAccount (
|
|
|
|
url: string,
|
|
|
|
token: string,
|
|
|
|
start: number,
|
|
|
|
count: number,
|
|
|
|
sort = '-createdAt',
|
|
|
|
statusCodeExpected = 200
|
|
|
|
) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/servers'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
token,
|
|
|
|
query: { start, count, sort },
|
|
|
|
path,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function addServerToAccountBlocklist (url: string, token: string, serverToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/servers'
|
|
|
|
|
|
|
|
return makePostBodyRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
fields: {
|
|
|
|
host: serverToBlock
|
|
|
|
},
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeServerFromAccountBlocklist (url: string, token: string, serverToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/users/me/blocklist/servers/' + serverToBlock
|
|
|
|
|
|
|
|
return makeDeleteRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-10-15 13:03:04 +02:00
|
|
|
function getAccountBlocklistByServer (
|
|
|
|
url: string,
|
|
|
|
token: string,
|
|
|
|
start: number,
|
|
|
|
count: number,
|
|
|
|
sort = '-createdAt',
|
|
|
|
statusCodeExpected = 200
|
|
|
|
) {
|
|
|
|
const path = '/api/v1/server/blocklist/accounts'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
token,
|
|
|
|
query: { start, count, sort },
|
|
|
|
path,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAccountToServerBlocklist (url: string, token: string, accountToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/server/blocklist/accounts'
|
|
|
|
|
|
|
|
return makePostBodyRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
fields: {
|
|
|
|
accountName: accountToBlock
|
|
|
|
},
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeAccountFromServerBlocklist (url: string, token: string, accountToUnblock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/server/blocklist/accounts/' + accountToUnblock
|
|
|
|
|
|
|
|
return makeDeleteRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function getServerBlocklistByServer (
|
|
|
|
url: string,
|
|
|
|
token: string,
|
|
|
|
start: number,
|
|
|
|
count: number,
|
|
|
|
sort = '-createdAt',
|
|
|
|
statusCodeExpected = 200
|
|
|
|
) {
|
|
|
|
const path = '/api/v1/server/blocklist/servers'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
token,
|
|
|
|
query: { start, count, sort },
|
|
|
|
path,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function addServerToServerBlocklist (url: string, token: string, serverToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/server/blocklist/servers'
|
|
|
|
|
|
|
|
return makePostBodyRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
fields: {
|
|
|
|
host: serverToBlock
|
|
|
|
},
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeServerFromServerBlocklist (url: string, token: string, serverToBlock: string, statusCodeExpected = 204) {
|
|
|
|
const path = '/api/v1/server/blocklist/servers/' + serverToBlock
|
|
|
|
|
|
|
|
return makeDeleteRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-10-12 15:26:04 +02:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
getAccountBlocklistByAccount,
|
|
|
|
addAccountToAccountBlocklist,
|
|
|
|
removeAccountFromAccountBlocklist,
|
|
|
|
getServerBlocklistByAccount,
|
|
|
|
addServerToAccountBlocklist,
|
2018-10-15 13:03:04 +02:00
|
|
|
removeServerFromAccountBlocklist,
|
|
|
|
|
|
|
|
getAccountBlocklistByServer,
|
|
|
|
addAccountToServerBlocklist,
|
|
|
|
removeAccountFromServerBlocklist,
|
|
|
|
getServerBlocklistByServer,
|
|
|
|
addServerToServerBlocklist,
|
|
|
|
removeServerFromServerBlocklist
|
2018-10-12 15:26:04 +02:00
|
|
|
}
|