Skip to content

Commit

Permalink
feat(get-page-source): add get-page-source api
Browse files Browse the repository at this point in the history
  • Loading branch information
oneofthezombies committed Jun 15, 2023
1 parent 6cf1a45 commit 399d7aa
Show file tree
Hide file tree
Showing 126 changed files with 1,483 additions and 644 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class GetPageSourceParam(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = GetPageSourceParam()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsGetPageSourceParam(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
# GetPageSourceParam
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

def GetPageSourceParamStart(builder): builder.StartObject(0)
def Start(builder):
return GetPageSourceParamStart(builder)
def GetPageSourceParamEnd(builder): return builder.EndObject()
def End(builder):
return GetPageSourceParamEnd(builder)

class GetPageSourceParamT(object):

# GetPageSourceParamT
def __init__(self):
pass

@classmethod
def InitFromBuf(cls, buf, pos):
getPageSourceParam = GetPageSourceParam()
getPageSourceParam.Init(buf, pos)
return cls.InitFromObj(getPageSourceParam)

@classmethod
def InitFromPackedBuf(cls, buf, pos=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
return cls.InitFromBuf(buf, pos+n)

@classmethod
def InitFromObj(cls, getPageSourceParam):
x = GetPageSourceParamT()
x._UnPack(getPageSourceParam)
return x

# GetPageSourceParamT
def _UnPack(self, getPageSourceParam):
if getPageSourceParam is None:
return

# GetPageSourceParamT
def Pack(self, builder):
GetPageSourceParamStart(builder)
getPageSourceParam = GetPageSourceParamEnd(builder)
return getPageSourceParam
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class GetPageSourceResult(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = GetPageSourceResult()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsGetPageSourceResult(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
# GetPageSourceResult
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

# GetPageSourceResult
def PageSource(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.String(o + self._tab.Pos)
return None

def GetPageSourceResultStart(builder): builder.StartObject(1)
def Start(builder):
return GetPageSourceResultStart(builder)
def GetPageSourceResultAddPageSource(builder, pageSource): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pageSource), 0)
def AddPageSource(builder, pageSource):
return GetPageSourceResultAddPageSource(builder, pageSource)
def GetPageSourceResultEnd(builder): return builder.EndObject()
def End(builder):
return GetPageSourceResultEnd(builder)

class GetPageSourceResultT(object):

# GetPageSourceResultT
def __init__(self):
self.pageSource = None # type: str

@classmethod
def InitFromBuf(cls, buf, pos):
getPageSourceResult = GetPageSourceResult()
getPageSourceResult.Init(buf, pos)
return cls.InitFromObj(getPageSourceResult)

@classmethod
def InitFromPackedBuf(cls, buf, pos=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
return cls.InitFromBuf(buf, pos+n)

@classmethod
def InitFromObj(cls, getPageSourceResult):
x = GetPageSourceResultT()
x._UnPack(getPageSourceResult)
return x

# GetPageSourceResultT
def _UnPack(self, getPageSourceResult):
if getPageSourceResult is None:
return
self.pageSource = getPageSourceResult.PageSource()

# GetPageSourceResultT
def Pack(self, builder):
if self.pageSource is not None:
pageSource = builder.CreateString(self.pageSource)
GetPageSourceResultStart(builder)
if self.pageSource is not None:
GetPageSourceResultAddPageSource(builder, pageSource)
getPageSourceResult = GetPageSourceResultEnd(builder)
return getPageSourceResult
4 changes: 4 additions & 0 deletions client/python/gamium/gamium/Protocol/generated/Param.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Param(object):
Packets_DumpObjectsHierarchyParam = 9
Packets_ChangeConfigurationParam = 10
Packets_QueryProfileParam = 11
Packets_GetPageSourceParam = 12

def ParamCreator(unionType, table):
from flatbuffers.table import Table
Expand Down Expand Up @@ -53,4 +54,7 @@ def ParamCreator(unionType, table):
if unionType == Param().Packets_QueryProfileParam:
import gamium.protocol.generated.Packets.QueryProfileParam
return gamium.protocol.generated.Packets.QueryProfileParam.QueryProfileParamT.InitFromBuf(table.Bytes, table.Pos)
if unionType == Param().Packets_GetPageSourceParam:
import gamium.protocol.generated.Packets.GetPageSourceParam
return gamium.protocol.generated.Packets.GetPageSourceParam.GetPageSourceParamT.InitFromBuf(table.Bytes, table.Pos)
return None
3 changes: 2 additions & 1 deletion client/python/gamium/gamium/Protocol/generated/Request.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def End(builder):
import gamium.protocol.generated.Packets.DumpObjectsHierarchyParam
import gamium.protocol.generated.Packets.ExecuteRpcParam
import gamium.protocol.generated.Packets.FindObjectsParam
import gamium.protocol.generated.Packets.GetPageSourceParam
import gamium.protocol.generated.Packets.HelloParam
import gamium.protocol.generated.Packets.InspectObjectOnScreenParam
import gamium.protocol.generated.Packets.InspectObjectWithIdParam
Expand All @@ -86,7 +87,7 @@ class RequestT(object):
def __init__(self):
self.seq = 0 # type: int
self.paramType = 0 # type: int
self.param = None # type: Union[None, gamium.protocol.generated.Packets.HelloParam.HelloParamT, gamium.protocol.generated.Packets.QueryScreenParam.QueryScreenParamT, gamium.protocol.generated.Packets.FindObjectsParam.FindObjectsParamT, gamium.protocol.generated.Packets.QueryObjectInteractableParam.QueryObjectInteractableParamT, gamium.protocol.generated.Packets.ActionsParam.ActionsParamT, gamium.protocol.generated.Packets.ExecuteRpcParam.ExecuteRpcParamT, gamium.protocol.generated.Packets.InspectObjectOnScreenParam.InspectObjectOnScreenParamT, gamium.protocol.generated.Packets.InspectObjectWithIdParam.InspectObjectWithIdParamT, gamium.protocol.generated.Packets.DumpObjectsHierarchyParam.DumpObjectsHierarchyParamT, gamium.protocol.generated.Packets.ChangeConfigurationParam.ChangeConfigurationParamT, gamium.protocol.generated.Packets.QueryProfileParam.QueryProfileParamT]
self.param = None # type: Union[None, gamium.protocol.generated.Packets.HelloParam.HelloParamT, gamium.protocol.generated.Packets.QueryScreenParam.QueryScreenParamT, gamium.protocol.generated.Packets.FindObjectsParam.FindObjectsParamT, gamium.protocol.generated.Packets.QueryObjectInteractableParam.QueryObjectInteractableParamT, gamium.protocol.generated.Packets.ActionsParam.ActionsParamT, gamium.protocol.generated.Packets.ExecuteRpcParam.ExecuteRpcParamT, gamium.protocol.generated.Packets.InspectObjectOnScreenParam.InspectObjectOnScreenParamT, gamium.protocol.generated.Packets.InspectObjectWithIdParam.InspectObjectWithIdParamT, gamium.protocol.generated.Packets.DumpObjectsHierarchyParam.DumpObjectsHierarchyParamT, gamium.protocol.generated.Packets.ChangeConfigurationParam.ChangeConfigurationParamT, gamium.protocol.generated.Packets.QueryProfileParam.QueryProfileParamT, gamium.protocol.generated.Packets.GetPageSourceParam.GetPageSourceParamT]

@classmethod
def InitFromBuf(cls, buf, pos):
Expand Down
3 changes: 2 additions & 1 deletion client/python/gamium/gamium/Protocol/generated/Response.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def End(builder):
import gamium.protocol.generated.Packets.DumpObjectsHierarchyResult
import gamium.protocol.generated.Packets.ExecuteRpcResult
import gamium.protocol.generated.Packets.FindObjectsResult
import gamium.protocol.generated.Packets.GetPageSourceResult
import gamium.protocol.generated.Packets.HelloResult
import gamium.protocol.generated.Packets.InspectObjectOnScreenResult
import gamium.protocol.generated.Packets.InspectObjectWithIdResult
Expand All @@ -102,7 +103,7 @@ def __init__(self):
self.seq = 0 # type: int
self.error = None # type: Optional[gamium.protocol.generated.Types.ErrorResult.ErrorResultT]
self.resultType = 0 # type: int
self.result = None # type: Union[None, gamium.protocol.generated.Packets.HelloResult.HelloResultT, gamium.protocol.generated.Packets.QueryScreenResult.QueryScreenResultT, gamium.protocol.generated.Packets.FindObjectsResult.FindObjectsResultT, gamium.protocol.generated.Packets.QueryObjectInteractableResult.QueryObjectInteractableResultT, gamium.protocol.generated.Packets.ActionsResult.ActionsResultT, gamium.protocol.generated.Packets.ExecuteRpcResult.ExecuteRpcResultT, gamium.protocol.generated.Packets.InspectObjectOnScreenResult.InspectObjectOnScreenResultT, gamium.protocol.generated.Packets.InspectObjectWithIdResult.InspectObjectWithIdResultT, gamium.protocol.generated.Packets.DumpObjectsHierarchyResult.DumpObjectsHierarchyResultT, gamium.protocol.generated.Packets.ChangeConfigurationResult.ChangeConfigurationResultT, gamium.protocol.generated.Packets.QueryProfileResult.QueryProfileResultT]
self.result = None # type: Union[None, gamium.protocol.generated.Packets.HelloResult.HelloResultT, gamium.protocol.generated.Packets.QueryScreenResult.QueryScreenResultT, gamium.protocol.generated.Packets.FindObjectsResult.FindObjectsResultT, gamium.protocol.generated.Packets.QueryObjectInteractableResult.QueryObjectInteractableResultT, gamium.protocol.generated.Packets.ActionsResult.ActionsResultT, gamium.protocol.generated.Packets.ExecuteRpcResult.ExecuteRpcResultT, gamium.protocol.generated.Packets.InspectObjectOnScreenResult.InspectObjectOnScreenResultT, gamium.protocol.generated.Packets.InspectObjectWithIdResult.InspectObjectWithIdResultT, gamium.protocol.generated.Packets.DumpObjectsHierarchyResult.DumpObjectsHierarchyResultT, gamium.protocol.generated.Packets.ChangeConfigurationResult.ChangeConfigurationResultT, gamium.protocol.generated.Packets.QueryProfileResult.QueryProfileResultT, gamium.protocol.generated.Packets.GetPageSourceResult.GetPageSourceResultT]

@classmethod
def InitFromBuf(cls, buf, pos):
Expand Down
4 changes: 4 additions & 0 deletions client/python/gamium/gamium/Protocol/generated/Result.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Result(object):
Packets_DumpObjectsHierarchyResult = 9
Packets_ChangeConfigurationResult = 10
Packets_QueryProfileResult = 11
Packets_GetPageSourceResult = 12

def ResultCreator(unionType, table):
from flatbuffers.table import Table
Expand Down Expand Up @@ -53,4 +54,7 @@ def ResultCreator(unionType, table):
if unionType == Result().Packets_QueryProfileResult:
import gamium.protocol.generated.Packets.QueryProfileResult
return gamium.protocol.generated.Packets.QueryProfileResult.QueryProfileResultT.InitFromBuf(table.Bytes, table.Pos)
if unionType == Result().Packets_GetPageSourceResult:
import gamium.protocol.generated.Packets.GetPageSourceResult
return gamium.protocol.generated.Packets.GetPageSourceResult.GetPageSourceResultT.InitFromBuf(table.Bytes, table.Pos)
return None
2 changes: 1 addition & 1 deletion client/python/gamium/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gamium"
version = "2.0.0"
version = "2.0.1"
description = ""
authors = ["dogu"]
readme = "README.md"
Expand Down
54 changes: 27 additions & 27 deletions client/typescript/gamium/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
{
"name": "gamium",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"author": "dogu",
"homepage": "https://github.com/dogu-team/gamium.git",
"type": "commonjs",
"exports": {
".": {
"require": {
"types": "./build/cjs/index.d.ts",
"default": "./build/cjs/index.cjs"
},
"import": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.mjs"
}
},
"./common": {
"require": {
"types": "./build/cjs/common/index.d.ts",
"default": "./build/cjs/common/index.cjs"
},
"import": {
"types": "./build/esm/common/index.d.ts",
"default": "./build/esm/common/index.mjs"
}
}
},
"main": "./build/cjs/index.cjs",
"files": [
"build"
],
Expand All @@ -14,6 +38,7 @@
"rebuild": "yarn run clean && yarn run build",
"watch": "clear; echo gamium Watching... && nodemon"
},
"types": "./build/cjs/index.d.ts",
"dependencies": {
"flatbuffers": "22.10.26",
"gl-matrix": "3.4.3"
Expand All @@ -35,30 +60,5 @@
},
"publishConfig": {
"access": "public"
},
"type": "commonjs",
"exports": {
".": {
"require": {
"types": "./build/cjs/index.d.ts",
"default": "./build/cjs/index.cjs"
},
"import": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.mjs"
}
},
"./common": {
"require": {
"types": "./build/cjs/common/index.d.ts",
"default": "./build/cjs/common/index.cjs"
},
"import": {
"types": "./build/esm/common/index.d.ts",
"default": "./build/esm/common/index.mjs"
}
}
},
"types": "./build/cjs/index.d.ts",
"main": "./build/cjs/index.cjs"
}
}
8 changes: 2 additions & 6 deletions client/typescript/gamium/src/common/actions/key-by.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import {
InputKeyBy,
UnityKeyboard,
UnityKeyCode,
} from "../protocols/generated";
import { InputKeyBy, UnityKeyboard, UnityKeyCode } from '../protocols/generated';

export class KeyBy {
constructor(public readonly by: InputKeyBy, public readonly str: string) {}
static unityKeycode(code: keyof typeof UnityKeyCode): KeyBy {
return new KeyBy(InputKeyBy.UNITY_KEYCODE, code);
}
static unityKeyboard(key: keyof typeof UnityKeyboard): KeyBy {
const casted = key.replace("Digit", "");
const casted = key.replace('Digit', '');
return new KeyBy(InputKeyBy.UNITY_KEYBOARD, casted);
}
}
11 changes: 3 additions & 8 deletions client/typescript/gamium/src/common/errors/gamium-error.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { stringify } from "../internal/functions";
import { ErrorCode } from "../protocols/generated";
import { stringify } from '../internal/functions';
import { ErrorCode } from '../protocols/generated';

export class GamiumError extends Error {
constructor(
public readonly code: ErrorCode,
public readonly reason: string,
private readonly etc?: { [key: string]: unknown },
options?: ErrorOptions
) {
constructor(public readonly code: ErrorCode, public readonly reason: string, private readonly etc?: { [key: string]: unknown }, options?: ErrorOptions) {
const reasonObj = { code: ErrorCode[code], reason, etc };
super(stringify(reasonObj, { depth: undefined }), options);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ErrorCode } from "../protocols/generated";
import { WaitOptions } from "../options/wait-options";
import { GamiumError } from "./gamium-error";
import { WaitOptions } from '../options/wait-options';
import { ErrorCode } from '../protocols/generated';
import { GamiumError } from './gamium-error';

export class GamiumWaitError extends GamiumError {
constructor(
Expand All @@ -9,7 +9,7 @@ export class GamiumWaitError extends GamiumError {
public innerResult?: unknown,
public tryCount?: number,
public waitOptions?: Partial<WaitOptions>,
options?: ErrorOptions
options?: ErrorOptions,
) {
super(code, reason, { innerResult, tryCount, waitOptions }, options);
}
Expand Down
11 changes: 11 additions & 0 deletions client/typescript/gamium/src/common/gamium-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
ExecuteRpcResultT,
FindObjectsParamT,
FindObjectsResultT,
GetPageSourceParamT,
GetPageSourceResultT,
HelloParamT,
HelloResultT,
InspectObjectOnScreenParamT,
Expand Down Expand Up @@ -123,6 +125,15 @@ export const createInspectWithIdScreen = (param: Plain<InspectObjectWithIdParamT
};
};

export const createGetPageSource = (param: Plain<GetPageSourceParamT>): PacketTypes<GetPageSourceParamT, GetPageSourceResultT> => {
return {
param: new GetPageSourceParamT(),
result: undefined,
paramEnum: Param.Packets_GetPageSourceParam,
resultEnum: Result.Packets_GetPageSourceResult,
};
};

export const createQueryProfile = (param: Plain<QueryProfileParamT>): PacketTypes<QueryProfileParamT, QueryProfileResultT> => {
return {
param: new QueryProfileParamT(),
Expand Down
Loading

0 comments on commit 399d7aa

Please sign in to comment.