123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- /* tslint:disable:no-unused-expression */
- import { makeGetRequest, makeDeleteRequest, makePostBodyRequest } from '../requests/requests'
- 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
- })
- }
- 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
- })
- }
- // ---------------------------------------------------------------------------
- export {
- getAccountBlocklistByAccount,
- addAccountToAccountBlocklist,
- removeAccountFromAccountBlocklist,
- getServerBlocklistByAccount,
- addServerToAccountBlocklist,
- removeServerFromAccountBlocklist,
- getAccountBlocklistByServer,
- addAccountToServerBlocklist,
- removeAccountFromServerBlocklist,
- getServerBlocklistByServer,
- addServerToServerBlocklist,
- removeServerFromServerBlocklist
- }
|