Comparing version 0.8.3-alpha to 0.9.0-alpha
@@ -6,2 +6,7 @@ export declare enum APIValidationState { | ||
} | ||
export declare enum APIValidationStateCreate { | ||
Pending = "/states/1", | ||
Validated = "/states/2", | ||
Rejected = "/states/3" | ||
} | ||
export declare enum APIUserRole { | ||
@@ -8,0 +13,0 @@ User = "ROLE_USER", |
@@ -8,2 +8,8 @@ // Enums | ||
})(APIValidationState || (APIValidationState = {})); | ||
export var APIValidationStateCreate; | ||
(function (APIValidationStateCreate) { | ||
APIValidationStateCreate["Pending"] = "/states/1"; | ||
APIValidationStateCreate["Validated"] = "/states/2"; | ||
APIValidationStateCreate["Rejected"] = "/states/3"; | ||
})(APIValidationStateCreate || (APIValidationStateCreate = {})); | ||
export var APIUserRole; | ||
@@ -10,0 +16,0 @@ (function (APIUserRole) { |
import User from "../class/User"; | ||
import { APIValidationState } from "../@types"; | ||
import { APIValidationStateCreate } from "../@types"; | ||
import Resource from "../class/Resource"; | ||
export interface ValidationStateDataBuilder { | ||
state: APIValidationState; | ||
state: APIValidationStateCreate; | ||
moderator?: User; | ||
@@ -11,7 +11,7 @@ resource?: Resource; | ||
export default class ValidationStateBuilder implements ValidationStateDataBuilder { | ||
state: APIValidationState; | ||
state: APIValidationStateCreate; | ||
moderator?: User; | ||
resource?: Resource; | ||
constructor(data?: Partial<ValidationStateDataBuilder>); | ||
setState(state: APIValidationState): this; | ||
setState(state: APIValidationStateCreate): this; | ||
setModerator(user: User): this; | ||
@@ -21,3 +21,3 @@ setResource(resource: Resource): this; | ||
toJSON(): { | ||
state: APIValidationState; | ||
state: APIValidationStateCreate; | ||
moderator: string | undefined; | ||
@@ -24,0 +24,0 @@ resource: string | undefined; |
@@ -1,2 +0,2 @@ | ||
import { APIValidationState } from "../@types"; | ||
import { APIValidationStateCreate } from "../@types"; | ||
/** Represents a valid state */ | ||
@@ -6,3 +6,3 @@ var ValidationStateBuilder = /** @class */ (function () { | ||
var _a; | ||
this.state = (_a = data === null || data === void 0 ? void 0 : data.state) !== null && _a !== void 0 ? _a : APIValidationState.Pending; | ||
this.state = (_a = data === null || data === void 0 ? void 0 : data.state) !== null && _a !== void 0 ? _a : APIValidationStateCreate.Pending; | ||
this.moderator = data === null || data === void 0 ? void 0 : data.moderator; | ||
@@ -9,0 +9,0 @@ this.resource = data === null || data === void 0 ? void 0 : data.resource; |
@@ -34,4 +34,2 @@ import { APIResourceData } from "../@types"; | ||
constructor(client: Client, data: APIResourceData); | ||
/** @deprecated */ | ||
get user(): import("./User").default | null; | ||
get creator(): import("./User").default | null; | ||
@@ -38,0 +36,0 @@ private getCreator; |
@@ -27,13 +27,2 @@ import { __extends } from "tslib"; | ||
} | ||
Object.defineProperty(Resource.prototype, "user", { | ||
/** @deprecated */ | ||
get: function () { | ||
var _a; | ||
console.warn("<Resource>.user is deprecated. Please use <Resource>.creator instead"); | ||
var id = (_a = this.data.user) === null || _a === void 0 ? void 0 : _a.id; | ||
return this.getCreator(id); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Resource.prototype, "creator", { | ||
@@ -40,0 +29,0 @@ get: function () { |
@@ -1,6 +0,4 @@ | ||
import User from "./User"; | ||
import Base from "./Base"; | ||
import Client from "../client/Client"; | ||
import { APIValidationState, APIValidationStateData } from "../@types"; | ||
import Resource from "./Resource"; | ||
/** Represents an validation state for a resource */ | ||
@@ -16,6 +14,6 @@ export default class ValidationState extends Base { | ||
/** User who intervened */ | ||
get moderator(): User | null; | ||
get moderator(): import("./User").default | null; | ||
private getModerator; | ||
/** The linked resource */ | ||
get resource(): Resource | null; | ||
get resource(): import("./Resource").default | null; | ||
_patch(data: APIValidationStateData): void; | ||
@@ -22,0 +20,0 @@ /** Return data for api request */ |
@@ -16,4 +16,2 @@ import Resource from "../class/Resource"; | ||
create(validation: ValidationStateBuilder): Promise<ValidationState>; | ||
/** Delete an existing validation state for this resource */ | ||
update(validation: ValidationState): Promise<ValidationState>; | ||
} |
@@ -34,6 +34,2 @@ import { __extends } from "tslib"; | ||
}; | ||
/** Delete an existing validation state for this resource */ | ||
ResourceValidationStateManager.prototype.update = function (validation) { | ||
return this.client.validations.update(validation); | ||
}; | ||
return ResourceValidationStateManager; | ||
@@ -40,0 +36,0 @@ }(BaseManager)); |
@@ -21,4 +21,2 @@ import { Collection } from "@discordjs/collection"; | ||
create(validationBuilder: ValidationStateBuilder): Promise<ValidationState>; | ||
/** Update one validation */ | ||
update(validation: ValidationState): Promise<ValidationState>; | ||
} |
@@ -78,18 +78,2 @@ import { __awaiter, __extends, __generator } from "tslib"; | ||
}; | ||
/** Update one validation */ | ||
ValidationStateManager.prototype.update = function (validation) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var json, data; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
json = validation.toJSON(); | ||
return [4 /*yield*/, this.client.rest.putRequest("/validation_states/".concat(json.id), json)]; | ||
case 1: | ||
data = _a.sent(); | ||
return [2 /*return*/, this._add(data)]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return ValidationStateManager; | ||
@@ -96,0 +80,0 @@ }(BaseManager)); |
{ | ||
"name": "rr-apilib", | ||
"version": "0.8.3-alpha", | ||
"version": "0.9.0-alpha", | ||
"description": "Library for interact with RR-API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
186156
2740