import * as thrift from "@creditkarma/thrift-server-core" ; export interface IEndpoint { ipv4 ? : number ; port ? : number ; service_name ? : string ; } export interface IEndpointArgs { ipv4 ? : number ; port ? : number ; service_name ? : string ; } export const EndpointCodec = { encode ( args , output ) { const obj = { ipv4 : args . ipv4 , port : args . port , service_name : args . service_name } ; output . writeStructBegin ( "Endpoint" ) ; if ( obj . ipv4 != null ) { output . writeFieldBegin ( "ipv4" , thrift . TType . I32 , 1 ) ; output . writeI32 ( obj . ipv4 ) ; output . writeFieldEnd ( ) ; } if ( obj . port != null ) { output . writeFieldBegin ( "port" , thrift . TType . I16 , 2 ) ; output . writeI16 ( obj . port ) ; output . writeFieldEnd ( ) ; } if ( obj . service_name != null ) { output . writeFieldBegin ( "service_name" , thrift . TType . STRING , 3 ) ; output . writeString ( obj . service_name ) ; 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 1 : if ( fieldType === thrift . TType . I32 ) { const value_1 = input . readI32 ( ) ; _args . ipv4 = value_1 ; } else { input . skip ( fieldType ) ; } break ; case 2 : if ( fieldType === thrift . TType . I16 ) { const value_2 = input . readI16 ( ) ; _args . port = value_2 ; } else { input . skip ( fieldType ) ; } break ; case 3 : if ( fieldType === thrift . TType . STRING ) { const value_3 = input . readString ( ) ; _args . service_name = value_3 ; } else { input . skip ( fieldType ) ; } break ; default : { input . skip ( fieldType ) ; } } input . readFieldEnd ( ) ; } input . readStructEnd ( ) ; return { ipv4 : _args . ipv4 , port : _args . port , service_name : _args . service_name } ; } } ; export class Endpoint extends thrift . StructLike implements IEndpoint { public ipv4 ? : number ; public port ? : number ; public service_name ? : string ; public readonly _annotations : thrift . IThriftAnnotations = { } ; public readonly _fieldAnnotations : thrift . IFieldAnnotations = { } ; constructor ( args = { } ) { super ( ) ; if ( args . ipv4 != null ) { const value_4 = args . ipv4 ; this . ipv4 = value_4 ; } if ( args . port != null ) { const value_5 = args . port ; this . port = value_5 ; } if ( args . service_name != null ) { const value_6 = args . service_name ; this . service_name = value_6 ; } } public static read ( input ) { return new Endpoint ( EndpointCodec . decode ( input ) ) ; } public static write ( args , output ) { return EndpointCodec . encode ( args , output ) ; } public write ( output ) { return EndpointCodec . encode ( this , output ) ; } }