@guardian/bridget
Advanced tools
Comparing version 1.6.0 to 1.7.0
/// <reference types="node" /> | ||
import * as thrift from "@creditkarma/thrift-server-core"; | ||
import * as FrictionScreenReason from "./FrictionScreenReason"; | ||
import * as MaybeEpic from "./MaybeEpic"; | ||
@@ -12,10 +13,13 @@ export declare const serviceName: string; | ||
export interface ILaunchFrictionScreen__Args { | ||
reason: FrictionScreenReason.FrictionScreenReason; | ||
} | ||
export interface ILaunchFrictionScreen__ArgsArgs { | ||
reason: FrictionScreenReason.FrictionScreenReason; | ||
} | ||
export declare const LaunchFrictionScreen__ArgsCodec: thrift.IStructCodec<ILaunchFrictionScreen__ArgsArgs, ILaunchFrictionScreen__Args>; | ||
export declare class LaunchFrictionScreen__Args extends thrift.StructLike implements ILaunchFrictionScreen__Args { | ||
reason: FrictionScreenReason.FrictionScreenReason; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: ILaunchFrictionScreen__ArgsArgs); | ||
constructor(args: ILaunchFrictionScreen__ArgsArgs); | ||
static read(input: thrift.TProtocol): LaunchFrictionScreen__Args; | ||
@@ -111,3 +115,3 @@ static write(args: ILaunchFrictionScreen__ArgsArgs, output: thrift.TProtocol): void; | ||
}; | ||
launchFrictionScreen(context?: Context): Promise<void>; | ||
launchFrictionScreen(reason: FrictionScreenReason.FrictionScreenReason, context?: Context): Promise<void>; | ||
getEpics(context?: Context): Promise<MaybeEpic.IMaybeEpic>; | ||
@@ -117,3 +121,3 @@ epicSeen(context?: Context): Promise<void>; | ||
export interface IHandler<Context = any> { | ||
launchFrictionScreen(context?: Context): void | Promise<void>; | ||
launchFrictionScreen(reason: FrictionScreenReason.FrictionScreenReason, context?: Context): void | Promise<void>; | ||
getEpics(context?: Context): MaybeEpic.IMaybeEpicArgs | Promise<MaybeEpic.IMaybeEpicArgs>; | ||
@@ -120,0 +124,0 @@ epicSeen(context?: Context): void | Promise<void>; |
@@ -36,3 +36,3 @@ "use strict"; | ||
exports.methodParameters = { | ||
launchFrictionScreen: 1, | ||
launchFrictionScreen: 2, | ||
getEpics: 1, | ||
@@ -43,3 +43,14 @@ epicSeen: 1 | ||
encode(args, output) { | ||
const obj = { | ||
reason: args.reason | ||
}; | ||
output.writeStructBegin("LaunchFrictionScreen__Args"); | ||
if (obj.reason != null) { | ||
output.writeFieldBegin("reason", thrift.TType.I32, 1); | ||
output.writeI32(obj.reason); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[reason] is unset!"); | ||
} | ||
output.writeFieldStop(); | ||
@@ -50,2 +61,3 @@ output.writeStructEnd(); | ||
decode(input) { | ||
let _args = {}; | ||
input.readStructBegin(); | ||
@@ -60,2 +72,11 @@ while (true) { | ||
switch (fieldId) { | ||
case 1: | ||
if (fieldType === thrift.TType.I32) { | ||
const value_1 = input.readI32(); | ||
_args.reason = value_1; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
@@ -68,10 +89,24 @@ input.skip(fieldType); | ||
input.readStructEnd(); | ||
return {}; | ||
if (_args.reason !== undefined) { | ||
return { | ||
reason: _args.reason | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read LaunchFrictionScreen__Args from input"); | ||
} | ||
} | ||
}; | ||
class LaunchFrictionScreen__Args extends thrift.StructLike { | ||
constructor(args = {}) { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.reason != null) { | ||
const value_2 = args.reason; | ||
this.reason = value_2; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[reason] is unset!"); | ||
} | ||
} | ||
@@ -221,4 +256,4 @@ static read(input) { | ||
if (args.success != null) { | ||
const value_1 = undefined; | ||
this.success = value_1; | ||
const value_3 = undefined; | ||
this.success = value_3; | ||
} | ||
@@ -265,4 +300,4 @@ } | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_2 = MaybeEpic.MaybeEpicCodec.decode(input); | ||
_args.success = value_2; | ||
const value_4 = MaybeEpic.MaybeEpicCodec.decode(input); | ||
_args.success = value_4; | ||
} | ||
@@ -291,4 +326,4 @@ else { | ||
if (args.success != null) { | ||
const value_3 = new MaybeEpic.MaybeEpic(args.success); | ||
this.success = value_3; | ||
const value_5 = new MaybeEpic.MaybeEpic(args.success); | ||
this.success = value_5; | ||
} | ||
@@ -351,4 +386,4 @@ } | ||
if (args.success != null) { | ||
const value_4 = undefined; | ||
this.success = value_4; | ||
const value_6 = undefined; | ||
this.success = value_6; | ||
} | ||
@@ -376,7 +411,7 @@ } | ||
} | ||
launchFrictionScreen(context) { | ||
launchFrictionScreen(reason, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("launchFrictionScreen", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = {}; | ||
const args = { reason }; | ||
exports.LaunchFrictionScreen__ArgsCodec.encode(args, output); | ||
@@ -532,4 +567,5 @@ output.writeMessageEnd(); | ||
try { | ||
const args = exports.LaunchFrictionScreen__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.launchFrictionScreen(context)); | ||
resolve(this._handler.launchFrictionScreen(args.reason, context)); | ||
} | ||
@@ -536,0 +572,0 @@ catch (err) { |
@@ -0,1 +1,2 @@ | ||
export * from "./FrictionScreenReason"; | ||
export * from "./Rect"; | ||
@@ -2,0 +3,0 @@ export * from "./AdSlot"; |
@@ -19,2 +19,3 @@ "use strict"; | ||
*/ | ||
__export(require("./FrictionScreenReason")); | ||
__export(require("./Rect")); | ||
@@ -21,0 +22,0 @@ __export(require("./AdSlot")); |
{ | ||
"name": "@guardian/bridget", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
332842
46
8546
49