ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.286.0

This commit is contained in:
speakeasybot
2024-05-12 17:54:14 +00:00
parent a3f7a2e30b
commit a72d610609
60 changed files with 3591 additions and 571 deletions

View File

@@ -1236,7 +1236,7 @@ export class Links extends ClientSDK {
* Update a link
*
* @remarks
* Update a link for the authenticated workspace.
* Update a link for the authenticated workspace. If there's no change, returns as is.
*/
async update(
linkId: string,
@@ -1698,4 +1698,233 @@ export class Links extends ClientSDK {
);
}
}
/**
* Upsert a link
*
* @remarks
* Upsert a link for the authenticated workspace by its URL. If a link with the same URL already exists, returns as is if there's no change, or update it. Otherwise, a new link will be created.
*/
async upsert(
request?: operations.UpsertLinkRequestBody | undefined,
options?: RequestOptions
): Promise<components.LinkSchema> {
const input$ = request;
const headers$ = new Headers();
headers$.set("user-agent", SDK_METADATA.userAgent);
headers$.set("Content-Type", "application/json");
headers$.set("Accept", "application/json");
const payload$ = schemas$.parse(
input$,
(value$) => operations.UpsertLinkRequestBody$.outboundSchema.optional().parse(value$),
"Input validation failed"
);
const body$ =
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
const path$ = this.templateURLComponent("/links/upsert")();
const query$ = [
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
explode: true,
charEncoding: "percent",
}),
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
explode: true,
charEncoding: "percent",
}),
]
.filter(Boolean)
.join("&");
let security$;
if (typeof this.options$.token === "function") {
security$ = { token: await this.options$.token() };
} else if (this.options$.token) {
security$ = { token: this.options$.token };
} else {
security$ = {};
}
const context = {
operationID: "upsertLink",
oAuth2Scopes: [],
securitySource: this.options$.token,
};
const securitySettings$ = this.resolveGlobalSecurity(security$);
const doOptions = {
context,
errorCodes: [
"400",
"401",
"403",
"404",
"409",
"410",
"422",
"429",
"4XX",
"500",
"5XX",
],
};
const request$ = this.createRequest$(
context,
{
security: securitySettings$,
method: "PUT",
path: path$,
headers: headers$,
query: query$,
body: body$,
},
options
);
const response = await this.do$(request$, doOptions);
const responseFields$ = {
HttpMeta: {
Response: response,
Request: request$,
},
};
if (this.matchResponse(response, 200, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return components.LinkSchema$.inboundSchema.parse(val$);
},
"Response validation failed"
);
return result;
} else if (this.matchResponse(response, 400, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.BadRequest$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 401, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.Unauthorized$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 403, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.Forbidden$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 404, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.NotFound$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 409, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.Conflict$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 410, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.InviteExpired$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 422, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.UnprocessableEntity$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 429, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.RateLimitExceeded$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else if (this.matchResponse(response, 500, "application/json")) {
const responseBody = await response.json();
const result = schemas$.parse(
responseBody,
(val$) => {
return errors.InternalServerError$.inboundSchema.parse({
...responseFields$,
...val$,
});
},
"Response validation failed"
);
throw result;
} else {
const responseBody = await response.text();
throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
}
}
}