Skip to content

Code match #1024

@QuentinRa

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]);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions