New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@guardian/bridget

Package Overview
Dependencies
Maintainers
6
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guardian/bridget - npm Package Compare versions

Comparing version 0.0.0-2024-02-19-SNAPSHOT-2 to 0.0.0-2024-02-19-SNAPSHOT-CE1

DiscussionApiResponse.d.ts

221

Discussion.d.ts
/// <reference types="node" />
import * as thrift from "@creditkarma/thrift-server-core";
import * as CommentResponse from "./CommentResponse";
import * as GetUserProfileResponse from "./GetUserProfileResponse";
import * as DiscussionResponse from "./DiscussionResponse";
import * as ReportAbuseParameters from "./ReportAbuseParameters";
export declare const serviceName: string;

@@ -11,47 +13,15 @@ export declare const annotations: thrift.IThriftAnnotations;

};
export interface IPreview__Args {
body: string;
export interface IGetUserProfile__Args {
}
export interface IPreview__ArgsArgs {
body: string;
export interface IGetUserProfile__ArgsArgs {
}
export declare const Preview__ArgsCodec: thrift.IStructCodec<IPreview__ArgsArgs, IPreview__Args>;
export declare class Preview__Args extends thrift.StructLike implements IPreview__Args {
body: string;
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: IPreview__ArgsArgs);
static read(input: thrift.TProtocol): Preview__Args;
static write(args: IPreview__ArgsArgs, output: thrift.TProtocol): void;
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 IIsDiscussionEnabled__Args {
}
export interface IIsDiscussionEnabled__ArgsArgs {
}
export declare const IsDiscussionEnabled__ArgsCodec: thrift.IStructCodec<IIsDiscussionEnabled__ArgsArgs, IIsDiscussionEnabled__Args>;
export declare class IsDiscussionEnabled__Args extends thrift.StructLike implements IIsDiscussionEnabled__Args {
readonly _annotations: thrift.IThriftAnnotations;
readonly _fieldAnnotations: thrift.IFieldAnnotations;
constructor(args?: IIsDiscussionEnabled__ArgsArgs);
static read(input: thrift.TProtocol): IsDiscussionEnabled__Args;
static write(args: IIsDiscussionEnabled__ArgsArgs, output: thrift.TProtocol): void;
write(output: thrift.TProtocol): void;
}
export interface IRecommend__Args {
commentId: number;
}
export interface IRecommend__ArgsArgs {
commentId: number;
}
export declare const Recommend__ArgsCodec: thrift.IStructCodec<IRecommend__ArgsArgs, IRecommend__Args>;
export declare class Recommend__Args extends thrift.StructLike implements IRecommend__Args {
commentId: number;
readonly _annotations: thrift.IThriftAnnotations;
readonly _fieldAnnotations: thrift.IFieldAnnotations;
constructor(args: IRecommend__ArgsArgs);
static read(input: thrift.TProtocol): Recommend__Args;
static write(args: IRecommend__ArgsArgs, output: thrift.TProtocol): void;
write(output: thrift.TProtocol): void;
}
export interface IComment__Args {

@@ -79,3 +49,3 @@ shortUrl: string;

body: string;
parentCommentId: number;
parentCommentId: string;
}

@@ -85,3 +55,3 @@ export interface IReply__ArgsArgs {

body: string;
parentCommentId: number;
parentCommentId: string;
}

@@ -92,3 +62,3 @@ export declare const Reply__ArgsCodec: thrift.IStructCodec<IReply__ArgsArgs, IReply__Args>;

body: string;
parentCommentId: number;
parentCommentId: string;
readonly _annotations: thrift.IThriftAnnotations;

@@ -101,59 +71,75 @@ readonly _fieldAnnotations: thrift.IFieldAnnotations;

}
export interface IPreview__Result {
success?: string;
export interface IRecommend__Args {
commentId: string;
}
export interface IPreview__ResultArgs {
success?: string;
export interface IRecommend__ArgsArgs {
commentId: string;
}
export declare const Preview__ResultCodec: thrift.IStructCodec<IPreview__ResultArgs, IPreview__Result>;
export declare class Preview__Result extends thrift.StructLike implements IPreview__Result {
success?: string;
export declare const Recommend__ArgsCodec: thrift.IStructCodec<IRecommend__ArgsArgs, IRecommend__Args>;
export declare class Recommend__Args extends thrift.StructLike implements IRecommend__Args {
commentId: string;
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;
constructor(args: IRecommend__ArgsArgs);
static read(input: thrift.TProtocol): Recommend__Args;
static write(args: IRecommend__ArgsArgs, output: thrift.TProtocol): void;
write(output: thrift.TProtocol): void;
}
export interface IIsDiscussionEnabled__Result {
success?: boolean;
export interface IAddUsername__Args {
username: string;
}
export interface IIsDiscussionEnabled__ResultArgs {
success?: boolean;
export interface IAddUsername__ArgsArgs {
username: string;
}
export declare const IsDiscussionEnabled__ResultCodec: thrift.IStructCodec<IIsDiscussionEnabled__ResultArgs, IIsDiscussionEnabled__Result>;
export declare class IsDiscussionEnabled__Result extends thrift.StructLike implements IIsDiscussionEnabled__Result {
success?: boolean;
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?: IIsDiscussionEnabled__ResultArgs);
static read(input: thrift.TProtocol): IsDiscussionEnabled__Result;
static write(args: IIsDiscussionEnabled__ResultArgs, output: thrift.TProtocol): void;
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 IRecommend__Result {
success?: boolean;
export interface IReportAbuse__Args {
parameters: ReportAbuseParameters.IReportAbuseParameters;
}
export interface IRecommend__ResultArgs {
success?: boolean;
export interface IReportAbuse__ArgsArgs {
parameters: ReportAbuseParameters.IReportAbuseParametersArgs;
}
export declare const Recommend__ResultCodec: thrift.IStructCodec<IRecommend__ResultArgs, IRecommend__Result>;
export declare class Recommend__Result extends thrift.StructLike implements IRecommend__Result {
success?: boolean;
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?: IRecommend__ResultArgs);
static read(input: thrift.TProtocol): Recommend__Result;
static write(args: IRecommend__ResultArgs, output: thrift.TProtocol): void;
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 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?: CommentResponse.ICommentResponse;
success?: DiscussionResponse.DiscussionResponse;
}
export interface IComment__ResultArgs {
success?: CommentResponse.ICommentResponseArgs;
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?: CommentResponse.ICommentResponse;
success?: DiscussionResponse.DiscussionResponse;
readonly _annotations: thrift.IThriftAnnotations;

@@ -167,10 +153,10 @@ readonly _fieldAnnotations: thrift.IFieldAnnotations;

export interface IReply__Result {
success?: CommentResponse.ICommentResponse;
success?: DiscussionResponse.DiscussionResponse;
}
export interface IReply__ResultArgs {
success?: CommentResponse.ICommentResponseArgs;
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?: CommentResponse.ICommentResponse;
success?: DiscussionResponse.DiscussionResponse;
readonly _annotations: thrift.IThriftAnnotations;

@@ -183,2 +169,50 @@ readonly _fieldAnnotations: thrift.IFieldAnnotations;

}
export interface IRecommend__Result {
success?: DiscussionResponse.DiscussionResponse;
}
export interface IRecommend__ResultArgs {
success?: DiscussionResponse.DiscussionResponseArgs;
}
export declare const Recommend__ResultCodec: thrift.IStructCodec<IRecommend__ResultArgs, IRecommend__Result>;
export declare class Recommend__Result extends thrift.StructLike implements IRecommend__Result {
success?: DiscussionResponse.DiscussionResponse;
readonly _annotations: thrift.IThriftAnnotations;
readonly _fieldAnnotations: thrift.IFieldAnnotations;
constructor(args?: IRecommend__ResultArgs);
static read(input: thrift.TProtocol): Recommend__Result;
static write(args: IRecommend__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> {

@@ -196,14 +230,16 @@ static readonly serviceName: string;

};
preview(body: string, context?: Context): Promise<string>;
isDiscussionEnabled(context?: Context): Promise<boolean>;
recommend(commentId: number, context?: Context): Promise<boolean>;
comment(shortUrl: string, body: string, context?: Context): Promise<CommentResponse.ICommentResponse>;
reply(shortUrl: string, body: string, parentCommentId: number, context?: Context): Promise<CommentResponse.ICommentResponse>;
getUserProfile(context?: Context): Promise<GetUserProfileResponse.GetUserProfileResponse>;
comment(shortUrl: string, body: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>;
reply(shortUrl: string, body: string, parentCommentId: string, context?: Context): Promise<DiscussionResponse.DiscussionResponse>;
recommend(commentId: 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> {
preview(body: string, context?: Context): string | Promise<string>;
isDiscussionEnabled(context?: Context): boolean | Promise<boolean>;
recommend(commentId: number, context?: Context): boolean | Promise<boolean>;
comment(shortUrl: string, body: string, context?: Context): CommentResponse.ICommentResponseArgs | Promise<CommentResponse.ICommentResponseArgs>;
reply(shortUrl: string, body: string, parentCommentId: number, context?: Context): CommentResponse.ICommentResponseArgs | Promise<CommentResponse.ICommentResponseArgs>;
getUserProfile(context?: Context): GetUserProfileResponse.GetUserProfileResponseArgs | Promise<GetUserProfileResponse.GetUserProfileResponseArgs>;
comment(shortUrl: string, body: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>;
reply(shortUrl: string, body: string, parentCommentId: string, context?: Context): DiscussionResponse.DiscussionResponseArgs | Promise<DiscussionResponse.DiscussionResponseArgs>;
recommend(commentId: 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>;
}

@@ -222,7 +258,8 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {

process(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_isDiscussionEnabled(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
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_reply(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
process_recommend(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>;
}

@@ -17,14 +17,20 @@ "use strict";

const thrift = __importStar(require("@creditkarma/thrift-server-core"));
const CommentResponse = __importStar(require("./CommentResponse"));
const GetUserProfileResponse = __importStar(require("./GetUserProfileResponse"));
const DiscussionResponse = __importStar(require("./DiscussionResponse"));
const ReportAbuseParameters = __importStar(require("./ReportAbuseParameters"));
exports.serviceName = "Discussion";
exports.annotations = {};
exports.methodAnnotations = {
preview: {
getUserProfile: {
annotations: {},
fieldAnnotations: {}
},
isDiscussionEnabled: {
comment: {
annotations: {},
fieldAnnotations: {}
},
reply: {
annotations: {},
fieldAnnotations: {}
},
recommend: {

@@ -34,7 +40,7 @@ annotations: {},

},
comment: {
addUsername: {
annotations: {},
fieldAnnotations: {}
},
reply: {
reportAbuse: {
annotations: {},

@@ -44,18 +50,72 @@ fieldAnnotations: {}

};
exports.methodNames = ["preview", "isDiscussionEnabled", "recommend", "comment", "reply"];
exports.methodNames = ["getUserProfile", "comment", "reply", "recommend", "addUsername", "reportAbuse"];
exports.methodParameters = {
preview: 2,
isDiscussionEnabled: 1,
getUserProfile: 1,
comment: 3,
reply: 4,
recommend: 2,
comment: 3,
reply: 4
addUsername: 2,
reportAbuse: 2
};
exports.Preview__ArgsCodec = {
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("Preview__Args");
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, 1);
output.writeFieldBegin("body", thrift.TType.STRING, 2);
output.writeString(obj.body);

@@ -85,3 +145,3 @@ output.writeFieldEnd();

const value_1 = input.readString();
_args.body = value_1;
_args.shortUrl = value_1;
}

@@ -92,2 +152,11 @@ else {

break;
case 2:
if (fieldType === thrift.TType.STRING) {
const value_2 = input.readString();
_args.body = value_2;
}
else {
input.skip(fieldType);
}
break;
default: {

@@ -100,4 +169,5 @@ input.skip(fieldType);

input.readStructEnd();
if (_args.body !== undefined) {
if (_args.shortUrl !== undefined && _args.body !== undefined) {
return {
shortUrl: _args.shortUrl,
body: _args.body

@@ -107,7 +177,7 @@ };

else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Preview__Args from input");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Comment__Args from input");
}
}
};
class Preview__Args extends thrift.StructLike {
class Comment__Args extends thrift.StructLike {
constructor(args) {

@@ -117,5 +187,12 @@ super();

this._fieldAnnotations = {};
if (args.shortUrl != null) {
const value_3 = args.shortUrl;
this.shortUrl = value_3;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
}
if (args.body != null) {
const value_2 = args.body;
this.body = value_2;
const value_4 = args.body;
this.body = value_4;
}

@@ -127,15 +204,44 @@ else {

static read(input) {
return new Preview__Args(exports.Preview__ArgsCodec.decode(input));
return new Comment__Args(exports.Comment__ArgsCodec.decode(input));
}
static write(args, output) {
return exports.Preview__ArgsCodec.encode(args, output);
return exports.Comment__ArgsCodec.encode(args, output);
}
write(output) {
return exports.Preview__ArgsCodec.encode(this, output);
return exports.Comment__ArgsCodec.encode(this, output);
}
}
exports.Preview__Args = Preview__Args;
exports.IsDiscussionEnabled__ArgsCodec = {
exports.Comment__Args = Comment__Args;
exports.Reply__ArgsCodec = {
encode(args, output) {
output.writeStructBegin("IsDiscussionEnabled__Args");
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();

@@ -146,2 +252,3 @@ output.writeStructEnd();

decode(input) {
let _args = {};
input.readStructBegin();

@@ -156,2 +263,29 @@ while (true) {

switch (fieldId) {
case 1:
if (fieldType === thrift.TType.STRING) {
const value_5 = input.readString();
_args.shortUrl = value_5;
}
else {
input.skip(fieldType);
}
break;
case 2:
if (fieldType === thrift.TType.STRING) {
const value_6 = input.readString();
_args.body = value_6;
}
else {
input.skip(fieldType);
}
break;
case 3:
if (fieldType === thrift.TType.STRING) {
const value_7 = input.readString();
_args.parentCommentId = value_7;
}
else {
input.skip(fieldType);
}
break;
default: {

@@ -164,22 +298,52 @@ input.skip(fieldType);

input.readStructEnd();
return {};
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 IsDiscussionEnabled__Args extends thrift.StructLike {
constructor(args = {}) {
class Reply__Args extends thrift.StructLike {
constructor(args) {
super();
this._annotations = {};
this._fieldAnnotations = {};
if (args.shortUrl != null) {
const value_8 = args.shortUrl;
this.shortUrl = value_8;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
}
if (args.body != null) {
const value_9 = args.body;
this.body = value_9;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[body] is unset!");
}
if (args.parentCommentId != null) {
const value_10 = args.parentCommentId;
this.parentCommentId = value_10;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
}
}
static read(input) {
return new IsDiscussionEnabled__Args(exports.IsDiscussionEnabled__ArgsCodec.decode(input));
return new Reply__Args(exports.Reply__ArgsCodec.decode(input));
}
static write(args, output) {
return exports.IsDiscussionEnabled__ArgsCodec.encode(args, output);
return exports.Reply__ArgsCodec.encode(args, output);
}
write(output) {
return exports.IsDiscussionEnabled__ArgsCodec.encode(this, output);
return exports.Reply__ArgsCodec.encode(this, output);
}
}
exports.IsDiscussionEnabled__Args = IsDiscussionEnabled__Args;
exports.Reply__Args = Reply__Args;
exports.Recommend__ArgsCodec = {

@@ -192,4 +356,4 @@ encode(args, output) {

if (obj.commentId != null) {
output.writeFieldBegin("commentId", thrift.TType.I32, 1);
output.writeI32(obj.commentId);
output.writeFieldBegin("commentId", thrift.TType.STRING, 1);
output.writeString(obj.commentId);
output.writeFieldEnd();

@@ -216,5 +380,5 @@ }

case 1:
if (fieldType === thrift.TType.I32) {
const value_3 = input.readI32();
_args.commentId = value_3;
if (fieldType === thrift.TType.STRING) {
const value_11 = input.readString();
_args.commentId = value_11;
}

@@ -248,4 +412,4 @@ else {

if (args.commentId != null) {
const value_4 = args.commentId;
this.commentId = value_4;
const value_12 = args.commentId;
this.commentId = value_12;
}

@@ -267,25 +431,16 @@ else {

exports.Recommend__Args = Recommend__Args;
exports.Comment__ArgsCodec = {
exports.AddUsername__ArgsCodec = {
encode(args, output) {
const obj = {
shortUrl: args.shortUrl,
body: args.body
username: args.username
};
output.writeStructBegin("Comment__Args");
if (obj.shortUrl != null) {
output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
output.writeString(obj.shortUrl);
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[shortUrl] is unset!");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[username] 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();

@@ -308,4 +463,4 @@ output.writeStructEnd();

if (fieldType === thrift.TType.STRING) {
const value_5 = input.readString();
_args.shortUrl = value_5;
const value_13 = input.readString();
_args.username = value_13;
}

@@ -316,11 +471,2 @@ else {

break;
case 2:
if (fieldType === thrift.TType.STRING) {
const value_6 = input.readString();
_args.body = value_6;
}
else {
input.skip(fieldType);
}
break;
default: {

@@ -333,14 +479,13 @@ input.skip(fieldType);

input.readStructEnd();
if (_args.shortUrl !== undefined && _args.body !== undefined) {
if (_args.username !== undefined) {
return {
shortUrl: _args.shortUrl,
body: _args.body
username: _args.username
};
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Comment__Args from input");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read AddUsername__Args from input");
}
}
};
class Comment__Args extends thrift.StructLike {
class AddUsername__Args extends thrift.StructLike {
constructor(args) {

@@ -350,60 +495,35 @@ super();

this._fieldAnnotations = {};
if (args.shortUrl != null) {
const value_7 = args.shortUrl;
this.shortUrl = value_7;
if (args.username != null) {
const value_14 = args.username;
this.username = value_14;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[username] is unset!");
}
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 Comment__Args(exports.Comment__ArgsCodec.decode(input));
return new AddUsername__Args(exports.AddUsername__ArgsCodec.decode(input));
}
static write(args, output) {
return exports.Comment__ArgsCodec.encode(args, output);
return exports.AddUsername__ArgsCodec.encode(args, output);
}
write(output) {
return exports.Comment__ArgsCodec.encode(this, output);
return exports.AddUsername__ArgsCodec.encode(this, output);
}
}
exports.Comment__Args = Comment__Args;
exports.Reply__ArgsCodec = {
exports.AddUsername__Args = AddUsername__Args;
exports.ReportAbuse__ArgsCodec = {
encode(args, output) {
const obj = {
shortUrl: args.shortUrl,
body: args.body,
parentCommentId: args.parentCommentId
parameters: args.parameters
};
output.writeStructBegin("Reply__Args");
if (obj.shortUrl != null) {
output.writeFieldBegin("shortUrl", thrift.TType.STRING, 1);
output.writeString(obj.shortUrl);
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[shortUrl] is unset!");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parameters] 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.I32, 3);
output.writeI32(obj.parentCommentId);
output.writeFieldEnd();
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parentCommentId] is unset!");
}
output.writeFieldStop();

@@ -425,5 +545,5 @@ output.writeStructEnd();

case 1:
if (fieldType === thrift.TType.STRING) {
const value_9 = input.readString();
_args.shortUrl = value_9;
if (fieldType === thrift.TType.STRUCT) {
const value_15 = ReportAbuseParameters.ReportAbuseParametersCodec.decode(input);
_args.parameters = value_15;
}

@@ -434,20 +554,2 @@ else {

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.I32) {
const value_11 = input.readI32();
_args.parentCommentId = value_11;
}
else {
input.skip(fieldType);
}
break;
default: {

@@ -460,15 +562,13 @@ input.skip(fieldType);

input.readStructEnd();
if (_args.shortUrl !== undefined && _args.body !== undefined && _args.parentCommentId !== undefined) {
if (_args.parameters !== undefined) {
return {
shortUrl: _args.shortUrl,
body: _args.body,
parentCommentId: _args.parentCommentId
parameters: _args.parameters
};
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read Reply__Args from input");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read ReportAbuse__Args from input");
}
}
};
class Reply__Args extends thrift.StructLike {
class ReportAbuse__Args extends thrift.StructLike {
constructor(args) {

@@ -478,36 +578,90 @@ super();

this._fieldAnnotations = {};
if (args.shortUrl != null) {
const value_12 = args.shortUrl;
this.shortUrl = value_12;
if (args.parameters != null) {
const value_16 = new ReportAbuseParameters.ReportAbuseParameters(args.parameters);
this.parameters = value_16;
}
else {
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[shortUrl] is unset!");
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[parameters] is unset!");
}
if (args.body != null) {
const value_13 = args.body;
this.body = value_13;
}
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.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();
}
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 0:
if (fieldType === thrift.TType.STRUCT) {
const value_17 = GetUserProfileResponse.GetUserProfileResponseCodec.decode(input);
_args.success = value_17;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
if (args.parentCommentId != null) {
const value_14 = args.parentCommentId;
this.parentCommentId = value_14;
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_18 = GetUserProfileResponse.GetUserProfileResponseCodec.create(args.success);
this.success = value_18;
}
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));
return new GetUserProfile__Result(exports.GetUserProfile__ResultCodec.decode(input));
}
static write(args, output) {
return exports.Reply__ArgsCodec.encode(args, output);
return exports.GetUserProfile__ResultCodec.encode(args, output);
}
write(output) {
return exports.Reply__ArgsCodec.encode(this, output);
return exports.GetUserProfile__ResultCodec.encode(this, output);
}
}
exports.Reply__Args = Reply__Args;
exports.Preview__ResultCodec = {
exports.GetUserProfile__Result = GetUserProfile__Result;
exports.Comment__ResultCodec = {
encode(args, output) {

@@ -517,6 +671,6 @@ const obj = {

};
output.writeStructBegin("Preview__Result");
output.writeStructBegin("Comment__Result");
if (obj.success != null) {
output.writeFieldBegin("success", thrift.TType.STRING, 0);
output.writeString(obj.success);
output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
output.writeFieldEnd();

@@ -540,5 +694,5 @@ }

case 0:
if (fieldType === thrift.TType.STRING) {
const value_15 = input.readString();
_args.success = value_15;
if (fieldType === thrift.TType.STRUCT) {
const value_19 = DiscussionResponse.DiscussionResponseCodec.decode(input);
_args.success = value_19;
}

@@ -561,3 +715,3 @@ else {

};
class Preview__Result extends thrift.StructLike {
class Comment__Result extends thrift.StructLike {
constructor(args = {}) {

@@ -568,18 +722,18 @@ super();

if (args.success != null) {
const value_16 = args.success;
this.success = value_16;
const value_20 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
this.success = value_20;
}
}
static read(input) {
return new Preview__Result(exports.Preview__ResultCodec.decode(input));
return new Comment__Result(exports.Comment__ResultCodec.decode(input));
}
static write(args, output) {
return exports.Preview__ResultCodec.encode(args, output);
return exports.Comment__ResultCodec.encode(args, output);
}
write(output) {
return exports.Preview__ResultCodec.encode(this, output);
return exports.Comment__ResultCodec.encode(this, output);
}
}
exports.Preview__Result = Preview__Result;
exports.IsDiscussionEnabled__ResultCodec = {
exports.Comment__Result = Comment__Result;
exports.Reply__ResultCodec = {
encode(args, output) {

@@ -589,6 +743,6 @@ const obj = {

};
output.writeStructBegin("IsDiscussionEnabled__Result");
output.writeStructBegin("Reply__Result");
if (obj.success != null) {
output.writeFieldBegin("success", thrift.TType.BOOL, 0);
output.writeBool(obj.success);
output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
output.writeFieldEnd();

@@ -612,5 +766,5 @@ }

case 0:
if (fieldType === thrift.TType.BOOL) {
const value_17 = input.readBool();
_args.success = value_17;
if (fieldType === thrift.TType.STRUCT) {
const value_21 = DiscussionResponse.DiscussionResponseCodec.decode(input);
_args.success = value_21;
}

@@ -633,3 +787,3 @@ else {

};
class IsDiscussionEnabled__Result extends thrift.StructLike {
class Reply__Result extends thrift.StructLike {
constructor(args = {}) {

@@ -640,17 +794,17 @@ super();

if (args.success != null) {
const value_18 = args.success;
this.success = value_18;
const value_22 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
this.success = value_22;
}
}
static read(input) {
return new IsDiscussionEnabled__Result(exports.IsDiscussionEnabled__ResultCodec.decode(input));
return new Reply__Result(exports.Reply__ResultCodec.decode(input));
}
static write(args, output) {
return exports.IsDiscussionEnabled__ResultCodec.encode(args, output);
return exports.Reply__ResultCodec.encode(args, output);
}
write(output) {
return exports.IsDiscussionEnabled__ResultCodec.encode(this, output);
return exports.Reply__ResultCodec.encode(this, output);
}
}
exports.IsDiscussionEnabled__Result = IsDiscussionEnabled__Result;
exports.Reply__Result = Reply__Result;
exports.Recommend__ResultCodec = {

@@ -663,4 +817,4 @@ encode(args, output) {

if (obj.success != null) {
output.writeFieldBegin("success", thrift.TType.BOOL, 0);
output.writeBool(obj.success);
output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
output.writeFieldEnd();

@@ -684,5 +838,5 @@ }

case 0:
if (fieldType === thrift.TType.BOOL) {
const value_19 = input.readBool();
_args.success = value_19;
if (fieldType === thrift.TType.STRUCT) {
const value_23 = DiscussionResponse.DiscussionResponseCodec.decode(input);
_args.success = value_23;
}

@@ -711,4 +865,4 @@ else {

if (args.success != null) {
const value_20 = args.success;
this.success = value_20;
const value_24 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
this.success = value_24;
}

@@ -727,3 +881,3 @@ }

exports.Recommend__Result = Recommend__Result;
exports.Comment__ResultCodec = {
exports.AddUsername__ResultCodec = {
encode(args, output) {

@@ -733,6 +887,6 @@ const obj = {

};
output.writeStructBegin("Comment__Result");
output.writeStructBegin("AddUsername__Result");
if (obj.success != null) {
output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
CommentResponse.CommentResponseCodec.encode(obj.success, output);
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
output.writeFieldEnd();

@@ -757,4 +911,4 @@ }

if (fieldType === thrift.TType.STRUCT) {
const value_21 = CommentResponse.CommentResponseCodec.decode(input);
_args.success = value_21;
const value_25 = DiscussionResponse.DiscussionResponseCodec.decode(input);
_args.success = value_25;
}

@@ -777,3 +931,3 @@ else {

};
class Comment__Result extends thrift.StructLike {
class AddUsername__Result extends thrift.StructLike {
constructor(args = {}) {

@@ -784,18 +938,18 @@ super();

if (args.success != null) {
const value_22 = new CommentResponse.CommentResponse(args.success);
this.success = value_22;
const value_26 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
this.success = value_26;
}
}
static read(input) {
return new Comment__Result(exports.Comment__ResultCodec.decode(input));
return new AddUsername__Result(exports.AddUsername__ResultCodec.decode(input));
}
static write(args, output) {
return exports.Comment__ResultCodec.encode(args, output);
return exports.AddUsername__ResultCodec.encode(args, output);
}
write(output) {
return exports.Comment__ResultCodec.encode(this, output);
return exports.AddUsername__ResultCodec.encode(this, output);
}
}
exports.Comment__Result = Comment__Result;
exports.Reply__ResultCodec = {
exports.AddUsername__Result = AddUsername__Result;
exports.ReportAbuse__ResultCodec = {
encode(args, output) {

@@ -805,6 +959,6 @@ const obj = {

};
output.writeStructBegin("Reply__Result");
output.writeStructBegin("ReportAbuse__Result");
if (obj.success != null) {
output.writeFieldBegin("success", thrift.TType.STRUCT, 0);
CommentResponse.CommentResponseCodec.encode(obj.success, output);
DiscussionResponse.DiscussionResponseCodec.encode(obj.success, output);
output.writeFieldEnd();

@@ -829,4 +983,4 @@ }

if (fieldType === thrift.TType.STRUCT) {
const value_23 = CommentResponse.CommentResponseCodec.decode(input);
_args.success = value_23;
const value_27 = DiscussionResponse.DiscussionResponseCodec.decode(input);
_args.success = value_27;
}

@@ -849,3 +1003,3 @@ else {

};
class Reply__Result extends thrift.StructLike {
class ReportAbuse__Result extends thrift.StructLike {
constructor(args = {}) {

@@ -856,17 +1010,17 @@ super();

if (args.success != null) {
const value_24 = new CommentResponse.CommentResponse(args.success);
this.success = value_24;
const value_28 = DiscussionResponse.DiscussionResponseCodec.create(args.success);
this.success = value_28;
}
}
static read(input) {
return new Reply__Result(exports.Reply__ResultCodec.decode(input));
return new ReportAbuse__Result(exports.ReportAbuse__ResultCodec.decode(input));
}
static write(args, output) {
return exports.Reply__ResultCodec.encode(args, output);
return exports.ReportAbuse__ResultCodec.encode(args, output);
}
write(output) {
return exports.Reply__ResultCodec.encode(this, output);
return exports.ReportAbuse__ResultCodec.encode(this, output);
}
}
exports.Reply__Result = Reply__Result;
exports.ReportAbuse__Result = ReportAbuse__Result;
class Client extends thrift.ThriftClient {

@@ -881,8 +1035,8 @@ constructor() {

}
preview(body, context) {
getUserProfile(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.writeMessageBegin("getUserProfile", thrift.MessageType.CALL, this.incrementRequestId());
const args = {};
exports.GetUserProfile__ArgsCodec.encode(args, output);
output.writeMessageEnd();

@@ -894,3 +1048,3 @@ return this.connection.send(writer.flush(), context).then((data) => {

const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
if (fieldName === "preview") {
if (fieldName === "getUserProfile") {
if (messageType === thrift.MessageType.EXCEPTION) {

@@ -902,3 +1056,3 @@ const err = thrift.TApplicationExceptionCodec.decode(input);

else {
const result = exports.Preview__ResultCodec.decode(input);
const result = exports.GetUserProfile__ResultCodec.decode(input);
input.readMessageEnd();

@@ -909,3 +1063,3 @@ if (result.success != null) {

else {
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "preview failed: unknown result"));
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getUserProfile failed: unknown result"));
}

@@ -923,8 +1077,8 @@ }

}
isDiscussionEnabled(context) {
comment(shortUrl, body, context) {
const writer = new this.transport();
const output = new this.protocol(writer);
output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.CALL, this.incrementRequestId());
const args = {};
exports.IsDiscussionEnabled__ArgsCodec.encode(args, output);
output.writeMessageBegin("comment", thrift.MessageType.CALL, this.incrementRequestId());
const args = { shortUrl, body };
exports.Comment__ArgsCodec.encode(args, output);
output.writeMessageEnd();

@@ -936,3 +1090,3 @@ return this.connection.send(writer.flush(), context).then((data) => {

const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
if (fieldName === "isDiscussionEnabled") {
if (fieldName === "comment") {
if (messageType === thrift.MessageType.EXCEPTION) {

@@ -944,3 +1098,3 @@ const err = thrift.TApplicationExceptionCodec.decode(input);

else {
const result = exports.IsDiscussionEnabled__ResultCodec.decode(input);
const result = exports.Comment__ResultCodec.decode(input);
input.readMessageEnd();

@@ -951,3 +1105,3 @@ if (result.success != null) {

else {
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isDiscussionEnabled failed: unknown result"));
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "comment failed: unknown result"));
}

@@ -965,2 +1119,40 @@ }

}
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);
}
});
}
recommend(commentId, context) {

@@ -1004,8 +1196,8 @@ const writer = new this.transport();

}
comment(shortUrl, body, context) {
addUsername(username, 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.writeMessageBegin("addUsername", thrift.MessageType.CALL, this.incrementRequestId());
const args = { username };
exports.AddUsername__ArgsCodec.encode(args, output);
output.writeMessageEnd();

@@ -1017,3 +1209,3 @@ return this.connection.send(writer.flush(), context).then((data) => {

const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
if (fieldName === "comment") {
if (fieldName === "addUsername") {
if (messageType === thrift.MessageType.EXCEPTION) {

@@ -1025,3 +1217,3 @@ const err = thrift.TApplicationExceptionCodec.decode(input);

else {
const result = exports.Comment__ResultCodec.decode(input);
const result = exports.AddUsername__ResultCodec.decode(input);
input.readMessageEnd();

@@ -1032,3 +1224,3 @@ if (result.success != null) {

else {
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "comment failed: unknown result"));
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "addUsername failed: unknown result"));
}

@@ -1046,8 +1238,8 @@ }

}
reply(shortUrl, body, parentCommentId, context) {
reportAbuse(parameters, 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.writeMessageBegin("reportAbuse", thrift.MessageType.CALL, this.incrementRequestId());
const args = { parameters };
exports.ReportAbuse__ArgsCodec.encode(args, output);
output.writeMessageEnd();

@@ -1059,3 +1251,3 @@ return this.connection.send(writer.flush(), context).then((data) => {

const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
if (fieldName === "reply") {
if (fieldName === "reportAbuse") {
if (messageType === thrift.MessageType.EXCEPTION) {

@@ -1067,3 +1259,3 @@ const err = thrift.TApplicationExceptionCodec.decode(input);

else {
const result = exports.Reply__ResultCodec.decode(input);
const result = exports.ReportAbuse__ResultCodec.decode(input);
input.readMessageEnd();

@@ -1074,3 +1266,3 @@ if (result.success != null) {

else {
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reply failed: unknown result"));
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "reportAbuse failed: unknown result"));
}

@@ -1110,10 +1302,14 @@ }

switch (methodName) {
case "process_preview": {
resolve(this.process_preview(requestId, input, output, context));
case "process_getUserProfile": {
resolve(this.process_getUserProfile(requestId, input, output, context));
break;
}
case "process_isDiscussionEnabled": {
resolve(this.process_isDiscussionEnabled(requestId, input, output, context));
case "process_comment": {
resolve(this.process_comment(requestId, input, output, context));
break;
}
case "process_reply": {
resolve(this.process_reply(requestId, input, output, context));
break;
}
case "process_recommend": {

@@ -1123,8 +1319,8 @@ resolve(this.process_recommend(requestId, input, output, context));

}
case "process_comment": {
resolve(this.process_comment(requestId, input, output, context));
case "process_addUsername": {
resolve(this.process_addUsername(requestId, input, output, context));
break;
}
case "process_reply": {
resolve(this.process_reply(requestId, input, output, context));
case "process_reportAbuse": {
resolve(this.process_reportAbuse(requestId, input, output, context));
break;

@@ -1146,8 +1342,7 @@ }

}
process_preview(requestId, input, output, context) {
process_getUserProfile(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));
resolve(this._handler.getUserProfile(context));
}

@@ -1159,4 +1354,4 @@ catch (err) {

const result = { success: data };
output.writeMessageBegin("preview", thrift.MessageType.REPLY, requestId);
exports.Preview__ResultCodec.encode(result, output);
output.writeMessageBegin("getUserProfile", thrift.MessageType.REPLY, requestId);
exports.GetUserProfile__ResultCodec.encode(result, output);
output.writeMessageEnd();

@@ -1166,3 +1361,3 @@ return output.flush();

const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("preview", thrift.MessageType.EXCEPTION, requestId);
output.writeMessageBegin("getUserProfile", thrift.MessageType.EXCEPTION, requestId);
thrift.TApplicationExceptionCodec.encode(result, output);

@@ -1173,7 +1368,8 @@ output.writeMessageEnd();

}
process_isDiscussionEnabled(requestId, input, output, context) {
process_comment(requestId, input, output, context) {
return new Promise((resolve, reject) => {
try {
const args = exports.Comment__ArgsCodec.decode(input);
input.readMessageEnd();
resolve(this._handler.isDiscussionEnabled(context));
resolve(this._handler.comment(args.shortUrl, args.body, context));
}

@@ -1185,4 +1381,4 @@ catch (err) {

const result = { success: data };
output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.REPLY, requestId);
exports.IsDiscussionEnabled__ResultCodec.encode(result, output);
output.writeMessageBegin("comment", thrift.MessageType.REPLY, requestId);
exports.Comment__ResultCodec.encode(result, output);
output.writeMessageEnd();

@@ -1192,3 +1388,3 @@ return output.flush();

const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("isDiscussionEnabled", thrift.MessageType.EXCEPTION, requestId);
output.writeMessageBegin("comment", thrift.MessageType.EXCEPTION, requestId);
thrift.TApplicationExceptionCodec.encode(result, output);

@@ -1199,2 +1395,26 @@ output.writeMessageEnd();

}
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_recommend(requestId, input, output, context) {

@@ -1224,8 +1444,8 @@ return new Promise((resolve, reject) => {

}
process_comment(requestId, input, output, context) {
process_addUsername(requestId, input, output, context) {
return new Promise((resolve, reject) => {
try {
const args = exports.Comment__ArgsCodec.decode(input);
const args = exports.AddUsername__ArgsCodec.decode(input);
input.readMessageEnd();
resolve(this._handler.comment(args.shortUrl, args.body, context));
resolve(this._handler.addUsername(args.username, context));
}

@@ -1237,4 +1457,4 @@ catch (err) {

const result = { success: data };
output.writeMessageBegin("comment", thrift.MessageType.REPLY, requestId);
exports.Comment__ResultCodec.encode(result, output);
output.writeMessageBegin("addUsername", thrift.MessageType.REPLY, requestId);
exports.AddUsername__ResultCodec.encode(result, output);
output.writeMessageEnd();

@@ -1244,3 +1464,3 @@ return output.flush();

const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("comment", thrift.MessageType.EXCEPTION, requestId);
output.writeMessageBegin("addUsername", thrift.MessageType.EXCEPTION, requestId);
thrift.TApplicationExceptionCodec.encode(result, output);

@@ -1251,8 +1471,8 @@ output.writeMessageEnd();

}
process_reply(requestId, input, output, context) {
process_reportAbuse(requestId, input, output, context) {
return new Promise((resolve, reject) => {
try {
const args = exports.Reply__ArgsCodec.decode(input);
const args = exports.ReportAbuse__ArgsCodec.decode(input);
input.readMessageEnd();
resolve(this._handler.reply(args.shortUrl, args.body, args.parentCommentId, context));
resolve(this._handler.reportAbuse(args.parameters, context));
}

@@ -1264,4 +1484,4 @@ catch (err) {

const result = { success: data };
output.writeMessageBegin("reply", thrift.MessageType.REPLY, requestId);
exports.Reply__ResultCodec.encode(result, output);
output.writeMessageBegin("reportAbuse", thrift.MessageType.REPLY, requestId);
exports.ReportAbuse__ResultCodec.encode(result, output);
output.writeMessageEnd();

@@ -1271,3 +1491,3 @@ return output.flush();

const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("reply", thrift.MessageType.EXCEPTION, requestId);
output.writeMessageBegin("reportAbuse", thrift.MessageType.EXCEPTION, requestId);
thrift.TApplicationExceptionCodec.encode(result, output);

@@ -1274,0 +1494,0 @@ output.writeMessageEnd();

export * from "./PurchaseScreenReason";
export * from "./DiscussionNativeError";
export * from "./Rect";

@@ -11,4 +12,9 @@ export * from "./AdSlot";

export * from "./MetricFont";
export * from "./CommentResponse";
export * from "./DiscussionBadge";
export * from "./DiscussionUserProfile";
export * from "./DiscussionApiResponse";
export * from "./ReportAbuseParameters";
export * from "./Metric";
export * from "./DiscussionResponse";
export * from "./GetUserProfileResponse";
import * as Environment from "./Environment";

@@ -15,0 +21,0 @@ export { Environment as Environment };

@@ -20,2 +20,3 @@ "use strict";

__export(require("./PurchaseScreenReason"));
__export(require("./DiscussionNativeError"));
__export(require("./Rect"));

@@ -30,4 +31,9 @@ __export(require("./AdSlot"));

__export(require("./MetricFont"));
__export(require("./CommentResponse"));
__export(require("./DiscussionBadge"));
__export(require("./DiscussionUserProfile"));
__export(require("./DiscussionApiResponse"));
__export(require("./ReportAbuseParameters"));
__export(require("./Metric"));
__export(require("./DiscussionResponse"));
__export(require("./GetUserProfileResponse"));
const Environment = __importStar(require("./Environment"));

@@ -34,0 +40,0 @@ exports.Environment = Environment;

{
"name": "@guardian/bridget",
"version": "0.0.0-2024-02-19-SNAPSHOT-2",
"version": "0.0.0-2024-02-19-SNAPSHOT-CE1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc