@guardian/bridget
Advanced tools
Comparing version 6.0.0 to 7.0.0
@@ -0,1 +1,2 @@ | ||
export * from "./MediaEvent"; | ||
export * from "./PurchaseScreenReason"; | ||
@@ -14,2 +15,3 @@ export * from "./SignInScreenReason"; | ||
export * from "./MetricFont"; | ||
export * from "./VideoEvent"; | ||
export * from "./Metric"; | ||
@@ -16,0 +18,0 @@ export * from "./DiscussionServiceResponse"; |
@@ -36,2 +36,3 @@ "use strict"; | ||
*/ | ||
__exportStar(require("./MediaEvent"), exports); | ||
__exportStar(require("./PurchaseScreenReason"), exports); | ||
@@ -50,2 +51,3 @@ __exportStar(require("./SignInScreenReason"), exports); | ||
__exportStar(require("./MetricFont"), exports); | ||
__exportStar(require("./VideoEvent"), exports); | ||
__exportStar(require("./Metric"), exports); | ||
@@ -52,0 +54,0 @@ __exportStar(require("./DiscussionServiceResponse"), exports); |
{ | ||
"name": "@guardian/bridget", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,3 @@ /// <reference types="node" /> | ||
import * as VideoSlot from "./VideoSlot"; | ||
import * as VideoEvent from "./VideoEvent"; | ||
export declare const serviceName: string; | ||
@@ -45,2 +46,31 @@ export declare const annotations: thrift.IThriftAnnotations; | ||
} | ||
export interface ISendVideoEvent__Args { | ||
videoEvent: VideoEvent.IVideoEvent; | ||
} | ||
export interface ISendVideoEvent__ArgsArgs { | ||
videoEvent: VideoEvent.IVideoEventArgs; | ||
} | ||
export declare const SendVideoEvent__ArgsCodec: thrift.IStructCodec<ISendVideoEvent__ArgsArgs, ISendVideoEvent__Args>; | ||
export declare class SendVideoEvent__Args extends thrift.StructLike implements ISendVideoEvent__Args { | ||
videoEvent: VideoEvent.IVideoEvent; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args: ISendVideoEvent__ArgsArgs); | ||
static read(input: thrift.TProtocol): SendVideoEvent__Args; | ||
static write(args: ISendVideoEvent__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IFullscreen__Args { | ||
} | ||
export interface IFullscreen__ArgsArgs { | ||
} | ||
export declare const Fullscreen__ArgsCodec: thrift.IStructCodec<IFullscreen__ArgsArgs, IFullscreen__Args>; | ||
export declare class Fullscreen__Args extends thrift.StructLike implements IFullscreen__Args { | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IFullscreen__ArgsArgs); | ||
static read(input: thrift.TProtocol): Fullscreen__Args; | ||
static write(args: IFullscreen__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IInsertVideos__Result { | ||
@@ -78,2 +108,34 @@ success?: void; | ||
} | ||
export interface ISendVideoEvent__Result { | ||
success?: void; | ||
} | ||
export interface ISendVideoEvent__ResultArgs { | ||
success?: void; | ||
} | ||
export declare const SendVideoEvent__ResultCodec: thrift.IStructCodec<ISendVideoEvent__ResultArgs, ISendVideoEvent__Result>; | ||
export declare class SendVideoEvent__Result extends thrift.StructLike implements ISendVideoEvent__Result { | ||
success?: void; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: ISendVideoEvent__ResultArgs); | ||
static read(input: thrift.TProtocol): SendVideoEvent__Result; | ||
static write(args: ISendVideoEvent__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IFullscreen__Result { | ||
success?: void; | ||
} | ||
export interface IFullscreen__ResultArgs { | ||
success?: void; | ||
} | ||
export declare const Fullscreen__ResultCodec: thrift.IStructCodec<IFullscreen__ResultArgs, IFullscreen__Result>; | ||
export declare class Fullscreen__Result extends thrift.StructLike implements IFullscreen__Result { | ||
success?: void; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IFullscreen__ResultArgs); | ||
static read(input: thrift.TProtocol): Fullscreen__Result; | ||
static write(args: IFullscreen__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export declare class Client<Context = any> extends thrift.ThriftClient<Context> { | ||
@@ -93,2 +155,4 @@ static readonly serviceName: string; | ||
updateVideos(videoSlots: Array<VideoSlot.IVideoSlotArgs>, context?: Context): Promise<void>; | ||
sendVideoEvent(videoEvent: VideoEvent.IVideoEventArgs, context?: Context): Promise<void>; | ||
fullscreen(context?: Context): Promise<void>; | ||
} | ||
@@ -98,2 +162,4 @@ export interface IHandler<Context = any> { | ||
updateVideos(videoSlots: Array<VideoSlot.IVideoSlot>, context?: Context): void | Promise<void>; | ||
sendVideoEvent(videoEvent: VideoEvent.IVideoEvent, context?: Context): void | Promise<void>; | ||
fullscreen(context?: Context): void | Promise<void>; | ||
} | ||
@@ -114,2 +180,4 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> { | ||
process_updateVideos(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_sendVideoEvent(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_fullscreen(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
} |
387
Videos.js
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Processor = exports.Client = exports.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0; | ||
exports.Processor = exports.Client = exports.Fullscreen__Result = exports.Fullscreen__ResultCodec = exports.SendVideoEvent__Result = exports.SendVideoEvent__ResultCodec = exports.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.Fullscreen__Args = exports.Fullscreen__ArgsCodec = exports.SendVideoEvent__Args = exports.SendVideoEvent__ArgsCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0; | ||
/* tslint:disable */ | ||
@@ -36,2 +36,3 @@ /* eslint-disable */ | ||
const VideoSlot = __importStar(require("./VideoSlot")); | ||
const VideoEvent = __importStar(require("./VideoEvent")); | ||
exports.serviceName = "Videos"; | ||
@@ -47,8 +48,18 @@ exports.annotations = {}; | ||
fieldAnnotations: {} | ||
}, | ||
sendVideoEvent: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
}, | ||
fullscreen: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
} | ||
}; | ||
exports.methodNames = ["insertVideos", "updateVideos"]; | ||
exports.methodNames = ["insertVideos", "updateVideos", "sendVideoEvent", "fullscreen"]; | ||
exports.methodParameters = { | ||
insertVideos: 2, | ||
updateVideos: 2 | ||
updateVideos: 2, | ||
sendVideoEvent: 2, | ||
fullscreen: 1 | ||
}; | ||
@@ -243,2 +254,125 @@ exports.InsertVideos__ArgsCodec = { | ||
exports.UpdateVideos__Args = UpdateVideos__Args; | ||
exports.SendVideoEvent__ArgsCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
videoEvent: args.videoEvent | ||
}; | ||
output.writeStructBegin("SendVideoEvent__Args"); | ||
if (obj.videoEvent != null) { | ||
output.writeFieldBegin("videoEvent", thrift.TType.STRUCT, 1); | ||
VideoEvent.VideoEventCodec.encode(obj.videoEvent, output); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[videoEvent] 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_13 = VideoEvent.VideoEventCodec.decode(input); | ||
_args.videoEvent = value_13; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
if (_args.videoEvent !== undefined) { | ||
return { | ||
videoEvent: _args.videoEvent | ||
}; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read SendVideoEvent__Args from input"); | ||
} | ||
} | ||
}; | ||
class SendVideoEvent__Args extends thrift.StructLike { | ||
constructor(args) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.videoEvent != null) { | ||
const value_14 = new VideoEvent.VideoEvent(args.videoEvent); | ||
this.videoEvent = value_14; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[videoEvent] is unset!"); | ||
} | ||
} | ||
static read(input) { | ||
return new SendVideoEvent__Args(exports.SendVideoEvent__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.SendVideoEvent__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.SendVideoEvent__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.SendVideoEvent__Args = SendVideoEvent__Args; | ||
exports.Fullscreen__ArgsCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("Fullscreen__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 Fullscreen__Args extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
} | ||
static read(input) { | ||
return new Fullscreen__Args(exports.Fullscreen__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Fullscreen__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Fullscreen__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.Fullscreen__Args = Fullscreen__Args; | ||
exports.InsertVideos__ResultCodec = { | ||
@@ -288,4 +422,4 @@ encode(args, output) { | ||
if (args.success != null) { | ||
const value_13 = undefined; | ||
this.success = value_13; | ||
const value_15 = undefined; | ||
this.success = value_15; | ||
} | ||
@@ -348,4 +482,4 @@ } | ||
if (args.success != null) { | ||
const value_14 = undefined; | ||
this.success = value_14; | ||
const value_16 = undefined; | ||
this.success = value_16; | ||
} | ||
@@ -364,2 +498,120 @@ } | ||
exports.UpdateVideos__Result = UpdateVideos__Result; | ||
exports.SendVideoEvent__ResultCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("SendVideoEvent__Result"); | ||
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.VOID) { | ||
input.skip(fieldType); | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class SendVideoEvent__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_17 = undefined; | ||
this.success = value_17; | ||
} | ||
} | ||
static read(input) { | ||
return new SendVideoEvent__Result(exports.SendVideoEvent__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.SendVideoEvent__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.SendVideoEvent__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.SendVideoEvent__Result = SendVideoEvent__Result; | ||
exports.Fullscreen__ResultCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("Fullscreen__Result"); | ||
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.VOID) { | ||
input.skip(fieldType); | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class Fullscreen__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_18 = undefined; | ||
this.success = value_18; | ||
} | ||
} | ||
static read(input) { | ||
return new Fullscreen__Result(exports.Fullscreen__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.Fullscreen__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.Fullscreen__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.Fullscreen__Result = Fullscreen__Result; | ||
class Client extends thrift.ThriftClient { | ||
@@ -440,2 +692,68 @@ constructor() { | ||
} | ||
sendVideoEvent(videoEvent, context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("sendVideoEvent", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = { videoEvent }; | ||
exports.SendVideoEvent__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 === "sendVideoEvent") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.SendVideoEvent__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.resolve(result.success); | ||
} | ||
} | ||
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); | ||
} | ||
}); | ||
} | ||
fullscreen(context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("fullscreen", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = {}; | ||
exports.Fullscreen__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 === "fullscreen") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.Fullscreen__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.resolve(result.success); | ||
} | ||
} | ||
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); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -471,2 +789,10 @@ exports.Client = Client; | ||
} | ||
case "process_sendVideoEvent": { | ||
resolve(this.process_sendVideoEvent(requestId, input, output, context)); | ||
break; | ||
} | ||
case "process_fullscreen": { | ||
resolve(this.process_fullscreen(requestId, input, output, context)); | ||
break; | ||
} | ||
default: { | ||
@@ -534,2 +860,49 @@ input.skip(thrift.TType.STRUCT); | ||
} | ||
process_sendVideoEvent(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const args = exports.SendVideoEvent__ArgsCodec.decode(input); | ||
input.readMessageEnd(); | ||
resolve(this._handler.sendVideoEvent(args.videoEvent, context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("sendVideoEvent", thrift.MessageType.REPLY, requestId); | ||
exports.SendVideoEvent__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("sendVideoEvent", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
process_fullscreen(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
input.readMessageEnd(); | ||
resolve(this._handler.fullscreen(context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("fullscreen", thrift.MessageType.REPLY, requestId); | ||
exports.Fullscreen__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("fullscreen", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
} | ||
@@ -536,0 +909,0 @@ exports.Processor = Processor; |
499341
64
12380