Skip to content

Service

OwnerRepositories

Bases: BaseModel

end_cursor = None class-attribute instance-attribute

forked_repos property

has_next_page = False class-attribute instance-attribute

owned_repos property

owner instance-attribute

private_repositories property

public_repositories property

repositories instance-attribute

as_artifact()

as_content()

RepositoryBranches

Bases: BaseModel

branches instance-attribute

end_cursor = None class-attribute instance-attribute

has_next_page = False class-attribute instance-attribute

owner instance-attribute

repository instance-attribute

as_artifact()

as_content()

check_api_key_valid(api_key) async

Checks if a github api key is valid.

If valid, returns the name of the api key owner.

get_files_for_node_ids(adapter, tree, node_ids) async

Get the files for the given node_ids directly from GitHub.

Can efficiently load multiple blobs at once in a single request.

get_filled_blobs(adapter, blob_entries, max_size_fill=10000, all_in_one=False) async

Fill text of the blobs in the given TreeEntries.

Useful when updating repository.

get_full_repo(adapter, repo_id, max_size_fill=10000) async

Get the full repository including all content.

Same as get_full_repo_structure, but includes the content of all blobs.

PARAMETER DESCRIPTION
adapter

The GithubAdapter instance to use.

TYPE: GithubAdapter

repo_id

The owner/repo/branch to get the tree for.

TYPE: RepoID

max_size_fill

If the size of the blob is greater than this (in bytes), don't fill the text

TYPE: int DEFAULT: 10000

get_full_repo_structure(adapter, repo_id, depth=None) async

Get the full repository structure for the given owner/repo/branch.

Structure means getting all the TreeEntries/Blobs (name, path, node_ids), but not the content.

get_owner_repositories(adapter, owner, previous_cursor=None) async

Get owners repositories.

Owner can be user or organization. The first 100 results will be returned.

PARAMETER DESCRIPTION
adapter

The GithubAdapter instance to use.

TYPE: GithubAdapter

owner

The owner of the repositories to get.

TYPE: str

previous_cursor

The end_cursor of the last repository in the previous call (for pagination).

TYPE: str | None DEFAULT: None

get_repo_branches(adapter, owner, repo_name, previous_cursor=None) async

Get only the branches of the given repository.

Basically just returns a subset of information fom the get_repository_info method.

PARAMETER DESCRIPTION
adapter

The GithubAdapter instance to use.

TYPE: GithubAdapter

owner

The owner of the repository.

TYPE: str

repo_name

The name of the repository.

TYPE: str

previous_cursor

The last id of the last branch in the previous call (for pagination).

TYPE: str | None DEFAULT: None

get_repo_changes(adapter, repo_id, existing_metadatas) async

Get the changes between the existing metadatas and the current repository structure.

Note: For now just works from the full repo structure straight away, but could later be optimized to only recurse into changed trees. (makes sense to be a github_service since it could later rely on many calls to the github api)

get_repo_overview(adapter, owner, repo_name, previous_cursor=None) async

Get the overview information about the repository.

PARAMETER DESCRIPTION
adapter

The GithubAdapter instance to use.

TYPE: GithubAdapter

owner

The owner of the repository.

TYPE: str

repo_name

The name of the repository.

TYPE: str

previous_cursor

The last id of the last branch in the previous call (for pagination).

TYPE: str | None DEFAULT: None

get_specific_file(adapter, repo_id, file_path) async

Get the most up-to-date contents of the given file directly from GitHub.

Note: This only works for a single path per request. For loading many files, prefer get_files_for_node_ids.