Skip to content

Commit

Permalink
php rpc methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Brat-vseznamus committed Dec 23, 2024
1 parent 81aa4e2 commit 008c5d6
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 189 deletions.
1 change: 1 addition & 0 deletions internal/tlcodegen/tlgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ func GenerateCode(tl tlast.TL, options Gen2Options) (*Gen2, error) {
phpRemoveTemplateFromGeneric(typ, &rpcFunctionResultTypeRef, &rpcFunctionResultTypeRef)
}
}
// TODO DELETE AS NORMAL PEOPLE
var removedTypesIndecies []int
for i, typ := range tl {
if rpcRemovedTypes[typ.Construct.Name.String()] {
Expand Down
25 changes: 13 additions & 12 deletions internal/tlcodegen/tlgen_php.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package tlcodegen
import (
"fmt"
"path/filepath"
"reflect"
"strings"
)

Expand Down Expand Up @@ -34,9 +33,6 @@ func (gen *Gen2) generateCodePHP(generateByteVersions []string) error {
createdTypes := make(map[string]bool)

for _, wrapper := range gen.generatedTypesList {
if wrapper.tlName.String() == "rpcResponseOk" {
print(wrapper.trw.PhpClassName(true, true))
}
if createdTypes[wrapper.trw.PhpClassName(true, true)] {
continue
}
Expand Down Expand Up @@ -78,14 +74,6 @@ func phpGenerateCodeForWrapper(gen *Gen2, wrapper *TypeRWWrapper, createdTypes m
}
}

fmt.Printf("TL[%[1]s] = Go {%[2]s, %[4]s} -> PHP {%[3]s, %[5]s}\n",
wrapper.tlName.String(),
wrapper.goGlobalName,
wrapper.trw.PhpClassName(true, true),
reflect.TypeOf(wrapper.trw),
wrapper.trw.PhpTypeName(true, true),
)

filepathParts := []string{"VK"}
//filepathParts = append(filepathParts, wrapper.PHPTypePathElements()...)
path := fmt.Sprintf("%s.php", wrapper.trw.PhpClassName(true, createInterfaceIfNeeded))
Expand Down Expand Up @@ -155,3 +143,16 @@ func PHPGetAllReachableTypes(startTypes []*TypeRWWrapper) map[*TypeRWWrapper]boo
}
return reachable
}

func PHPSpecialMembersTypes(wrapper *TypeRWWrapper) string {
if wrapper.tlName.String() == PHPRPCFunctionMock {
return "TL\\RpcFunction"
}
if wrapper.tlName.String() == PHPRPCFunctionResultMock {
return "TL\\RpcFunctionReturnResult"
}
if wrapper.tlName.String() == PHPRPCResponseMock {
return "TL\\RpcResponse"
}
return ""
}
Loading

0 comments on commit 008c5d6

Please sign in to comment.