diff --git a/src/index.ts b/src/index.ts index d52538c..0c64f82 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7398,6 +7398,114 @@ export class GetTariffsListResponse implements TDProtoClass { + /** + * MISSING CLASS DOCUMENTATION + * @param openDate DOCUMENTATION MISSING + * @param personalAccountId DOCUMENTATION MISSING + * @param teamId DOCUMENTATION MISSING + * @param teamUuid DOCUMENTATION MISSING + * @param closeDate DOCUMENTATION MISSING + */ + constructor ( + public openDate: string, + public personalAccountId: string, + public teamId: string, + public teamUuid: string, + public closeDate?: string, + ) {} + + public static fromJSON (raw: GetTeamOnPersonalAccountResponseJSON): GetTeamOnPersonalAccountResponse { + return new GetTeamOnPersonalAccountResponse( + raw.open_date, + raw.personal_account_id, + raw.team_id, + raw.team_uuid, + raw.close_date, + ) + } + + public mappableFields = [ + 'openDate', + 'personalAccountId', + 'teamId', + 'teamUuid', + 'closeDate', + ] as const + + readonly #mapper = { + /* eslint-disable camelcase */ + openDate: () => ({ open_date: this.openDate }), + personalAccountId: () => ({ personal_account_id: this.personalAccountId }), + teamId: () => ({ team_id: this.teamId }), + teamUuid: () => ({ team_uuid: this.teamUuid }), + closeDate: () => ({ close_date: this.closeDate }), + /* eslint-enable camelcase */ + } + + public toJSON (): GetTeamOnPersonalAccountResponseJSON + public toJSON (fields: Array): Partial + public toJSON (fields?: Array) { + if (fields && fields.length > 0) { + return Object.assign({}, ...fields.map(f => this.#mapper[f]())) + } else { + return Object.assign({}, ...Object.values(this.#mapper).map(v => v())) + } + } +} + +export interface GetTeamsOnPersonalAccountResponseJSON { + /* eslint-disable camelcase */ + teams: GetTeamOnPersonalAccountResponseJSON[]; + /* eslint-enable camelcase */ +} + +export class GetTeamsOnPersonalAccountResponse implements TDProtoClass { + /** + * MISSING CLASS DOCUMENTATION + * @param teams DOCUMENTATION MISSING + */ + constructor ( + public teams: GetTeamOnPersonalAccountResponse[], + ) {} + + public static fromJSON (raw: GetTeamsOnPersonalAccountResponseJSON): GetTeamsOnPersonalAccountResponse { + return new GetTeamsOnPersonalAccountResponse( + raw.teams.map(GetTeamOnPersonalAccountResponse.fromJSON), + ) + } + + public mappableFields = [ + 'teams', + ] as const + + readonly #mapper = { + /* eslint-disable camelcase */ + teams: () => ({ teams: this.teams.map(u => u.toJSON()) }), + /* eslint-enable camelcase */ + } + + public toJSON (): GetTeamsOnPersonalAccountResponseJSON + public toJSON (fields: Array): Partial + public toJSON (fields?: Array) { + if (fields && fields.length > 0) { + return Object.assign({}, ...fields.map(f => this.#mapper[f]())) + } else { + return Object.assign({}, ...Object.values(this.#mapper).map(v => v())) + } + } +} + export interface GetUnpaidWorkplacesByPersonalAccountResponseJSON { /* eslint-disable camelcase */ count?: number; @@ -10676,6 +10784,102 @@ export class Section implements TDProtoClass
{ } } +export interface ServerAccountUpdatedJSON { + /* eslint-disable camelcase */ + event: string; + params: ServerAccountUpdatedParamsJSON; + confirm_id?: string; + /* eslint-enable camelcase */ +} + +export class ServerAccountUpdated implements TDProtoClass { + /** + * Personal Account created or updated + * @param event DOCUMENTATION MISSING + * @param params DOCUMENTATION MISSING + * @param confirmId DOCUMENTATION MISSING + */ + constructor ( + public event: string, + public params: ServerAccountUpdatedParams, + public confirmId?: string, + ) {} + + public static fromJSON (raw: ServerAccountUpdatedJSON): ServerAccountUpdated { + return new ServerAccountUpdated( + raw.event, + ServerAccountUpdatedParams.fromJSON(raw.params), + raw.confirm_id, + ) + } + + public mappableFields = [ + 'event', + 'params', + 'confirmId', + ] as const + + readonly #mapper = { + /* eslint-disable camelcase */ + event: () => ({ event: this.event }), + params: () => ({ params: this.params.toJSON() }), + confirmId: () => ({ confirm_id: this.confirmId }), + /* eslint-enable camelcase */ + } + + public toJSON (): ServerAccountUpdatedJSON + public toJSON (fields: Array): Partial + public toJSON (fields?: Array) { + if (fields && fields.length > 0) { + return Object.assign({}, ...fields.map(f => this.#mapper[f]())) + } else { + return Object.assign({}, ...Object.values(this.#mapper).map(v => v())) + } + } +} + +export interface ServerAccountUpdatedParamsJSON { + /* eslint-disable camelcase */ + account: PersonalAccountBillingJSON; + /* eslint-enable camelcase */ +} + +export class ServerAccountUpdatedParams implements TDProtoClass { + /** + * Params of the server.account.updated event + * @param account Personal Account info + */ + constructor ( + public account: PersonalAccountBilling, + ) {} + + public static fromJSON (raw: ServerAccountUpdatedParamsJSON): ServerAccountUpdatedParams { + return new ServerAccountUpdatedParams( + PersonalAccountBilling.fromJSON(raw.account), + ) + } + + public mappableFields = [ + 'account', + ] as const + + readonly #mapper = { + /* eslint-disable camelcase */ + account: () => ({ account: this.account.toJSON() }), + /* eslint-enable camelcase */ + } + + public toJSON (): ServerAccountUpdatedParamsJSON + public toJSON (fields: Array): Partial + public toJSON (fields?: Array) { + if (fields && fields.length > 0) { + return Object.assign({}, ...fields.map(f => this.#mapper[f]())) + } else { + return Object.assign({}, ...Object.values(this.#mapper).map(v => v())) + } + } +} + export interface ServerCallAnswerJSON { /* eslint-disable camelcase */ event: string;