Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsc-elixir

A dependency-free Elixir REST client SDK for the read-only Google Search Console capabilities already reviewed by gkit.

The package uses OTP's :httpc and :json without Hex dependencies. It requires Elixir 1.17 or newer and Erlang/OTP 27 or newer.

The bearer token needs the https://www.googleapis.com/auth/webmasters.readonly OAuth scope and access to the property being queried.

Use it as a Git dependency until a Hex release is deliberately published:

{:gsc_elixir, git: "https://github.com/celados/gsc-elixir.git"}

Scope

  • Lists Search Console properties accessible to an OAuth bearer token.
  • Queries Search Analytics without hiding Google's provider-native JSON.
  • Lists and reads sitemaps.
  • Reads URL Inspection results.
  • Returns decoded responses and structured GoogleSearchConsole.Error values.
  • Allows the HTTP adapter to be replaced for tests or a future Gesso host.
  • Does not acquire or refresh OAuth tokens, paginate automatically, perform writes, or interpret provider evidence.

Usage

{:ok, client} =
  GoogleSearchConsole.new(
    access_token: System.fetch_env!("GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN")
  )

{:ok, response} =
  GoogleSearchConsole.Client.query_search_analytics(
    client,
    "sc-domain:example.com",
    %{
      "startDate" => "2026-08-01",
      "endDate" => "2026-08-07",
      "dimensions" => ["query"],
      "rowLimit" => 1_000
    }
  )

The public read surface is:

GoogleSearchConsole.Client.list_properties(client)
GoogleSearchConsole.Client.get_property(client, site_url)
GoogleSearchConsole.Client.query_search_analytics(client, site_url, query)
GoogleSearchConsole.Client.list_sitemaps(client, site_url)
GoogleSearchConsole.Client.get_sitemap(client, site_url, feedpath)
GoogleSearchConsole.Client.inspect_url(client, site_url, inspection_url)

Pass http_client: MyAdapter to GoogleSearchConsole.new/1 to use a module implementing GoogleSearchConsole.HTTP.request/5.

A future Gesso Provider should depend on this package and expose purpose-built Gesso capabilities that call these client methods. The HTTP adapter remains a transport/test seam; it is not a substitute for Gesso's capability, secret, and result contracts. This repository deliberately does not bind itself to a host runtime.

All methods accept adapter-specific options as their final argument. The built-in adapter reads ordinary :httpc options from http_options: [...] while keeping certificate verification, SNI, hostname checks, and redirect protection fixed.

Development

mix format --check-formatted
mix test

Publication

The package has not been published to Hex. Use this Git checkout until publication and Gesso integration are deliberately requested.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages