@guardian/bridget
Advanced tools
Comparing version 0.67.0 to 0.68.0-beta.1
{ | ||
"name": "@guardian/bridget", | ||
"version": "0.67.0", | ||
"version": "0.68.0-beta.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,2 +39,15 @@ /// <reference types="node" /> | ||
} | ||
export interface IDoesCcpaApply__Args { | ||
} | ||
export interface IDoesCcpaApply__ArgsArgs { | ||
} | ||
export declare const DoesCcpaApply__ArgsCodec: thrift.IStructCodec<IDoesCcpaApply__ArgsArgs, IDoesCcpaApply__Args>; | ||
export declare class DoesCcpaApply__Args extends thrift.StructLike implements IDoesCcpaApply__Args { | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IDoesCcpaApply__ArgsArgs); | ||
static read(input: thrift.TProtocol): DoesCcpaApply__Args; | ||
static write(args: IDoesCcpaApply__ArgsArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export interface IIsPremium__Result { | ||
@@ -72,2 +85,18 @@ success?: boolean; | ||
} | ||
export interface IDoesCcpaApply__Result { | ||
success?: boolean; | ||
} | ||
export interface IDoesCcpaApply__ResultArgs { | ||
success?: boolean; | ||
} | ||
export declare const DoesCcpaApply__ResultCodec: thrift.IStructCodec<IDoesCcpaApply__ResultArgs, IDoesCcpaApply__Result>; | ||
export declare class DoesCcpaApply__Result extends thrift.StructLike implements IDoesCcpaApply__Result { | ||
success?: boolean; | ||
readonly _annotations: thrift.IThriftAnnotations; | ||
readonly _fieldAnnotations: thrift.IFieldAnnotations; | ||
constructor(args?: IDoesCcpaApply__ResultArgs); | ||
static read(input: thrift.TProtocol): DoesCcpaApply__Result; | ||
static write(args: IDoesCcpaApply__ResultArgs, output: thrift.TProtocol): void; | ||
write(output: thrift.TProtocol): void; | ||
} | ||
export declare class Client<Context = any> extends thrift.ThriftClient<Context> { | ||
@@ -87,2 +116,3 @@ static readonly serviceName: string; | ||
filterSeenArticles(articleIds: Array<string>, context?: Context): Promise<Array<string>>; | ||
doesCcpaApply(context?: Context): Promise<boolean>; | ||
} | ||
@@ -92,2 +122,3 @@ export interface IHandler<Context = any> { | ||
filterSeenArticles(articleIds: Array<string>, context?: Context): Array<string> | Promise<Array<string>>; | ||
doesCcpaApply(context?: Context): boolean | Promise<boolean>; | ||
} | ||
@@ -108,2 +139,3 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> { | ||
process_filterSeenArticles(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
process_doesCcpaApply(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>; | ||
} |
186
User.js
@@ -27,8 +27,13 @@ "use strict"; | ||
fieldAnnotations: {} | ||
}, | ||
doesCcpaApply: { | ||
annotations: {}, | ||
fieldAnnotations: {} | ||
} | ||
}; | ||
exports.methodNames = ["isPremium", "filterSeenArticles"]; | ||
exports.methodNames = ["isPremium", "filterSeenArticles", "doesCcpaApply"]; | ||
exports.methodParameters = { | ||
isPremium: 1, | ||
filterSeenArticles: 2 | ||
filterSeenArticles: 2, | ||
doesCcpaApply: 1 | ||
}; | ||
@@ -173,2 +178,46 @@ exports.IsPremium__ArgsCodec = { | ||
exports.FilterSeenArticles__Args = FilterSeenArticles__Args; | ||
exports.DoesCcpaApply__ArgsCodec = { | ||
encode(args, output) { | ||
output.writeStructBegin("DoesCcpaApply__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 DoesCcpaApply__Args extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
} | ||
static read(input) { | ||
return new DoesCcpaApply__Args(exports.DoesCcpaApply__ArgsCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.DoesCcpaApply__ArgsCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.DoesCcpaApply__ArgsCodec.encode(this, output); | ||
} | ||
} | ||
exports.DoesCcpaApply__Args = DoesCcpaApply__Args; | ||
exports.IsPremium__ResultCodec = { | ||
@@ -325,2 +374,70 @@ encode(args, output) { | ||
exports.FilterSeenArticles__Result = FilterSeenArticles__Result; | ||
exports.DoesCcpaApply__ResultCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
success: args.success | ||
}; | ||
output.writeStructBegin("DoesCcpaApply__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_15 = input.readBool(); | ||
_args.success = value_15; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
default: { | ||
input.skip(fieldType); | ||
} | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return { | ||
success: _args.success | ||
}; | ||
} | ||
}; | ||
class DoesCcpaApply__Result extends thrift.StructLike { | ||
constructor(args = {}) { | ||
super(); | ||
this._annotations = {}; | ||
this._fieldAnnotations = {}; | ||
if (args.success != null) { | ||
const value_16 = args.success; | ||
this.success = value_16; | ||
} | ||
} | ||
static read(input) { | ||
return new DoesCcpaApply__Result(exports.DoesCcpaApply__ResultCodec.decode(input)); | ||
} | ||
static write(args, output) { | ||
return exports.DoesCcpaApply__ResultCodec.encode(args, output); | ||
} | ||
write(output) { | ||
return exports.DoesCcpaApply__ResultCodec.encode(this, output); | ||
} | ||
} | ||
exports.DoesCcpaApply__Result = DoesCcpaApply__Result; | ||
class Client extends thrift.ThriftClient { | ||
@@ -411,2 +528,40 @@ constructor() { | ||
} | ||
doesCcpaApply(context) { | ||
const writer = new this.transport(); | ||
const output = new this.protocol(writer); | ||
output.writeMessageBegin("doesCcpaApply", thrift.MessageType.CALL, this.incrementRequestId()); | ||
const args = {}; | ||
exports.DoesCcpaApply__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 === "doesCcpaApply") { | ||
if (messageType === thrift.MessageType.EXCEPTION) { | ||
const err = thrift.TApplicationExceptionCodec.decode(input); | ||
input.readMessageEnd(); | ||
return Promise.reject(err); | ||
} | ||
else { | ||
const result = exports.DoesCcpaApply__ResultCodec.decode(input); | ||
input.readMessageEnd(); | ||
if (result.success != null) { | ||
return Promise.resolve(result.success); | ||
} | ||
else { | ||
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "doesCcpaApply 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); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -442,2 +597,6 @@ exports.Client = Client; | ||
} | ||
case "process_doesCcpaApply": { | ||
resolve(this.process_doesCcpaApply(requestId, input, output, context)); | ||
break; | ||
} | ||
default: { | ||
@@ -504,2 +663,25 @@ input.skip(thrift.TType.STRUCT); | ||
} | ||
process_doesCcpaApply(requestId, input, output, context) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
input.readMessageEnd(); | ||
resolve(this._handler.doesCcpaApply(context)); | ||
} | ||
catch (err) { | ||
reject(err); | ||
} | ||
}).then((data) => { | ||
const result = { success: data }; | ||
output.writeMessageBegin("doesCcpaApply", thrift.MessageType.REPLY, requestId); | ||
exports.DoesCcpaApply__ResultCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}).catch((err) => { | ||
const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("doesCcpaApply", thrift.MessageType.EXCEPTION, requestId); | ||
thrift.TApplicationExceptionCodec.encode(result, output); | ||
output.writeMessageEnd(); | ||
return output.flush(); | ||
}); | ||
} | ||
} | ||
@@ -506,0 +688,0 @@ exports.Processor = Processor; |
259430
6648