Skip to content

Commit

Permalink
refactor: improve method name of api client (#5980)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.16.x

#### What this PR does / why we need it:

规范 api client 的方法名,之前生成的 api client 的方法名没有完全遵循驼峰命名。

#### Which issue(s) this PR fixes:

Close #5716

#### Special notes for your reviewer:

CI 通过即可。

#### Does this PR introduce a user-facing change?

```release-note
None
```
  • Loading branch information
ruibaby authored May 24, 2024
1 parent 49bb9c1 commit f3c3c91
Show file tree
Hide file tree
Showing 116 changed files with 3,254 additions and 3,252 deletions.
381 changes: 191 additions & 190 deletions api-docs/openapi/v3_0/aggregated.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public RouterFunction<ServerResponse> create() {
var tagName = gvk.toString();
return SpringdocRouteBuilder.route()
.GET(getHandler.pathPattern(), getHandler,
builder -> builder.operationId("Get" + gvk)
builder -> builder.operationId("Get/" + gvk)
.description("Get " + gvk)
.tag(tagName)
.parameter(parameterBuilder().in(ParameterIn.PATH)
Expand All @@ -48,7 +48,7 @@ public RouterFunction<ServerResponse> create() {
.implementation(scheme.type())))
.GET(listHandler.pathPattern(), listHandler,
builder -> {
builder.operationId("List" + gvk)
builder.operationId("List/" + gvk)
.description("List " + gvk)
.tag(tagName)
.response(responseBuilder().responseCode("200")
Expand All @@ -57,7 +57,7 @@ public RouterFunction<ServerResponse> create() {
SortableRequest.buildParameters(builder);
})
.POST(createHandler.pathPattern(), createHandler,
builder -> builder.operationId("Create" + gvk)
builder -> builder.operationId("Create/" + gvk)
.description("Create " + gvk)
.tag(tagName)
.requestBody(requestBodyBuilder()
Expand All @@ -67,7 +67,7 @@ public RouterFunction<ServerResponse> create() {
.description("Response " + scheme.plural() + " created just now")
.implementation(scheme.type())))
.PUT(updateHandler.pathPattern(), updateHandler,
builder -> builder.operationId("Update" + gvk)
builder -> builder.operationId("Update/" + gvk)
.description("Update " + gvk)
.tag(tagName)
.parameter(parameterBuilder().in(ParameterIn.PATH)
Expand All @@ -80,7 +80,7 @@ public RouterFunction<ServerResponse> create() {
.description("Response " + scheme.plural() + " updated just now")
.implementation(scheme.type())))
.DELETE(deleteHandler.pathPattern(), deleteHandler,
builder -> builder.operationId("Delete" + gvk)
builder -> builder.operationId("Delete/" + gvk)
.description("Delete " + gvk)
.tag(tagName)
.parameter(parameterBuilder().in(ParameterIn.PATH)
Expand Down
2 changes: 1 addition & 1 deletion ui/console-src/composables/use-content-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function useContentSnapshot(
return;
}
const { data } =
await apiClient.extension.snapshot.getcontentHaloRunV1alpha1Snapshot({
await apiClient.extension.snapshot.getContentHaloRunV1alpha1Snapshot({
name: snapshotName.value,
});
version.value = data.metadata.version || 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const handleMove = async (group: Group) => {
const promises = Array.from(selectedAttachments.value).map((attachment) => {
const attachmentToUpdate = cloneDeep(attachment);
attachmentToUpdate.spec.groupName = group.metadata.name;
return apiClient.extension.storage.attachment.updatestorageHaloRunV1alpha1Attachment(
return apiClient.extension.storage.attachment.updateStorageHaloRunV1alpha1Attachment(
{
name: attachment.metadata.name,
attachment: attachmentToUpdate,
Expand Down Expand Up @@ -230,7 +230,7 @@ onMounted(() => {
return;
}
apiClient.extension.storage.attachment
.getstorageHaloRunV1alpha1Attachment({
.getStorageHaloRunV1alpha1Attachment({
name: nameQuery.value,
})
.then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const { data: policy } = useQuery({
}
const { data } =
await apiClient.extension.storage.policy.getstorageHaloRunV1alpha1Policy({
await apiClient.extension.storage.policy.getStorageHaloRunV1alpha1Policy({
name: policyName.value,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ const handleSave = async () => {
try {
saving.value = true;
if (props.group) {
await apiClient.extension.storage.group.updatestorageHaloRunV1alpha1Group(
await apiClient.extension.storage.group.updateStorageHaloRunV1alpha1Group(
{
name: formState.value.metadata.name,
group: formState.value,
}
);
} else {
await apiClient.extension.storage.group.createstorageHaloRunV1alpha1Group(
await apiClient.extension.storage.group.createStorageHaloRunV1alpha1Group(
{
group: formState.value,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ const handleDelete = (group: Group) => {
size: 0,
});
await apiClient.extension.storage.group.deletestorageHaloRunV1alpha1Group(
await apiClient.extension.storage.group.deleteStorageHaloRunV1alpha1Group(
{ name: group.metadata.name }
);
// move attachments to none group
const moveToUnGroupRequests = data.items.map((attachment) => {
attachment.spec.groupName = undefined;
return apiClient.extension.storage.attachment.updatestorageHaloRunV1alpha1Attachment(
return apiClient.extension.storage.attachment.updateStorageHaloRunV1alpha1Attachment(
{
name: attachment.metadata.name,
attachment: attachment,
Expand Down Expand Up @@ -152,12 +152,12 @@ const handleDeleteWithAttachments = (group: Group) => {
size: 0,
});
await apiClient.extension.storage.group.deletestorageHaloRunV1alpha1Group(
await apiClient.extension.storage.group.deleteStorageHaloRunV1alpha1Group(
{ name: group.metadata.name }
);
const deleteAttachmentRequests = data.items.map((attachment) => {
return apiClient.extension.storage.attachment.deletestorageHaloRunV1alpha1Attachment(
return apiClient.extension.storage.attachment.deleteStorageHaloRunV1alpha1Attachment(
{ name: attachment.metadata.name }
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const handleDelete = () => {
cancelText: t("core.common.buttons.cancel"),
onConfirm: async () => {
try {
await apiClient.extension.storage.attachment.deletestorageHaloRunV1alpha1Attachment(
await apiClient.extension.storage.attachment.deleteStorageHaloRunV1alpha1Attachment(
{
name: props.attachment.metadata.name,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const handleDelete = async (policy: Policy) => {
confirmText: t("core.common.buttons.confirm"),
cancelText: t("core.common.buttons.cancel"),
onConfirm: async () => {
await apiClient.extension.storage.policy.deletestorageHaloRunV1alpha1Policy(
await apiClient.extension.storage.policy.deleteStorageHaloRunV1alpha1Policy(
{ name: policy.metadata.name }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const { data: policyTemplate } = useQuery({
],
queryFn: async () => {
const { data } =
await apiClient.extension.storage.policyTemplate.getstorageHaloRunV1alpha1PolicyTemplate(
await apiClient.extension.storage.policyTemplate.getStorageHaloRunV1alpha1PolicyTemplate(
{
name: formState.value.spec.templateName,
}
Expand All @@ -86,7 +86,7 @@ const { data: setting, isLoading } = useQuery({
throw new Error("No setting found");
}
const { data } = await apiClient.extension.setting.getv1alpha1Setting({
const { data } = await apiClient.extension.setting.getV1alpha1Setting({
name: policyTemplate.value.spec.settingName,
});
Expand Down Expand Up @@ -115,7 +115,7 @@ const { data: configMap } = useQuery({
if (!policy.value?.spec.configMapName) {
throw new Error("No configMap found");
}
const { data } = await apiClient.extension.configMap.getv1alpha1ConfigMap({
const { data } = await apiClient.extension.configMap.getV1alpha1ConfigMap({
name: policy.value?.spec.configMapName,
});
return data;
Expand All @@ -138,25 +138,25 @@ const handleSave = async () => {
const configMapToUpdate = convertToSave();
if (isUpdateMode) {
await apiClient.extension.configMap.updatev1alpha1ConfigMap({
await apiClient.extension.configMap.updateV1alpha1ConfigMap({
name: configMap.value.metadata.name,
configMap: configMapToUpdate,
});
await apiClient.extension.storage.policy.updatestorageHaloRunV1alpha1Policy(
await apiClient.extension.storage.policy.updateStorageHaloRunV1alpha1Policy(
{
name: formState.value.metadata.name,
policy: formState.value,
}
);
} else {
const { data: newConfigMap } =
await apiClient.extension.configMap.createv1alpha1ConfigMap({
await apiClient.extension.configMap.createV1alpha1ConfigMap({
configMap: configMapToUpdate,
});
formState.value.spec.configMapName = newConfigMap.metadata.name;
await apiClient.extension.storage.policy.createstorageHaloRunV1alpha1Policy(
await apiClient.extension.storage.policy.createStorageHaloRunV1alpha1Policy(
{
policy: formState.value,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function useFetchAttachmentGroup(): useFetchAttachmentGroupReturn {
queryKey: ["attachment-groups"],
queryFn: async () => {
const { data } =
await apiClient.extension.storage.group.liststorageHaloRunV1alpha1Group(
await apiClient.extension.storage.group.listStorageHaloRunV1alpha1Group(
{
labelSelector: ["!halo.run/hidden"],
sort: ["metadata.creationTimestamp,asc"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useFetchAttachmentPolicy(): useFetchAttachmentPolicyReturn {
queryKey: ["attachment-policies"],
queryFn: async () => {
const { data } =
await apiClient.extension.storage.policy.liststorageHaloRunV1alpha1Policy();
await apiClient.extension.storage.policy.listStorageHaloRunV1alpha1Policy();
return data.items;
},
refetchInterval(data) {
Expand All @@ -43,7 +43,7 @@ export function useFetchAttachmentPolicyTemplate(): useFetchAttachmentPolicyTemp
queryKey: ["attachment-policy-templates"],
queryFn: async () => {
const { data } =
await apiClient.extension.storage.policyTemplate.liststorageHaloRunV1alpha1PolicyTemplate();
await apiClient.extension.storage.policyTemplate.listStorageHaloRunV1alpha1PolicyTemplate();
return data.items;
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export function useAttachmentControl(filterOptions: {
try {
const promises = Array.from(selectedAttachments.value).map(
(attachment) => {
return apiClient.extension.storage.attachment.deletestorageHaloRunV1alpha1Attachment(
return apiClient.extension.storage.attachment.deleteStorageHaloRunV1alpha1Attachment(
{
name: attachment.metadata.name,
}
Expand Down
4 changes: 2 additions & 2 deletions ui/console-src/modules/contents/comments/CommentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const handleDeleteInBatch = async () => {
onConfirm: async () => {
try {
const promises = selectedCommentNames.value.map((name) => {
return apiClient.extension.comment.deletecontentHaloRunV1alpha1Comment(
return apiClient.extension.comment.deleteContentHaloRunV1alpha1Comment(
{
name,
}
Expand Down Expand Up @@ -200,7 +200,7 @@ const handleApproveInBatch = async () => {
});
const promises = commentsToUpdate?.map((comment) => {
return apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment(
return apiClient.extension.comment.updateContentHaloRunV1alpha1Comment(
{
name: comment.comment.metadata.name,
comment: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const handleDelete = async () => {
cancelText: t("core.common.buttons.cancel"),
onConfirm: async () => {
try {
await apiClient.extension.comment.deletecontentHaloRunV1alpha1Comment({
await apiClient.extension.comment.deleteContentHaloRunV1alpha1Comment({
name: props.comment?.comment?.metadata.name as string,
});
Expand All @@ -92,7 +92,7 @@ const handleApproveReplyInBatch = async () => {
return !reply.reply.spec.approved;
});
const promises = repliesToUpdate?.map((reply) => {
return apiClient.extension.reply.updatecontentHaloRunV1alpha1Reply({
return apiClient.extension.reply.updateContentHaloRunV1alpha1Reply({
name: reply.reply.metadata.name,
reply: {
...reply.reply,
Expand Down Expand Up @@ -123,7 +123,7 @@ const handleApprove = async () => {
commentToUpdate.spec.approved = true;
// TODO: 暂时由前端设置发布时间。see https://github.com/halo-dev/halo/pull/2746
commentToUpdate.spec.approvedTime = new Date().toISOString();
await apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment({
await apiClient.extension.comment.updateContentHaloRunV1alpha1Comment({
name: commentToUpdate.metadata.name,
comment: commentToUpdate,
});
Expand Down Expand Up @@ -170,7 +170,7 @@ const handleToggleShowReplies = async () => {
if (props.comment.comment.status?.unreadReplyCount) {
const commentToUpdate = cloneDeep(props.comment.comment);
commentToUpdate.spec.lastReadTime = new Date().toISOString();
await apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment({
await apiClient.extension.comment.updateContentHaloRunV1alpha1Comment({
name: commentToUpdate.metadata.name,
comment: commentToUpdate,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const handleDelete = async () => {
cancelText: t("core.common.buttons.cancel"),
onConfirm: async () => {
try {
await apiClient.extension.reply.deletecontentHaloRunV1alpha1Reply({
await apiClient.extension.reply.deleteContentHaloRunV1alpha1Reply({
name: props.reply?.reply.metadata.name as string,
});
Expand All @@ -75,7 +75,7 @@ const handleApprove = async () => {
replyToUpdate.spec.approved = true;
// TODO: 暂时由前端设置发布时间。see https://github.com/halo-dev/halo/pull/2746
replyToUpdate.spec.approvedTime = new Date().toISOString();
await apiClient.extension.reply.updatecontentHaloRunV1alpha1Reply({
await apiClient.extension.reply.updateContentHaloRunV1alpha1Reply({
name: replyToUpdate.metadata.name,
reply: replyToUpdate,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const handleDeletePermanently = async (singlePage: SinglePage) => {
confirmText: t("core.common.buttons.confirm"),
cancelText: t("core.common.buttons.cancel"),
onConfirm: async () => {
await apiClient.extension.singlePage.deletecontentHaloRunV1alpha1SinglePage(
await apiClient.extension.singlePage.deleteContentHaloRunV1alpha1SinglePage(
{
name: singlePage.metadata.name,
}
Expand All @@ -114,7 +114,7 @@ const handleDeletePermanentlyInBatch = async () => {
onConfirm: async () => {
await Promise.all(
selectedPageNames.value.map((name) => {
return apiClient.extension.singlePage.deletecontentHaloRunV1alpha1SinglePage(
return apiClient.extension.singlePage.deleteContentHaloRunV1alpha1SinglePage(
{
name,
}
Expand All @@ -138,7 +138,7 @@ const handleRecovery = async (singlePage: SinglePage) => {
onConfirm: async () => {
const singlePageToUpdate = cloneDeep(singlePage);
singlePageToUpdate.spec.deleted = false;
await apiClient.extension.singlePage.updatecontentHaloRunV1alpha1SinglePage(
await apiClient.extension.singlePage.updateContentHaloRunV1alpha1SinglePage(
{
name: singlePageToUpdate.metadata.name,
singlePage: singlePageToUpdate,
Expand Down Expand Up @@ -170,7 +170,7 @@ const handleRecoveryInBatch = async () => {
return Promise.resolve();
}
return apiClient.extension.singlePage.updatecontentHaloRunV1alpha1SinglePage(
return apiClient.extension.singlePage.updateContentHaloRunV1alpha1SinglePage(
{
name: singlePage.metadata.name,
singlePage: {
Expand Down
4 changes: 2 additions & 2 deletions ui/console-src/modules/contents/pages/SinglePageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ const handleFetchContent = async () => {
// SinglePage settings
const handleOpenSettingModal = async () => {
const { data: latestSinglePage } =
await apiClient.extension.singlePage.getcontentHaloRunV1alpha1SinglePage({
await apiClient.extension.singlePage.getContentHaloRunV1alpha1SinglePage({
name: formState.value.page.metadata.name,
});
formState.value.page = latestSinglePage;
Expand Down Expand Up @@ -333,7 +333,7 @@ const onSettingPublished = (singlePage: SinglePage) => {
onMounted(async () => {
if (routeQueryName.value) {
const { data: singlePage } =
await apiClient.extension.singlePage.getcontentHaloRunV1alpha1SinglePage({
await apiClient.extension.singlePage.getContentHaloRunV1alpha1SinglePage({
name: routeQueryName.value,
});
formState.value.page = singlePage;
Expand Down
Loading

0 comments on commit f3c3c91

Please sign in to comment.