/ types / generated / events_mono / common / v1 / auth.ts
auth.ts
  1  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
  2  // versions:
  3  //   protoc-gen-ts_proto  v2.6.1
  4  //   protoc               unknown
  5  // source: events_mono/common/v1/auth.proto
  6  
  7  /* eslint-disable */
  8  
  9  /** PublicApiAuth contains authentication context automatically injected by the API */
 10  export interface PublicApiAuth {
 11    account_id?: number | undefined
 12    organization_uuid?: string | undefined
 13    account_uuid?: string | undefined
 14  }
 15  
 16  function createBasePublicApiAuth(): PublicApiAuth {
 17    return { account_id: 0, organization_uuid: '', account_uuid: '' }
 18  }
 19  
 20  export const PublicApiAuth: MessageFns<PublicApiAuth> = {
 21    fromJSON(object: any): PublicApiAuth {
 22      return {
 23        account_id: isSet(object.account_id)
 24          ? globalThis.Number(object.account_id)
 25          : 0,
 26        organization_uuid: isSet(object.organization_uuid)
 27          ? globalThis.String(object.organization_uuid)
 28          : '',
 29        account_uuid: isSet(object.account_uuid)
 30          ? globalThis.String(object.account_uuid)
 31          : '',
 32      }
 33    },
 34  
 35    toJSON(message: PublicApiAuth): unknown {
 36      const obj: any = {}
 37      if (message.account_id !== undefined) {
 38        obj.account_id = Math.round(message.account_id)
 39      }
 40      if (message.organization_uuid !== undefined) {
 41        obj.organization_uuid = message.organization_uuid
 42      }
 43      if (message.account_uuid !== undefined) {
 44        obj.account_uuid = message.account_uuid
 45      }
 46      return obj
 47    },
 48  
 49    create<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
 50      base?: I,
 51    ): PublicApiAuth {
 52      return PublicApiAuth.fromPartial(base ?? ({} as any))
 53    },
 54    fromPartial<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
 55      object: I,
 56    ): PublicApiAuth {
 57      const message = createBasePublicApiAuth()
 58      message.account_id = object.account_id ?? 0
 59      message.organization_uuid = object.organization_uuid ?? ''
 60      message.account_uuid = object.account_uuid ?? ''
 61      return message
 62    },
 63  }
 64  
 65  type Builtin =
 66    | Date
 67    | Function
 68    | Uint8Array
 69    | string
 70    | number
 71    | boolean
 72    | undefined
 73  
 74  type DeepPartial<T> = T extends Builtin
 75    ? T
 76    : T extends globalThis.Array<infer U>
 77      ? globalThis.Array<DeepPartial<U>>
 78      : T extends ReadonlyArray<infer U>
 79        ? ReadonlyArray<DeepPartial<U>>
 80        : T extends {}
 81          ? { [K in keyof T]?: DeepPartial<T[K]> }
 82          : Partial<T>
 83  
 84  type KeysOfUnion<T> = T extends T ? keyof T : never
 85  type Exact<P, I extends P> = P extends Builtin
 86    ? P
 87    : P & { [K in keyof P]: Exact<P[K], I[K]> } & {
 88        [K in Exclude<keyof I, KeysOfUnion<P>>]: never
 89      }
 90  
 91  function isSet(value: any): boolean {
 92    return value !== null && value !== undefined
 93  }
 94  
 95  interface MessageFns<T> {
 96    fromJSON(object: any): T
 97    toJSON(message: T): unknown
 98    create<I extends Exact<DeepPartial<T>, I>>(base?: I): T
 99    fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T
100  }