@guardian/bridget
Advanced tools
Comparing version 0.0.0-2024-03-25-snapshot to 0.0.0-2024-04-09-snapshot
@@ -5,2 +5,4 @@ /// <reference types="node" /> | ||
import * as DiscussionResponse from "./DiscussionResponse"; | ||
import * as GetUserProfileResponse from "./GetUserProfileResponse"; | ||
import * as ReportAbuseParameters from "./ReportAbuseParameters"; | ||
export declare const serviceName: string; | ||
@@ -29,2 +31,104 @@ export declare const annotations: thrift.IThriftAnnotations; | ||
} | ||
export interface IGetUserProfile__Args { | ||
} | ||
export interface IGetUserProfile__ArgsArgs { | ||
} | ||
export declare const GetUserProfile__ArgsCodec: thrift.IStructCodec<IGetUserProfile__ArgsArgs, IGetUserProfile__Args>; | ||
export declare class GetUserProfile__Args extends thrift.StructLike implements IGetUserProfile__Args { | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IGetUserProfile__ArgsArgs); | ||
static read(input: thrift.TProtocol): GetUserProfile__Args; | ||
static write(args: IGetUserProfile__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IComment__Args { | ||
shortUrl: string; | ||
body: string; | ||
} | ||
export interface IComment__ArgsArgs { | ||
shortUrl: string; | ||
body: string; | ||
} | ||
export declare const Comment__ArgsCodec: thrift.IStructCodec<IComment__ArgsArgs, IComment__Args>; | ||
export declare class Comment__Args extends thrift.StructLike implements IComment__Args { | ||
shortUrl: string; | ||
body: string; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: IComment__ArgsArgs); | ||
static read(input: thrift.TProtocol): Comment__Args; | ||
static write(args: IComment__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IPreview__Args { | ||
body: string; | ||
} | ||
export interface IPreview__ArgsArgs { | ||
body: string; | ||
} | ||
export declare const Preview__ArgsCodec: thrift.IStructCodec<IPreview__ArgsArgs, IPreview__Args>; | ||
export declare class Preview__Args extends thrift.StructLike implements IPreview__Args { | ||
body: string; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: IPreview__ArgsArgs); | ||
static read(input: thrift.TProtocol): Preview__Args; | ||
static write(args: IPreview__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IReply__Args { | ||
shortUrl: string; | ||
body: string; | ||
parentCommentId: string; | ||
} | ||
export interface IReply__ArgsArgs { | ||
shortUrl: string; | ||
body: string; | ||
parentCommentId: string; | ||
} | ||
export declare const Reply__ArgsCodec: thrift.IStructCodec<IReply__ArgsArgs, IReply__Args>; | ||
export declare class Reply__Args extends thrift.StructLike implements IReply__Args { | ||
shortUrl: string; | ||
body: string; | ||
parentCommentId: string; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: IReply__ArgsArgs); | ||
static read(input: thrift.TProtocol): Reply__Args; | ||
static write(args: IReply__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IAddUsername__Args { | ||
username: string; | ||
} | ||
export interface IAddUsername__ArgsArgs { | ||
username: string; | ||
} | ||
export declare const AddUsername__ArgsCodec: thrift.IStructCodec<IAddUsername__ArgsArgs, IAddUsername__Args>; | ||
export declare class AddUsername__Args extends thrift.StructLike implements IAddUsername__Args { | ||
username: string; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: IAddUsername__ArgsArgs); | ||
static read(input: thrift.TProtocol): AddUsername__Args; | ||
static write(args: IAddUsername__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IReportAbuse__Args { | ||
parameters: ReportAbuseParameters.IReportAbuseParameters; | ||
} | ||
export interface IReportAbuse__ArgsArgs { | ||
parameters: ReportAbuseParameters.IReportAbuseParametersArgs; | ||
} | ||
export declare const ReportAbuse__ArgsCodec: thrift.IStructCodec<IReportAbuse__ArgsArgs, IReportAbuse__Args>; | ||
export declare class ReportAbuse__Args extends thrift.StructLike implements IReportAbuse__Args { | ||
parameters: ReportAbuseParameters.IReportAbuseParameters; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: IReportAbuse__ArgsArgs); | ||
static read(input: thrift.TProtocol): ReportAbuse__Args; | ||
static write(args: IReportAbuse__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IRecommend__Result { | ||
@@ -46,2 +150,98 @@ success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IGetUserProfile__Result { | ||
success?: GetUserProfileResponse.GetUserProfileResponse; | ||
} | ||
export interface IGetUserProfile__ResultArgs { | ||
success?: GetUserProfileResponse.GetUserProfileResponseArgs; | ||
} | ||
export declare const GetUserProfile__ResultCodec: thrift.IStructCodec<IGetUserProfile__ResultArgs, IGetUserProfile__Result>; | ||
export declare class GetUserProfile__Result extends thrift.StructLike implements IGetUserProfile__Result { | ||
success?: GetUserProfileResponse.GetUserProfileResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IGetUserProfile__ResultArgs); | ||
static read(input: thrift.TProtocol): GetUserProfile__Result; | ||
static write(args: IGetUserProfile__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IComment__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IComment__ResultArgs { | ||
success?: DiscussionResponse.DiscussionResponseArgs; | ||
} | ||
export declare const Comment__ResultCodec: thrift.IStructCodec<IComment__ResultArgs, IComment__Result>; | ||
export declare class Comment__Result extends thrift.StructLike implements IComment__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IComment__ResultArgs); | ||
static read(input: thrift.TProtocol): Comment__Result; | ||
static write(args: IComment__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IPreview__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IPreview__ResultArgs { | ||
success?: DiscussionResponse.DiscussionResponseArgs; | ||
} | ||
export declare const Preview__ResultCodec: thrift.IStructCodec<IPreview__ResultArgs, IPreview__Result>; | ||
export declare class Preview__Result extends thrift.StructLike implements IPreview__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IPreview__ResultArgs); | ||
static read(input: thrift.TProtocol): Preview__Result; | ||
static write(args: IPreview__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IReply__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IReply__ResultArgs { | ||
success?: DiscussionResponse.DiscussionResponseArgs; | ||
} | ||
export declare const Reply__ResultCodec: thrift.IStructCodec<IReply__ResultArgs, IReply__Result>; | ||
export declare class Reply__Result extends thrift.StructLike implements IReply__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IReply__ResultArgs); | ||
static read(input: thrift.TProtocol): Reply__Result; | ||
static write(args: IReply__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IAddUsername__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IAddUsername__ResultArgs { | ||
success?: DiscussionResponse.DiscussionResponseArgs; | ||
} | ||
export declare const AddUsername__ResultCodec: thrift.IStructCodec<IAddUsername__ResultArgs, IAddUsername__Result>; | ||
export declare class AddUsername__Result extends thrift.StructLike implements IAddUsername__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IAddUsername__ResultArgs); | ||
static read(input: thrift.TProtocol): AddUsername__Result; | ||
static write(args: IAddUsername__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IReportAbuse__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
} | ||
export interface IReportAbuse__ResultArgs { | ||
success?: DiscussionResponse.DiscussionResponseArgs; | ||
} | ||
export declare const ReportAbuse__ResultCodec: thrift.IStructCodec<IReportAbuse__ResultArgs, IReportAbuse__Result>; | ||
export declare class ReportAbuse__Result extends thrift.StructLike implements IReportAbuse__Result { | ||
success?: DiscussionResponse.DiscussionResponse; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IReportAbuse__ResultArgs); | ||
static read(input: thrift.TProtocol): ReportAbuse__Result; | ||
static write(args: IReportAbuse__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export declare class Client<Context = any> extends thrift.ThriftClient<Context> { | ||
@@ -60,5 +260,17 @@ static readonly serviceName: string; | ||
recommend(commentId: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
getUserProfile(context?: Context): Promise<GetUserProfileResponse.GetUserProfileResponse>; | ||
comment(shortUrl: string, body: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
preview(body: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
reply(shortUrl: string, body: string, parentCommentId: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
addUsername(username: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
reportAbuse(parameters: ReportAbuseParameters.IReportAbuseParametersArgs, context?: Context): Promise<DiscussionResponse.DiscussionResponse>; | ||
} | ||
export interface IHandler<Context = any> { | ||
recommend(commentId: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
getUserProfile(context?: Context): GetUserProfileResponse.GetUserProfileResponseArgs | Promise<GetUserProfileResponse.GetUserProfileResponseArgs>; | ||
comment(shortUrl: string, body: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
preview(body: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
reply(shortUrl: string, body: string, parentCommentId: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
addUsername(username: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
reportAbuse(parameters: ReportAbuseParameters.IReportAbuseParameters, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>; | ||
} | ||
@@ -78,2 +290,8 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> { | ||
process_recommend(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_getUserProfile(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_comment(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_preview(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_reply(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_addUsername(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_reportAbuse(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
} |
1366
Discussion.js
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Processor = exports.Client = exports.Recommend__Result = exports.Recommend__ResultCodec = exports.Recommend__Args = exports.Recommend__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0; | ||
exports.Processor = exports.Client = exports.ReportAbuse__Result = exports.ReportAbuse__ResultCodec = exports.AddUsername__Result = exports.AddUsername__ResultCodec = exports.Reply__Result = exports.Reply__ResultCodec = exports.Preview__Result = exports.Preview__ResultCodec = exports.Comment__Result = exports.Comment__ResultCodec = exports.GetUserProfile__Result = exports.GetUserProfile__ResultCodec = exports.Recommend__Result = exports.Recommend__ResultCodec = exports.ReportAbuse__Args = exports.ReportAbuse__ArgsCodec = exports.AddUsername__Args = exports.AddUsername__ArgsCodec = exports.Reply__Args = exports.Reply__ArgsCodec = exports.Preview__Args = exports.Preview__ArgsCodec = exports.Comment__Args = exports.Comment__ArgsCodec = exports.GetUserProfile__Args = exports.GetUserProfile__ArgsCodec = exports.Recommend__Args = exports.Recommend__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0; | ||
/* tslint:disable */ | ||
@@ -36,2 +36,4 @@ /* eslint-disable */ | ||
const DiscussionResponse = __importStar(require("./DiscussionResponse")); | ||
const GetUserProfileResponse = __importStar(require("./GetUserProfileResponse")); | ||
const ReportAbuseParameters = __importStar(require("./ReportAbuseParameters")); | ||
exports.serviceName = "Discussion"; | ||
@@ -43,7 +45,37 @@ exports.annotations = {}; | ||
fieldAnnotations: {} | ||
}, | ||
getUserProfile: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
comment: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
preview: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
reply: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
addUsername: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
reportAbuse: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
} | ||
}; | ||
exports.methodNames = ["recommend"]; | ||
exports.methodNames = ["recommend", "getUserProfile", "comment", "preview", "reply", "addUsername", "reportAbuse"]; | ||
exports.methodParameters = { | ||
recommend: 2 | ||
recommend: 2, | ||
getUserProfile: 1, | ||
comment: 3, | ||
preview: 2, | ||
reply: 4, | ||
addUsername: 2, | ||
reportAbuse: 2 | ||
}; | ||
@@ -129,2 +161,519 @@ exports.Recommend__ArgsCodec = { | ||
exports.Recommend__Args = Recommend__Args; | ||
exports.GetUserProfile__ArgsCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("GetUserProfile__Args"); | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return {}; | ||
} | ||
}; | ||
class GetUserProfile__Args extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
} | ||
static read(input) { | ||
return new GetUserProfile__Args(exports.GetUserProfile__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.GetUserProfile__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.GetUserProfile__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.GetUserProfile__Args = GetUserProfile__Args; | ||
exports.Comment__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
shortUrl: args.shortUrl, | ||
body: args.body | ||
}; | ||
output.writeStructBegin("Comment__Args"); | ||
if (obj.shortUrl != null) { | ||
output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1); | ||
output.writeString(obj.shortUrl); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!"); | ||
} | ||
if (obj.body != null) { | ||
output.writeFieldBegin("body", thrift.TType.STRING, 2); | ||
output.writeString(obj.body); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_3 = input.readString(); | ||
_args.shortUrl = value_3; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 2: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_4 = input.readString(); | ||
_args.body = value_4; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.shortUrl !== undefined && _args.body !== undefined) { | ||
return { | ||
shortUrl: _args.shortUrl, | ||
body: _args.body | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Comment__Args from input"); | ||
} | ||
} | ||
}; | ||
class Comment__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.shortUrl != null) { | ||
const value_5 = args.shortUrl; | ||
this.shortUrl = value_5; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!"); | ||
} | ||
if (args.body != null) { | ||
const value_6 = args.body; | ||
this.body = value_6; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new Comment__Args(exports.Comment__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Comment__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Comment__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.Comment__Args = Comment__Args; | ||
exports.Preview__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
body: args.body | ||
}; | ||
output.writeStructBegin("Preview__Args"); | ||
if (obj.body != null) { | ||
output.writeFieldBegin("body", thrift.TType.STRING, 1); | ||
output.writeString(obj.body); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_7 = input.readString(); | ||
_args.body = value_7; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.body !== undefined) { | ||
return { | ||
body: _args.body | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Preview__Args from input"); | ||
} | ||
} | ||
}; | ||
class Preview__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.body != null) { | ||
const value_8 = args.body; | ||
this.body = value_8; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new Preview__Args(exports.Preview__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Preview__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Preview__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.Preview__Args = Preview__Args; | ||
exports.Reply__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
shortUrl: args.shortUrl, | ||
body: args.body, | ||
parentCommentId: args.parentCommentId | ||
}; | ||
output.writeStructBegin("Reply__Args"); | ||
if (obj.shortUrl != null) { | ||
output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1); | ||
output.writeString(obj.shortUrl); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!"); | ||
} | ||
if (obj.body != null) { | ||
output.writeFieldBegin("body", thrift.TType.STRING, 2); | ||
output.writeString(obj.body); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
if (obj.parentCommentId != null) { | ||
output.writeFieldBegin("parentCommentId", thrift.TType.STRING, 3); | ||
output.writeString(obj.parentCommentId); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_9 = input.readString(); | ||
_args.shortUrl = value_9; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 2: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_10 = input.readString(); | ||
_args.body = value_10; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 3: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_11 = input.readString(); | ||
_args.parentCommentId = value_11; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.shortUrl !== undefined && _args.body !== undefined && _args.parentCommentId !== undefined) { | ||
return { | ||
shortUrl: _args.shortUrl, | ||
body: _args.body, | ||
parentCommentId: _args.parentCommentId | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Reply__Args from input"); | ||
} | ||
} | ||
}; | ||
class Reply__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.shortUrl != null) { | ||
const value_12 = args.shortUrl; | ||
this.shortUrl = value_12; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!"); | ||
} | ||
if (args.body != null) { | ||
const value_13 = args.body; | ||
this.body = value_13; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!"); | ||
} | ||
if (args.parentCommentId != null) { | ||
const value_14 = args.parentCommentId; | ||
this.parentCommentId = value_14; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new Reply__Args(exports.Reply__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Reply__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Reply__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.Reply__Args = Reply__Args; | ||
exports.AddUsername__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
username: args.username | ||
}; | ||
output.writeStructBegin("AddUsername__Args"); | ||
if (obj.username != null) { | ||
output.writeFieldBegin("username", thrift.TType.STRING, 1); | ||
output.writeString(obj.username); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[username] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.STRING) { | ||
const value_15 = input.readString(); | ||
_args.username = value_15; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.username !== undefined) { | ||
return { | ||
username: _args.username | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read AddUsername__Args from input"); | ||
} | ||
} | ||
}; | ||
class AddUsername__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.username != null) { | ||
const value_16 = args.username; | ||
this.username = value_16; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[username] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new AddUsername__Args(exports.AddUsername__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.AddUsername__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.AddUsername__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.AddUsername__Args = AddUsername__Args; | ||
exports.ReportAbuse__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
parameters: args.parameters | ||
}; | ||
output.writeStructBegin("ReportAbuse__Args"); | ||
if (obj.parameters != null) { | ||
output.writeFieldBegin("parameters", thrift.TType.STRUCT, 1); | ||
ReportAbuseParameters.ReportAbuseParametersCodec.encode(obj.parameters, output); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parameters] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_17 = ReportAbuseParameters.ReportAbuseParametersCodec.decode(input); | ||
_args.parameters = value_17; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.parameters !== undefined) { | ||
return { | ||
parameters: _args.parameters | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read ReportAbuse__Args from input"); | ||
} | ||
} | ||
}; | ||
class ReportAbuse__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.parameters != null) { | ||
const value_18 = new ReportAbuseParameters.ReportAbuseParameters(args.parameters); | ||
this.parameters = value_18; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parameters] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new ReportAbuse__Args(exports.ReportAbuse__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.ReportAbuse__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.ReportAbuse__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.ReportAbuse__Args = ReportAbuse__Args; | ||
exports.Recommend__ResultCodec = { | ||
@@ -158,4 +707,4 @@ encode(args, output) { | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_3 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_3; | ||
const value_19 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_19; | ||
} | ||
@@ -184,4 +733,4 @@ else { | ||
if (args.success != null) { | ||
const value_4 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_4; | ||
const value_20 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_20; | ||
} | ||
@@ -200,2 +749,410 @@ } | ||
exports.Recommend__Result = Recommend__Result; | ||
exports.GetUserProfile__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("GetUserProfile__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
GetUserProfileResponse.GetUserProfileResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_21 = GetUserProfileResponse.GetUserProfileResponseCodec.decode(input); | ||
_args.success = value_21; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class GetUserProfile__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_22 = GetUserProfileResponse.GetUserProfileResponseCodec.create(args.success); | ||
this.success = value_22; | ||
} | ||
} | ||
static read(input) { | ||
return new GetUserProfile__Result(exports.GetUserProfile__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.GetUserProfile__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.GetUserProfile__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.GetUserProfile__Result = GetUserProfile__Result; | ||
exports.Comment__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("Comment__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_23 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_23; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class Comment__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_24 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_24; | ||
} | ||
} | ||
static read(input) { | ||
return new Comment__Result(exports.Comment__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Comment__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Comment__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.Comment__Result = Comment__Result; | ||
exports.Preview__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("Preview__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_25 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_25; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class Preview__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_26 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_26; | ||
} | ||
} | ||
static read(input) { | ||
return new Preview__Result(exports.Preview__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Preview__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Preview__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.Preview__Result = Preview__Result; | ||
exports.Reply__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("Reply__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_27 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_27; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class Reply__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_28 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_28; | ||
} | ||
} | ||
static read(input) { | ||
return new Reply__Result(exports.Reply__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Reply__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Reply__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.Reply__Result = Reply__Result; | ||
exports.AddUsername__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("AddUsername__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_29 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_29; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class AddUsername__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_30 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_30; | ||
} | ||
} | ||
static read(input) { | ||
return new AddUsername__Result(exports.AddUsername__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.AddUsername__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.AddUsername__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.AddUsername__Result = AddUsername__Result; | ||
exports.ReportAbuse__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("ReportAbuse__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.STRUCT, 0); | ||
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}, | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
while (true) { | ||
const ret = input.readFieldBegin(); | ||
const fieldType = ret.fieldType; | ||
const fieldId = ret.fieldId; | ||
if (fieldType === thrift.TType.STOP) { | ||
break; | ||
} | ||
switch (fieldId) { | ||
case 0: | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_31 = DiscussionResponse.DiscussionResponseCodec.decode(input); | ||
_args.success = value_31; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class ReportAbuse__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_32 = DiscussionResponse.DiscussionResponseCodec.create(args.success); | ||
this.success = value_32; | ||
} | ||
} | ||
static read(input) { | ||
return new ReportAbuse__Result(exports.ReportAbuse__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.ReportAbuse__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.ReportAbuse__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.ReportAbuse__Result = ReportAbuse__Result; | ||
class Client extends thrift.ThriftClient { | ||
@@ -248,2 +1205,230 @@ constructor() { | ||
} | ||
getUserProfile(context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("getUserProfile", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = {}; | ||
exports.GetUserProfile__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "getUserProfile") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.GetUserProfile__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getUserProfile failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
comment(shortUrl, body, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("comment", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { shortUrl, body }; | ||
exports.Comment__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "comment") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.Comment__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "comment failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
preview(body, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("preview", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { body }; | ||
exports.Preview__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "preview") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.Preview__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "preview failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
reply(shortUrl, body, parentCommentId, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("reply", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { shortUrl, body, parentCommentId }; | ||
exports.Reply__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "reply") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.Reply__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reply failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
addUsername(username, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("addUsername", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { username }; | ||
exports.AddUsername__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "addUsername") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.AddUsername__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "addUsername failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
reportAbuse(parameters, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("reportAbuse", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { parameters }; | ||
exports.ReportAbuse__ArgsCodec.encode(args, output); | ||
output.writeMessageEnd(); | ||
return this.connection.send(writer.flush(), context).then((data) => { | ||
const reader = this.transport.receiver(data); | ||
const input = new this.protocol(reader); | ||
try { | ||
const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin(); | ||
if (fieldName === "reportAbuse") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.ReportAbuse__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reportAbuse failed: unknown result")); | ||
} | ||
} | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -275,2 +1460,26 @@ exports.Client = Client; | ||
} | ||
case "process_getUserProfile": { | ||
resolve(this.process_getUserProfile(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_comment": { | ||
resolve(this.process_comment(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_preview": { | ||
resolve(this.process_preview(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_reply": { | ||
resolve(this.process_reply(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_addUsername": { | ||
resolve(this.process_addUsername(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_reportAbuse": { | ||
resolve(this.process_reportAbuse(requestId, input, output, context)); | ||
break; | ||
} | ||
default: { | ||
@@ -314,2 +1523,145 @@ input.skip(thrift.TType.STRUCT); | ||
} | ||
process_getUserProfile(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
input.readMessageEnd(); | ||
resolve(this._handler.getUserProfile(context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("getUserProfile", thrift.MessageType.REPLY, requestId); | ||
exports.GetUserProfile__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("getUserProfile", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_comment(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.Comment__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.comment(args.shortUrl, args.body, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("comment", thrift.MessageType.REPLY, requestId); | ||
exports.Comment__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("comment", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_preview(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.Preview__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.preview(args.body, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("preview", thrift.MessageType.REPLY, requestId); | ||
exports.Preview__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("preview", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_reply(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.Reply__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.reply(args.shortUrl, args.body, args.parentCommentId, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("reply", thrift.MessageType.REPLY, requestId); | ||
exports.Reply__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("reply", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_addUsername(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.AddUsername__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.addUsername(args.username, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("addUsername", thrift.MessageType.REPLY, requestId); | ||
exports.AddUsername__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("addUsername", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_reportAbuse(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.ReportAbuse__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.reportAbuse(args.parameters, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("reportAbuse", thrift.MessageType.REPLY, requestId); | ||
exports.ReportAbuse__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("reportAbuse", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
} | ||
@@ -316,0 +1668,0 @@ exports.Processor = Processor; |
@@ -14,4 +14,8 @@ export * from "./PurchaseScreenReason"; | ||
export * from "./MetricFont"; | ||
export * from "./DiscussionBadge"; | ||
export * from "./DiscussionUserProfile"; | ||
export * from "./DiscussionApiResponse"; | ||
export * from "./ReportAbuseParameters"; | ||
export * from "./Metric"; | ||
export * from "./GetUserProfileResponse"; | ||
export * from "./DiscussionResponse"; | ||
@@ -18,0 +22,0 @@ import * as Environment from "./Environment"; |
@@ -49,4 +49,8 @@ "use strict"; | ||
__exportStar(require("./MetricFont"), exports); | ||
__exportStar(require("./DiscussionBadge"), exports); | ||
__exportStar(require("./DiscussionUserProfile"), exports); | ||
__exportStar(require("./DiscussionApiResponse"), exports); | ||
__exportStar(require("./ReportAbuseParameters"), exports); | ||
__exportStar(require("./Metric"), exports); | ||
__exportStar(require("./GetUserProfileResponse"), exports); | ||
__exportStar(require("./DiscussionResponse"), exports); | ||
@@ -53,0 +57,0 @@ const Environment = __importStar(require("./Environment")); |
{ | ||
"name": "@guardian/bridget", | ||
"version": "0.0.0-2024-03-25-snapshot", | ||
"version": "0.0.0-2024-04-09-snapshot", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -181,10 +181,10 @@ /// <reference types="node" /> | ||
export interface ISignIn__Result { | ||
success?: void; | ||
success?: boolean; | ||
} | ||
export interface ISignIn__ResultArgs { | ||
success?: void; | ||
success?: boolean; | ||
} | ||
export declare const SignIn__ResultCodec: thrift.IStructCodec<ISignIn__ResultArgs, ISignIn__Result>; | ||
export declare class SignIn__Result extends thrift.StructLike implements ISignIn__Result { | ||
success?: void; | ||
success?: boolean; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
@@ -214,3 +214,3 @@ readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
isSignedIn(context?: Context): Promise<boolean>; | ||
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): Promise<void>; | ||
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): Promise<boolean>; | ||
} | ||
@@ -223,3 +223,3 @@ export interface IHandler<Context = any> { | ||
isSignedIn(context?: Context): boolean | Promise<boolean>; | ||
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): void | Promise<void>; | ||
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): boolean | Promise<boolean>; | ||
} | ||
@@ -226,0 +226,0 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> { |
24
User.js
@@ -803,3 +803,11 @@ "use strict"; | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("SignIn__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.BOOL, 0); | ||
output.writeBool(obj.success); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
@@ -821,4 +829,5 @@ output.writeStructEnd(); | ||
case 0: | ||
if (fieldType === thrift.TType.VOID) { | ||
input.skip(fieldType); | ||
if (fieldType === thrift.TType.BOOL) { | ||
const value_25 = input.readBool(); | ||
_args.success = value_25; | ||
} | ||
@@ -847,4 +856,4 @@ else { | ||
if (args.success != null) { | ||
const value_25 = undefined; | ||
this.success = value_25; | ||
const value_26 = args.success; | ||
this.success = value_26; | ||
} | ||
@@ -1083,3 +1092,8 @@ } | ||
input.readMessageEnd(); | ||
return Promise.resolve(result.success); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "signIn failed: unknown result")); | ||
} | ||
} | ||
@@ -1086,0 +1100,0 @@ } |
550326
70
13655