MCPcopy Index your code
hub / github.com/github/copilot-sdk / pushNamespaceMethodBody

Function pushNamespaceMethodBody

scripts/codegen/rust.ts:1830–1869  ·  view source on GitHub ↗
(
	out: string[],
	constName: string,
	isSession: boolean,
	hasParams: boolean,
	resultIsVoid: boolean,
)

Source from the content-addressed store, hash-verified

1828}
1829
1830function pushNamespaceMethodBody(
1831 out: string[],
1832 constName: string,
1833 isSession: boolean,
1834 hasParams: boolean,
1835 resultIsVoid: boolean,
1836): void {
1837 // Build the params Value sent over the wire.
1838 if (isSession) {
1839 if (hasParams) {
1840 out.push(` let mut wire_params = serde_json::to_value(params)?;`);
1841 out.push(
1842 ` wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());`,
1843 );
1844 } else {
1845 out.push(
1846 ` let wire_params = serde_json::json!({ "sessionId": self.session.id() });`,
1847 );
1848 }
1849 out.push(
1850 ` let _value = self.session.client().call(rpc_methods::${constName}, Some(wire_params)).await?;`,
1851 );
1852 } else {
1853 if (hasParams) {
1854 out.push(` let wire_params = serde_json::to_value(params)?;`);
1855 } else {
1856 out.push(` let wire_params = serde_json::json!({});`);
1857 }
1858 out.push(
1859 ` let _value = self.client.call(rpc_methods::${constName}, Some(wire_params)).await?;`,
1860 );
1861 }
1862
1863 if (resultIsVoid) {
1864 out.push(` Ok(())`);
1865 } else {
1866 out.push(` Ok(serde_json::from_value(_value)?)`);
1867 }
1868 out.push(` }`);
1869}
1870
1871function emitNamespaceMethod(
1872 out: string[],

Callers 1

emitNamespaceMethodFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…