Repos
Overview
Available Operations
- list - List the caller's org's repositories
- create - Create a repository
- delete - Delete a repository
- get - Get a repository
- update - Update a repository's labels
list
Returns every repository in the caller's org (org owner/admin only). Pure DB read.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.repos.list({});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { reposList } from "@meetkai/mka1/funcs/reposList.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await reposList(sdk, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("reposList failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Query hooks for fetching data.
useReposList,
useReposListSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchReposList,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateReposList,
invalidateAllReposList,
} from "@meetkai/mka1/react-query/reposList.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListReposRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListReposResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.RepoError | 401, 403 | application/json |
| errors.RepoError | 500, 503 | application/json |
| errors.APIError | 4XX, 5XX | */* |
create
Provisions a repository (org owner/admin only): DB insert (authoritative) → Gitea create (rolled back on failure). The repository belongs to the caller's org.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.repos.create({
createRepoRequest: {
name: "my-model",
},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { reposCreate } from "@meetkai/mka1/funcs/reposCreate.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await reposCreate(sdk, {
createRepoRequest: {
name: "my-model",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("reposCreate failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useReposCreateMutation
} from "@meetkai/mka1/react-query/reposCreate.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateRepoRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.Repo>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.RepoError | 400, 401, 403, 409 | application/json |
| errors.RepoError | 500, 502, 503 | application/json |
| errors.APIError | 4XX, 5XX | */* |
delete
Removes a repository; org owner/admin only. The DB delete is authoritative; the Gitea teardown is best-effort cleanup.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await sdk.repos.delete({
org: "<value>",
name: "<value>",
});
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { reposDelete } from "@meetkai/mka1/funcs/reposDelete.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await reposDelete(sdk, {
org: "<value>",
name: "<value>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("reposDelete failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useReposDeleteMutation
} from "@meetkai/mka1/react-query/reposDelete.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteRepoRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<void>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.RepoError | 401, 403, 404 | application/json |
| errors.RepoError | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
get
Reads a single repository after the org+role access check (org owner/admin of the repository's org only).
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.repos.get({
org: "<value>",
name: "<value>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { reposGet } from "@meetkai/mka1/funcs/reposGet.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await reposGet(sdk, {
org: "<value>",
name: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("reposGet failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Query hooks for fetching data.
useReposGet,
useReposGetSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchReposGet,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateReposGet,
invalidateAllReposGet,
} from "@meetkai/mka1/react-query/reposGet.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetRepoRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.Repo>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.RepoError | 401, 403, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |
update
Applies a label-only update (name/description); org owner/admin only. The repository id is stable, so a rename is a one-row DB update — no Gitea write. Omitted fields are left unchanged.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.repos.update({
org: "<value>",
name: "<value>",
patchRepoRequest: {},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { reposUpdate } from "@meetkai/mka1/funcs/reposUpdate.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await reposUpdate(sdk, {
org: "<value>",
name: "<value>",
patchRepoRequest: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("reposUpdate failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useReposUpdateMutation
} from "@meetkai/mka1/react-query/reposUpdate.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.PatchRepoRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.Repo>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.RepoError | 400, 401, 403, 404, 409 | application/json |
| errors.RepoError | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |