Skip to content

Commit

Permalink
Change client to return instances of our classes.
Browse files Browse the repository at this point in the history
I'm merging this change into the all_states_title_changes branch. For the full PR description see [the PR for merging this change into Credit Karma's master branch](creditkarma#185).
  • Loading branch information
markdoliner-doma committed Aug 28, 2020
1 parent af56936 commit dde449f
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 55 deletions.
10 changes: 5 additions & 5 deletions src/main/render/thrift-server/service/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
import { Resolver } from '../../../resolver'
import { createBufferType, createPromiseType } from '../../shared/types'
import { createClassConstructor } from '../../shared/utils'
import { looseName, strictName, toolkitName } from '../struct/utils'
import { className, looseName, toolkitName } from '../struct/utils'

function extendsAbstract(): ts.HeritageClause {
return ts.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [
Expand Down Expand Up @@ -515,7 +515,7 @@ function createConnectionSend(): ts.CallExpression {
)
}

// const result: GetUserResult = GetUserResultCodec.decode(input);
// const result: GetUser__Result = GetUser__Result.read(input);
function createNewResultInstance(
def: FunctionDefinition,
state: IRenderState,
Expand All @@ -525,16 +525,16 @@ function createNewResultInstance(
COMMON_IDENTIFIERS.result,
ts.createTypeReferenceNode(
ts.createIdentifier(
strictName(createStructResultName(def), def.type, state),
className(createStructResultName(def), state),
),
undefined,
),
ts.createCall(
ts.createPropertyAccess(
ts.createIdentifier(
toolkitName(createStructResultName(def), state),
className(createStructResultName(def), state),
),
COMMON_IDENTIFIERS.decode,
COMMON_IDENTIFIERS.read,
),
undefined,
[COMMON_IDENTIFIERS.input],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IGetUser__Result = GetUser__ResultCodec.decode(input);
const result: GetUser__Result = GetUser__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -660,7 +660,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: ISaveUser__Result = SaveUser__ResultCodec.decode(input);
const result: SaveUser__Result = SaveUser__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down Expand Up @@ -693,7 +693,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IPing__Result = Ping__ResultCodec.decode(input);
const result: Ping__Result = Ping__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IGetUser__Result = GetUser__ResultCodec.decode(input);
const result: GetUser__Result = GetUser__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -648,7 +648,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: ISaveUser__Result = SaveUser__ResultCodec.decode(input);
const result: SaveUser__Result = SaveUser__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down Expand Up @@ -681,7 +681,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IPing__Result = Ping__ResultCodec.decode(input);
const result: Ping__Result = Ping__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IGetUser__Result = GetUser__ResultCodec.decode(input);
const result: GetUser__Result = GetUser__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -531,7 +531,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IPing__Result = Ping__ResultCodec.decode(input);
const result: Ping__Result = Ping__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Client<Context = any> extends SharedServiceBase.Client<Context> {
return Promise.reject(err);
}
else {
const result: IGetUnion__Result = GetUnion__ResultCodec.decode(input);
const result: GetUnion__Result = GetUnion__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -397,7 +397,7 @@ export class Client<Context = any> extends SharedServiceBase.Client<Context> {
return Promise.reject(err);
}
else {
const result: IGetEnum__Result = GetEnum__ResultCodec.decode(input);
const result: GetEnum__Result = GetEnum__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IGetStruct__Result = GetStruct__ResultCodec.decode(input);
const result: GetStruct__Result = GetStruct__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2758,7 +2758,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IPing__Result = Ping__ResultCodec.decode(input);
const result: Ping__Result = Ping__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down Expand Up @@ -2791,7 +2791,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IAdd__Result = Add__ResultCodec.decode(input);
const result: Add__Result = Add__Result.read(input);
input.readMessageEnd();
if (result.exp != null) {
return Promise.reject(result.exp);
Expand Down Expand Up @@ -2832,7 +2832,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IAddInt64__Result = AddInt64__ResultCodec.decode(input);
const result: AddInt64__Result = AddInt64__Result.read(input);
input.readMessageEnd();
if (result.exp != null) {
return Promise.reject(result.exp);
Expand Down Expand Up @@ -2873,7 +2873,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IAddWithContext__Result = AddWithContext__ResultCodec.decode(input);
const result: AddWithContext__Result = AddWithContext__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -2911,7 +2911,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: ICalculate__Result = Calculate__ResultCodec.decode(input);
const result: Calculate__Result = Calculate__Result.read(input);
input.readMessageEnd();
if (result.ouch != null) {
return Promise.reject(result.ouch);
Expand Down Expand Up @@ -2952,7 +2952,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IEchoBinary__Result = EchoBinary__ResultCodec.decode(input);
const result: EchoBinary__Result = EchoBinary__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -2990,7 +2990,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IEchoString__Result = EchoString__ResultCodec.decode(input);
const result: EchoString__Result = EchoString__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3028,7 +3028,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: ICheckName__Result = CheckName__ResultCodec.decode(input);
const result: CheckName__Result = CheckName__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3066,7 +3066,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: ICheckOptional__Result = CheckOptional__ResultCodec.decode(input);
const result: CheckOptional__Result = CheckOptional__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3104,7 +3104,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IMapOneList__Result = MapOneList__ResultCodec.decode(input);
const result: MapOneList__Result = MapOneList__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3142,7 +3142,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IMapValues__Result = MapValues__ResultCodec.decode(input);
const result: MapValues__Result = MapValues__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3180,7 +3180,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IListToMap__Result = ListToMap__ResultCodec.decode(input);
const result: ListToMap__Result = ListToMap__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3218,7 +3218,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IFetchThing__Result = FetchThing__ResultCodec.decode(input);
const result: FetchThing__Result = FetchThing__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3256,7 +3256,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IFetchMap__Result = FetchMap__ResultCodec.decode(input);
const result: FetchMap__Result = FetchMap__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -3294,7 +3294,7 @@ export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Clie
return Promise.reject(err);
}
else {
const result: IZip__Result = Zip__ResultCodec.decode(input);
const result: Zip__Result = Zip__Result.read(input);
input.readMessageEnd();
return Promise.resolve(result.success);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Client<Context = any> extends SharedServiceBase.Client<Context> {
return Promise.reject(err);
}
else {
const result: IGetUnion__Result = GetUnion__ResultCodec.decode(input);
const result: GetUnion__Result = GetUnion__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down Expand Up @@ -397,7 +397,7 @@ export class Client<Context = any> extends SharedServiceBase.Client<Context> {
return Promise.reject(err);
}
else {
const result: IGetEnum__Result = GetEnum__ResultCodec.decode(input);
const result: GetEnum__Result = GetEnum__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class Client<Context = any> extends thrift.ThriftClient<Context> {
return Promise.reject(err);
}
else {
const result: IGetStruct__Result = GetStruct__ResultCodec.decode(input);
const result: GetStruct__Result = GetStruct__Result.read(input);
input.readMessageEnd();
if (result.success != null) {
return Promise.resolve(result.success);
Expand Down
Loading

0 comments on commit dde449f

Please sign in to comment.