public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
        oprot.IncrementRecursionDepth();
        try
        {
            var struc = new TStruct("SquareEventSendMessage");
            await oprot.WriteStructBeginAsync(struc, cancellationToken);

            var field = new TField();
            if (SquareChatMid != null && __isset.squareChatMid)
            {
                field.Name = "squareChatMid";
                field.Type = TType.String;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SquareChatMid, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SquareMessage != null && __isset.squareMessage)
            {
                field.Name = "squareMessage";
                field.Type = TType.Struct;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await SquareMessage.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.reqSeq)
            {
                field.Name = "reqSeq";
                field.Type = TType.I32;
                field.ID   = 3;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI32Async(ReqSeq, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            await oprot.WriteFieldStopAsync(cancellationToken);

            await oprot.WriteStructEndAsync(cancellationToken);
        }
        finally
        {
            oprot.DecrementRecursionDepth();
        }
    }
Exemplo n.º 2
0
    public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
        oprot.IncrementRecursionDepth();
        try
        {
            var struc = new TStruct("SquareEventNotificationMessage");
            await oprot.WriteStructBeginAsync(struc, cancellationToken);

            var field = new TField();
            if (SquareChatMid != null && __isset.squareChatMid)
            {
                field.Name = "squareChatMid";
                field.Type = TType.String;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SquareChatMid, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SquareMessage != null && __isset.squareMessage)
            {
                field.Name = "squareMessage";
                field.Type = TType.Struct;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await SquareMessage.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SenderDisplayName != null && __isset.senderDisplayName)
            {
                field.Name = "senderDisplayName";
                field.Type = TType.String;
                field.ID   = 3;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SenderDisplayName, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.unreadCount)
            {
                field.Name = "unreadCount";
                field.Type = TType.I32;
                field.ID   = 4;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI32Async(UnreadCount, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.requiredToFetchChatEvents)
            {
                field.Name = "requiredToFetchChatEvents";
                field.Type = TType.Bool;
                field.ID   = 5;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteBoolAsync(RequiredToFetchChatEvents, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            await oprot.WriteFieldStopAsync(cancellationToken);

            await oprot.WriteStructEndAsync(cancellationToken);
        }
        finally
        {
            oprot.DecrementRecursionDepth();
        }
    }