@guardian/bridget
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -23,2 +23,15 @@ /// <reference types="node" /> | ||
} | ||
export interface IIsMyGuardianEnabled__Args { | ||
} | ||
export interface IIsMyGuardianEnabled__ArgsArgs { | ||
} | ||
export declare const IsMyGuardianEnabled__ArgsCodec: thrift.IStructCodec<IIsMyGuardianEnabled__ArgsArgs, IIsMyGuardianEnabled__Args>; | ||
export declare class IsMyGuardianEnabled__Args extends thrift.StructLike implements IIsMyGuardianEnabled__Args { | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IIsMyGuardianEnabled__ArgsArgs); | ||
static read(input: thrift.TProtocol): IsMyGuardianEnabled__Args; | ||
static write(args: IIsMyGuardianEnabled__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface INativeThriftPackageVersion__Result { | ||
@@ -40,2 +53,18 @@ success?: string; | ||
} | ||
export interface IIsMyGuardianEnabled__Result { | ||
success?: boolean; | ||
} | ||
export interface IIsMyGuardianEnabled__ResultArgs { | ||
success?: boolean; | ||
} | ||
export declare const IsMyGuardianEnabled__ResultCodec: thrift.IStructCodec<IIsMyGuardianEnabled__ResultArgs, IIsMyGuardianEnabled__Result>; | ||
export declare class IsMyGuardianEnabled__Result extends thrift.StructLike implements IIsMyGuardianEnabled__Result { | ||
success?: boolean; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IIsMyGuardianEnabled__ResultArgs); | ||
static read(input: thrift.TProtocol): IsMyGuardianEnabled__Result; | ||
static write(args: IIsMyGuardianEnabled__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export declare class Client<Context = any> extends thrift.ThriftClient<Context> { | ||
@@ -54,5 +83,7 @@ static readonly serviceName: string; | ||
nativeThriftPackageVersion(context?: Context): Promise<string>; | ||
isMyGuardianEnabled(context?: Context): Promise<boolean>; | ||
} | ||
export interface IHandler<Context = any> { | ||
nativeThriftPackageVersion(context?: Context): string | Promise<string>; | ||
isMyGuardianEnabled(context?: Context): boolean | Promise<boolean>; | ||
} | ||
@@ -72,2 +103,3 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> { | ||
process_nativeThriftPackageVersion(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_isMyGuardianEnabled(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
} |
@@ -23,7 +23,12 @@ "use strict"; | ||
fieldAnnotations: {} | ||
}, | ||
isMyGuardianEnabled: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
} | ||
}; | ||
exports.methodNames = ["nativeThriftPackageVersion"]; | ||
exports.methodNames = ["nativeThriftPackageVersion", "isMyGuardianEnabled"]; | ||
exports.methodParameters = { | ||
nativeThriftPackageVersion: 1 | ||
nativeThriftPackageVersion: 1, | ||
isMyGuardianEnabled: 1 | ||
}; | ||
@@ -74,2 +79,46 @@ exports.NativeThriftPackageVersion__ArgsCodec = { | ||
exports.NativeThriftPackageVersion__Args = NativeThriftPackageVersion__Args; | ||
exports.IsMyGuardianEnabled__ArgsCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("IsMyGuardianEnabled__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 IsMyGuardianEnabled__Args extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
} | ||
static read(input) { | ||
return new IsMyGuardianEnabled__Args(exports.IsMyGuardianEnabled__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.IsMyGuardianEnabled__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.IsMyGuardianEnabled__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.IsMyGuardianEnabled__Args = IsMyGuardianEnabled__Args; | ||
exports.NativeThriftPackageVersion__ResultCodec = { | ||
@@ -143,2 +192,70 @@ encode(args, output) { | ||
exports.NativeThriftPackageVersion__Result = NativeThriftPackageVersion__Result; | ||
exports.IsMyGuardianEnabled__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("IsMyGuardianEnabled__Result"); | ||
if (obj.success != null) { | ||
output.writeFieldBegin("success", thrift.TType.BOOL, 0); | ||
output.writeBool(obj.success); | ||
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.BOOL) { | ||
const value_3 = input.readBool(); | ||
_args.success = value_3; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class IsMyGuardianEnabled__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_4 = args.success; | ||
this.success = value_4; | ||
} | ||
} | ||
static read(input) { | ||
return new IsMyGuardianEnabled__Result(exports.IsMyGuardianEnabled__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.IsMyGuardianEnabled__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.IsMyGuardianEnabled__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.IsMyGuardianEnabled__Result = IsMyGuardianEnabled__Result; | ||
class Client extends thrift.ThriftClient { | ||
@@ -191,2 +308,40 @@ constructor() { | ||
} | ||
isMyGuardianEnabled(context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("isMyGuardianEnabled", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = {}; | ||
exports.IsMyGuardianEnabled__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 === "isMyGuardianEnabled") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.IsMyGuardianEnabled__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isMyGuardianEnabled 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); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -218,2 +373,6 @@ exports.Client = Client; | ||
} | ||
case "process_isMyGuardianEnabled": { | ||
resolve(this.process_isMyGuardianEnabled(requestId, input, output, context)); | ||
break; | ||
} | ||
default: { | ||
@@ -256,2 +415,25 @@ input.skip(thrift.TType.STRUCT); | ||
} | ||
process_isMyGuardianEnabled(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
input.readMessageEnd(); | ||
resolve(this._handler.isMyGuardianEnabled(context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("isMyGuardianEnabled", thrift.MessageType.REPLY, requestId); | ||
exports.IsMyGuardianEnabled__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("isMyGuardianEnabled", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
} | ||
@@ -258,0 +440,0 @@ exports.Processor = Processor; |
@@ -19,2 +19,4 @@ export * from "./PurchaseScreenReason"; | ||
export { Acquisitions as Acquisitions }; | ||
import * as Tag from "./Tag"; | ||
export { Tag as Tag }; | ||
import * as Notifications from "./Notifications"; | ||
@@ -21,0 +23,0 @@ export { Notifications as Notifications }; |
@@ -37,2 +37,4 @@ "use strict"; | ||
exports.Acquisitions = Acquisitions; | ||
const Tag = __importStar(require("./Tag")); | ||
exports.Tag = Tag; | ||
const Notifications = __importStar(require("./Notifications")); | ||
@@ -39,0 +41,0 @@ exports.Notifications = Notifications; |
{ | ||
"name": "@guardian/bridget", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
428445
54
10949