Skip to content

Code match #1024

Closed
Closed

Description

@QuentinRa

Hi, thanks for your wrapper of GitHub API! We can search code using

$files = $client->api('search')->code('@todo language:php');

But, could you add a function to get the matched code, as explained in the official documentation? This would be a copy of code. It may be better to add another argument (rather than creating a new function, up to you), but this code is working for me (inside Search.php)

public function code_match($q, $sort = 'updated', $order = 'desc')
{
    $this->acceptHeaderValue = 'application/vnd.github.v3.text-match+json';
    return $this->get('/search/code', ['q' => $q, 'sort' => $sort, 'order' => $order]);
}

Activity

  1. acrobat commented on Oct 2, 2021

    @acrobat
    Collaborator

    Hi @QuentinRa, that would be a feature we can support. Feel free to open a PR to add the functionality!

  2. added
    good first issue
    on Oct 2, 2021
  3. added a commit that references this issue on Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions