Repos

Create, manage and query Repos.

Overview

Repo entities describe a software source code repository, as defined by Schema.org. Repos are specified by their name and URI.

Repos are not unique by name, across the Graphlit project.

Operations

Create Repo

The createRepo mutation enables the creation of a repo by accepting the repo name and uri. It returns essential details, including the ID and name of the newly generated repo.

Mutation:

mutation CreateRepo($repo: RepoInput!) {
  createRepo(repo: $repo) {
    id
    name
  }
}

Variables:

{
  "repo": {
    "uri": "https://github.com/openai/openai-cookbook",
    "name": "OpenAI Cookbook"
  }
}

Response:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
  "name": "OpenAI Cookbook"
}
Update Repo

The updateRepo mutation enables the updating of a repo by accepting the repo name and other optional fields like uri.

Mutation:

mutation UpdateRepo($repo: RepoUpdateInput!) {
  updateRepo(repo: $repo) {
    id
    name
  }
}

Variables:

{
  "repo": {
    "uri": "https://github.com/openai/openai-cookbook",
    "description": "Example code and guides for accomplishing common tasks with the OpenAI API.",
    "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
    "name": "OpenAI Cookbook"
  }
}

Response:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
  "name": "OpenAI Cookbook"
}
Delete Repo

The deleteRepo mutation allows the deletion of a repo by utilizing the id parameter, and it returns the ID and state of the deleted repo.

Mutation:

mutation DeleteRepo($id: ID!) {
  deleteRepo(id: $id) {
    id
    state
  }
}

Variables:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3"
}

Response:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
  "state": "DELETED"
}
Delete Repos

The deleteRepos mutation allows the deletion of multiple repos, as specified by the ids array parameter, and it returns the ID and state of the deleted repos.

Mutation:

mutation DeleteRepos($ids: [ID!]!) {
  deleteRepos(ids: $ids) {
    id
    state
  }
}

Variables:

{
  "ids": [
    "39fcf408p-15ca-4cc2-9476-622d64aa38f3",
    "93476a0c-d567-4624-9d5e-df43dfff92ea"
  ]
}

Response:

[
  {
    "id": "93476a0c-d567-4624-9d5e-df43dfff92ea",
    "state": "DELETED"
  },
  {
    "id": "39fcf408-15ca-4cc2-9476-622d64aa38f3",
    "state": "DELETED"
  }
]
Get Repo

The repo query allows you to retrieve specific details of a repo by providing the id parameter.

Query:

query GetRepo($id: ID!) {
  repo(id: $id) {
    id
    name
  }
}

Variables:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3"
}

Response:

{
  "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
  "name": "OpenAI Cookbook"
}
Query Repos

Query Repos

The repos query allows you to retrieve all repos. It returns a list of repo results, including the ID and name for each repo.

Query:

query QueryRepos($filter: RepoFilter!) {
  repos(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
      "name": "OpenAI Cookbook"
    }
  ]
}

Query Repos By Name

The repos query allows you to retrieve repos based on a specific filter criteria, via the name parameter. In this example, the name is set to "OpenAI." It returns a list of repo results containing the ID and name for each matching repo.

Query:

query QueryRepos($filter: RepoFilter!) {
  repos(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "name": "OpenAI",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "f5fc4c17-3d46-4e3b-85a7-f72542a8cab3",
      "name": "OpenAI Cookbook"
    }
  ]
}

Last updated