Struct octorust::git::Git

source ·
pub struct Git {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl Git

source

pub async fn create_blob( &self, owner: &str, repo: &str, body: &GitCreateBlobRequest ) -> Result<Response<Tree>, ClientError>

Create a blob.

This function performs a POST to the /repos/{owner}/{repo}/git/blobs endpoint.

FROM: https://docs.github.com/rest/reference/git#create-a-blob

Parameters:

  • owner: &str
  • repo: &str
source

pub async fn get_blob( &self, owner: &str, repo: &str, file_sha: &str ) -> Result<Response<Blob>, ClientError>

Get a blob.

This function performs a GET to the /repos/{owner}/{repo}/git/blobs/{file_sha} endpoint.

The content in the response will always be Base64 encoded.

Note: This API supports blobs up to 100 megabytes in size.

FROM: https://docs.github.com/rest/reference/git#get-a-blob

Parameters:

  • owner: &str
  • repo: &str
  • file_sha: &str
source

pub async fn create_commit( &self, owner: &str, repo: &str, body: &GitCreateCommitRequest ) -> Result<Response<GitCommit>, ClientError>

Create a commit.

This function performs a POST to the /repos/{owner}/{repo}/git/commits endpoint.

Creates a new Git commit object.

Signature verification object

The response will include a verification object that describes the result of verifying the commit’s signature. The following fields are included in the verification object:

NameTypeDescription
verifiedbooleanIndicates whether GitHub considers the signature in this commit to be verified.
reasonstringThe reason for verified value. Possible values and their meanings are enumerated in table below.
signaturestringThe signature that was extracted from the commit.
payloadstringThe value that was signed.

These are the possible values for reason in the verification object:

ValueDescription
expired_keyThe key that made the signature is expired.
not_signing_keyThe “signing” flag is not among the usage flags in the GPG key that made the signature.
gpgverify_errorThere was an error communicating with the signature verification service.
gpgverify_unavailableThe signature verification service is currently unavailable.
unsignedThe object does not include a signature.
unknown_signature_typeA non-PGP signature was found in the commit.
no_userNo user was associated with the committer email address in the commit.
unverified_emailThe committer email address in the commit was associated with a user, but the email address is not verified on her/his account.
bad_emailThe committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_keyThe key that made the signature has not been registered with any user’s account.
malformed_signatureThere was an error parsing the signature.
invalidThe signature could not be cryptographically verified using the key whose key-id was found in the signature.
validNone of the above errors applied, so the signature is considered to be verified.

FROM: https://docs.github.com/rest/reference/git#create-a-commit

Parameters:

  • owner: &str
  • repo: &str
source

pub async fn get_commit( &self, owner: &str, repo: &str, commit_sha: &str ) -> Result<Response<GitCommit>, ClientError>

Get a commit.

This function performs a GET to the /repos/{owner}/{repo}/git/commits/{commit_sha} endpoint.

Gets a Git commit object.

Signature verification object

The response will include a verification object that describes the result of verifying the commit’s signature. The following fields are included in the verification object:

NameTypeDescription
verifiedbooleanIndicates whether GitHub considers the signature in this commit to be verified.
reasonstringThe reason for verified value. Possible values and their meanings are enumerated in table below.
signaturestringThe signature that was extracted from the commit.
payloadstringThe value that was signed.

These are the possible values for reason in the verification object:

ValueDescription
expired_keyThe key that made the signature is expired.
not_signing_keyThe “signing” flag is not among the usage flags in the GPG key that made the signature.
gpgverify_errorThere was an error communicating with the signature verification service.
gpgverify_unavailableThe signature verification service is currently unavailable.
unsignedThe object does not include a signature.
unknown_signature_typeA non-PGP signature was found in the commit.
no_userNo user was associated with the committer email address in the commit.
unverified_emailThe committer email address in the commit was associated with a user, but the email address is not verified on her/his account.
bad_emailThe committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_keyThe key that made the signature has not been registered with any user’s account.
malformed_signatureThere was an error parsing the signature.
invalidThe signature could not be cryptographically verified using the key whose key-id was found in the signature.
validNone of the above errors applied, so the signature is considered to be verified.

FROM: https://docs.github.com/rest/reference/git#get-a-commit

Parameters:

  • owner: &str
  • repo: &str
  • commit_sha: &str – commit_sha parameter.
source

pub async fn list_matching_refs( &self, owner: &str, repo: &str, ref_: &str, per_page: i64, page: i64 ) -> Result<Response<Vec<GitRef>>, ClientError>

List matching references.

This function performs a GET to the /repos/{owner}/{repo}/git/matching-refs/{ref} endpoint.

Returns an array of references from your Git database that match the supplied name. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn’t exist in the repository, but existing refs start with :ref, they will be returned as an array.

When you use this endpoint without providing a :ref, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just heads and tags.

Note: You need to explicitly request a pull request to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see “Checking mergeability of pull requests”.

If you request matching references for a branch named feature but the branch feature doesn’t exist, the response can still include other matching head refs that start with the word feature, such as featureA and featureB.

FROM: https://docs.github.com/rest/reference/git#list-matching-references

Parameters:

  • owner: &str
  • repo: &str
  • ref_: &str – ref parameter.
  • per_page: i64 – Results per page (max 100).
  • page: i64 – Page number of the results to fetch.
source

pub async fn list_all_matching_refs( &self, owner: &str, repo: &str, ref_: &str ) -> Result<Response<Vec<GitRef>>, ClientError>

List matching references.

This function performs a GET to the /repos/{owner}/{repo}/git/matching-refs/{ref} endpoint.

As opposed to list_matching_refs, this function returns all the pages of the request at once.

Returns an array of references from your Git database that match the supplied name. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn’t exist in the repository, but existing refs start with :ref, they will be returned as an array.

When you use this endpoint without providing a :ref, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just heads and tags.

Note: You need to explicitly request a pull request to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see “Checking mergeability of pull requests”.

If you request matching references for a branch named feature but the branch feature doesn’t exist, the response can still include other matching head refs that start with the word feature, such as featureA and featureB.

FROM: https://docs.github.com/rest/reference/git#list-matching-references

source

pub async fn get_ref( &self, owner: &str, repo: &str, ref_: &str ) -> Result<Response<GitRef>, ClientError>

Get a reference.

This function performs a GET to the /repos/{owner}/{repo}/git/ref/{ref} endpoint.

Returns a single reference from your Git database. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn’t match an existing ref, a 404 is returned.

Note: You need to explicitly request a pull request to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see “Checking mergeability of pull requests”.

FROM: https://docs.github.com/rest/reference/git#get-a-reference

Parameters:

  • owner: &str
  • repo: &str
  • ref_: &str – ref parameter.
source

pub async fn create_ref( &self, owner: &str, repo: &str, body: &GitCreateRefRequest ) -> Result<Response<GitRef>, ClientError>

Create a reference.

This function performs a POST to the /repos/{owner}/{repo}/git/refs endpoint.

Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.

FROM: https://docs.github.com/rest/reference/git#create-a-reference

Parameters:

  • owner: &str
  • repo: &str
source

pub async fn delete_ref( &self, owner: &str, repo: &str, ref_: &str ) -> Result<Response<()>, ClientError>

Delete a reference.

This function performs a DELETE to the /repos/{owner}/{repo}/git/refs/{ref} endpoint.

FROM: https://docs.github.com/rest/reference/git#delete-a-reference

Parameters:

  • owner: &str
  • repo: &str
  • ref_: &str – ref parameter.
source

pub async fn update_ref( &self, owner: &str, repo: &str, ref_: &str, body: &GitUpdateRefRequest ) -> Result<Response<GitRef>, ClientError>

Update a reference.

This function performs a PATCH to the /repos/{owner}/{repo}/git/refs/{ref} endpoint.

FROM: https://docs.github.com/rest/reference/git#update-a-reference

Parameters:

  • owner: &str
  • repo: &str
  • ref_: &str – ref parameter.
source

pub async fn create_tag( &self, owner: &str, repo: &str, body: &GitCreateTagRequest ) -> Result<Response<GitTag>, ClientError>

Create a tag object.

This function performs a POST to the /repos/{owner}/{repo}/git/tags endpoint.

Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary.

Signature verification object

The response will include a verification object that describes the result of verifying the commit’s signature. The following fields are included in the verification object:

NameTypeDescription
verifiedbooleanIndicates whether GitHub considers the signature in this commit to be verified.
reasonstringThe reason for verified value. Possible values and their meanings are enumerated in table below.
signaturestringThe signature that was extracted from the commit.
payloadstringThe value that was signed.

These are the possible values for reason in the verification object:

ValueDescription
expired_keyThe key that made the signature is expired.
not_signing_keyThe “signing” flag is not among the usage flags in the GPG key that made the signature.
gpgverify_errorThere was an error communicating with the signature verification service.
gpgverify_unavailableThe signature verification service is currently unavailable.
unsignedThe object does not include a signature.
unknown_signature_typeA non-PGP signature was found in the commit.
no_userNo user was associated with the committer email address in the commit.
unverified_emailThe committer email address in the commit was associated with a user, but the email address is not verified on her/his account.
bad_emailThe committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_keyThe key that made the signature has not been registered with any user’s account.
malformed_signatureThere was an error parsing the signature.
invalidThe signature could not be cryptographically verified using the key whose key-id was found in the signature.
validNone of the above errors applied, so the signature is considered to be verified.

FROM: https://docs.github.com/rest/reference/git#create-a-tag-object

Parameters:

  • owner: &str
  • repo: &str
source

pub async fn get_tag( &self, owner: &str, repo: &str, tag_sha: &str ) -> Result<Response<GitTag>, ClientError>

Get a tag.

This function performs a GET to the /repos/{owner}/{repo}/git/tags/{tag_sha} endpoint.

Signature verification object

The response will include a verification object that describes the result of verifying the commit’s signature. The following fields are included in the verification object:

NameTypeDescription
verifiedbooleanIndicates whether GitHub considers the signature in this commit to be verified.
reasonstringThe reason for verified value. Possible values and their meanings are enumerated in table below.
signaturestringThe signature that was extracted from the commit.
payloadstringThe value that was signed.

These are the possible values for reason in the verification object:

ValueDescription
expired_keyThe key that made the signature is expired.
not_signing_keyThe “signing” flag is not among the usage flags in the GPG key that made the signature.
gpgverify_errorThere was an error communicating with the signature verification service.
gpgverify_unavailableThe signature verification service is currently unavailable.
unsignedThe object does not include a signature.
unknown_signature_typeA non-PGP signature was found in the commit.
no_userNo user was associated with the committer email address in the commit.
unverified_emailThe committer email address in the commit was associated with a user, but the email address is not verified on her/his account.
bad_emailThe committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_keyThe key that made the signature has not been registered with any user’s account.
malformed_signatureThere was an error parsing the signature.
invalidThe signature could not be cryptographically verified using the key whose key-id was found in the signature.
validNone of the above errors applied, so the signature is considered to be verified.

FROM: https://docs.github.com/rest/reference/git#get-a-tag

Parameters:

  • owner: &str
  • repo: &str
  • tag_sha: &str
source

pub async fn create_tree( &self, owner: &str, repo: &str, body: &GitCreateTreeRequestData ) -> Result<Response<GitTreeData>, ClientError>

Create a tree.

This function performs a POST to the /repos/{owner}/{repo}/git/trees endpoint.

The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.

If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see “Create a commit” and “Update a reference.”

FROM: https://docs.github.com/rest/reference/git#create-a-tree

Parameters:

  • owner: &str
  • repo: &str
source

pub async fn get_tree( &self, owner: &str, repo: &str, tree_sha: &str, recursive: &str ) -> Result<Response<GitTreeData>, ClientError>

Get a tree.

This function performs a GET to the /repos/{owner}/{repo}/git/trees/{tree_sha} endpoint.

Returns a single tree using the SHA1 value for that tree.

If truncated is true in the response then the number of items in the tree array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time.

FROM: https://docs.github.com/rest/reference/git#get-a-tree

Parameters:

  • owner: &str
  • repo: &str
  • tree_sha: &str
  • recursive: &str – Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in :tree_sha. For example, setting recursive to any of the following will enable returning objects or subtrees: 0, 1, "true", and "false". Omit this parameter to prevent recursively returning objects or subtrees.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Git

§

impl Send for Git

§

impl Sync for Git

§

impl Unpin for Git

§

impl !UnwindSafe for Git

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more