Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Sep 16, 2024
1 parent 1e594e4 commit 32e8472
Show file tree
Hide file tree
Showing 238 changed files with 2,104 additions and 2,105 deletions.
1 change: 0 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"arrowParens": "always",
"trailingComma": "es5",
"bracketSpacing": true,
"endOfLine": "lf",
"printWidth": 100,
Expand Down
8 changes: 4 additions & 4 deletions docs/howtos/Client Generation/05union.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ export type DemoServiceContext = Client & {
queryParameters: {
mode: "strict" | "lenient";
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<Analyze200Response | AnalyzeDefaultResponse>;
};
/** Resource for '/completions' has methods for the following verbs: post */
(path: "/completions"): {
post(
options: {
body: CompletionInput;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<Completions200Response | CompletionsDefaultResponse>;
};
};
Expand Down Expand Up @@ -209,14 +209,14 @@ export type DemoServiceContext = Client & {
body?: {
x: number;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<A200Response>;
post(
options?: {
body?: {
x: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<B200Response>;
};
};
Expand Down
34 changes: 17 additions & 17 deletions docs/howtos/Client Generation/07tcgcTypes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ import { PythonSdkContext } from "./lib.js";
import { PythonSdkClientType } from "./interfaces.js";

function linkSubClients<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>
sdkContext: PythonSdkContext<TServiceOperation>,
): void {
for (const client of sdkContext.clients) {
client.subclients = client.methods
Expand Down Expand Up @@ -601,7 +601,7 @@ interface SdkServiceMethodBase<TServiceOperation extends SdkServiceOperation>
```ts
function serializeServiceMethod<TServiceOperation extends PythonSdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
method: SdkServiceMethod<TServiceOperation>
method: SdkServiceMethod<TServiceOperation>,
): PythonSdkServiceMethod {
switch (method.kind) {
case "basic":
Expand Down Expand Up @@ -968,7 +968,7 @@ const sdkHttpOperation = {
function serializeServiceOperation<TServiceOperation extends PythonSdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
method: SdkServiceMethod<TServiceOperation>,
operation: TServiceOperation
operation: TServiceOperation,
): TServiceOperation {
switch (operation.kind) {
case "http":
Expand Down Expand Up @@ -1252,7 +1252,7 @@ import { getPythonSdkType } from "./types.js";

function serializeMethodResponse<TServiceOperation extends SdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
response: SdkMethodResponse
response: SdkMethodResponse,
): PythonSdkMethodResponse {
return {
...response,
Expand Down Expand Up @@ -1699,7 +1699,7 @@ const sdkHttpOperationExample = {
```ts
function serializeServiceOperationExample(
context: PythonSdkContext<SdkHttpOperation>,
operation: SdkHttpOperation
operation: SdkHttpOperation,
): PythonSdkHttpOperationExample {
for (const example of operation.examples) {
return {
Expand All @@ -1720,15 +1720,15 @@ function serializeServiceOperationExample(
})),
bodyValue: serializeTypeExample(context, value.bodyValue),
},
])
]),
),
};
}
}

function serializeTypeExample(
context: PythonSdkContext<SdkHttpOperation>,
example: SdkTypeExample
example: SdkTypeExample,
): PythonSdkTypeExample {
switch (example.kind) {
case "string":
Expand Down Expand Up @@ -1770,7 +1770,7 @@ function serializeTypeExample(
Object.entries(example.value).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
),
};
case "union":
Expand All @@ -1786,14 +1786,14 @@ function serializeTypeExample(
Object.entries(example.value).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
),
additionalPropertiesValue: example.additionalPropertiesValue
? Object.fromEntries(
Object.entries(example.additionalPropertiesValue).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
)
: undefined,
};
Expand Down Expand Up @@ -1862,12 +1862,12 @@ export async function $onEmit(context: EmitContext<PythonEmitterOptions>) {

function serializeClient<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>,
client: SdkClientType<TServiceOperation>
client: SdkClientType<TServiceOperation>,
): PythonSdkClientType {
const pythonClient = {
...client,
parameters: client.initialization?.properties.map((x) =>
getSdkModelPropertyType(sdkContext, x)
getSdkModelPropertyType(sdkContext, x),
),
subClients: client.methods
.filter((x) => x.kind === "clientaccessor")
Expand All @@ -1882,7 +1882,7 @@ function serializeClient<TServiceOperation extends PythonSdkServiceOperation>(
}

function linkSubClients<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>
sdkContext: PythonSdkContext<TServiceOperation>,
): void {
for (const client of sdkContext.clients) {
client.subclients = client.methods
Expand Down Expand Up @@ -2037,7 +2037,7 @@ import { getPythonSdkType, getSdkModelPropertyType } from "./types.js";
function serializeHttpServiceOperation(
context: PythonSdkContext<SdkHttpOperation>,
method: SdkServiceMethod<SdkHttpOperation>,
operation: SdkHttpOperation
operation: SdkHttpOperation,
): PythonSdkHttpOperation {
return {
...operation,
Expand All @@ -2046,16 +2046,16 @@ function serializeHttpServiceOperation(
? getSdkModelPropertyType(context, operation.bodyParam)
: undefined,
responses: Object.entries(operation.responses).map(([statusCode, responses]) =>
serializeHttpResponse(context, method, statusCode, responses)
serializeHttpResponse(context, method, statusCode, responses),
),
exceptions: Object.entries(operation.exceptions).map(([statusCode, exceptions]) =>
serializeHttpResponse(context, method, statusCode, exceptions)
serializeHttpResponse(context, method, statusCode, exceptions),
),
};

function serializeHttpResponse(
context: PythonSdkContext<SdkHttpOperation>,
response: SdkHttpResponse
response: SdkHttpResponse,
): PythonSdkHttpResponse {
return {
...response,
Expand Down
42 changes: 21 additions & 21 deletions docs/howtos/Client Generation/08methodInputs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type DemoServiceContext = Client & {
/** Resource for '/analyze' has methods for the following verbs: post */
(path: "/users"): {
get(
options: RequestParameters
options: RequestParameters,
): StreamableMethod<GetUser200Response | GetUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -152,7 +152,7 @@ export type DemoServiceContext = Client & {
post(
options: {
body: User;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -252,7 +252,7 @@ export type DemoServiceContext = Client & {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -262,7 +262,7 @@ export type DemoServiceContext = Client & {
export async function upload(
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -344,15 +344,15 @@ export type DemoServiceContext = Client & {
/** Resource for '/completions' has methods for the following verbs: post */
(
path: "/users/{id}",
id
id,
): {
post(
options: {
body: {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -363,7 +363,7 @@ export async function upload(
id: string,
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand All @@ -372,7 +372,7 @@ export class DemoServiceClient {
id: string,
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;
}
```
Expand Down Expand Up @@ -458,7 +458,7 @@ export type DemoServiceContext = Client & {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -468,7 +468,7 @@ export type DemoServiceContext = Client & {
export async function upload(
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -561,7 +561,7 @@ export type DemoServiceContext = Client & {
post(
options: {
body: User;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -775,7 +775,7 @@ export type DemoServiceContext = Client & {
body: {
schema: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -789,7 +789,7 @@ export interface Schema {
// Modular api layer
export async function register(
body: Schema,
options: GetBlobPropertiesOptionalParams
options: GetBlobPropertiesOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -901,12 +901,12 @@ export type WidgetServiceContext = Client & {
path: {
(
path: "/widgets/{widgetName}:scheduleRepairs",
widgetName: string
widgetName: string,
): {
post(
options: {
body: RepairInfo;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -918,7 +918,7 @@ export async function scheduleRepairs(
widgetName: string,
problem: string,
contact: string,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;

// Modular classical client layer
Expand All @@ -927,7 +927,7 @@ export class WidgetServiceClient {
widgetName: string,
problem: string,
contact: string,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;
}
```
Expand Down Expand Up @@ -1070,12 +1070,12 @@ export type WidgetServiceContext = Client & {
path: {
(
path: "/widgets/{widgetName}:scheduleRepairs",
widgetName: string
widgetName: string,
): {
post(
options: {
body: RepairInfo;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -1086,15 +1086,15 @@ export async function scheduleRepairs(
context: Client,
widgetName: string,
body: RepairInfo,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;

// Modular classical client layer
export class WidgetServiceClient {
scheduleRepairs(
widgetName: string,
body: RepairInfo,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;
}
```
Expand Down
4 changes: 2 additions & 2 deletions eng/scripts/check-for-changed-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ if (
if (process.argv[2] !== "publish") {
console.error(
`ERROR: Files above were changed during PR validation, but not included in the PR.
Include any automated changes such as sample output, spec.html, and ThirdPartyNotices.txt in your PR.`
Include any automated changes such as sample output, spec.html, and ThirdPartyNotices.txt in your PR.`,
);
} else {
console.error(
`ERROR: Changes have been made since this publish PR was prepared.
In the future, remember to alert coworkers to avoid merging additional changes while publish PRs are in progress.
Close this PR, run prepare-publish again.`
Close this PR, run prepare-publish again.`,
);
}
run("git", ["diff"], { cwd: coreRepoRoot });
Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/generate-third-party-notices.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function main() {
const rootName = basename(root);
const packages = await findThirdPartyPackages();
const packageRoots = [...packages.keys()].sort((a, b) =>
packages.get(a).name.localeCompare(packages.get(b).name)
packages.get(a).name.localeCompare(packages.get(b).name),
);
let text = `${rootName}
Expand Down
Loading

0 comments on commit 32e8472

Please sign in to comment.