Skip to content

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

typescript
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:

typescript
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.

tsx
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

ParameterTypeRequiredDescription
requestoperations.ListReposRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListReposResponseBody>

Errors

Error TypeStatus CodeContent Type
errors.RepoError401, 403application/json
errors.RepoError500, 503application/json
errors.APIError4XX, 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

typescript
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:

typescript
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.

tsx
import {
  // Mutation hook for triggering the API call.
  useReposCreateMutation
} from "@meetkai/mka1/react-query/reposCreate.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CreateRepoRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Repo>

Errors

Error TypeStatus CodeContent Type
errors.RepoError400, 401, 403, 409application/json
errors.RepoError500, 502, 503application/json
errors.APIError4XX, 5XX*/*

delete

Removes a repository; org owner/admin only. The DB delete is authoritative; the Gitea teardown is best-effort cleanup.

Example Usage

typescript
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:

typescript
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.

tsx
import {
  // Mutation hook for triggering the API call.
  useReposDeleteMutation
} from "@meetkai/mka1/react-query/reposDelete.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteRepoRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<void>

Errors

Error TypeStatus CodeContent Type
errors.RepoError401, 403, 404application/json
errors.RepoError500application/json
errors.APIError4XX, 5XX*/*

get

Reads a single repository after the org+role access check (org owner/admin of the repository's org only).

Example Usage

typescript
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:

typescript
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.

tsx
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

ParameterTypeRequiredDescription
requestoperations.GetRepoRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Repo>

Errors

Error TypeStatus CodeContent Type
errors.RepoError401, 403, 404application/json
errors.APIError4XX, 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

typescript
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:

typescript
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.

tsx
import {
  // Mutation hook for triggering the API call.
  useReposUpdateMutation
} from "@meetkai/mka1/react-query/reposUpdate.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.PatchRepoRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Repo>

Errors

Error TypeStatus CodeContent Type
errors.RepoError400, 401, 403, 404, 409application/json
errors.RepoError500application/json
errors.APIError4XX, 5XX*/*