# AUTO-GENERATED FILE - DO NOT EDIT # This file was automatically generated by the XDK build tool. # Any manual changes will be overwritten on the next generation. defmodule Xdk.CommunityNotes do @moduledoc "Auto-generated client for community notes operations" @doc """ Delete a Community Note DELETE /2/notes/{id} Deletes a community note. """ @spec delete(Xdk.t(), id :: String.t()) :: {:ok, map()} | {:error, Xdk.Errors.error()} def delete(client, id) do Xdk.request(client, :delete, "/2/notes/{id}", params: %{ "id" => id } ) end @doc """ Search for Community Notes Written GET /2/notes/search/notes_written Returns all the community notes written by the user. """ @spec search_written(Xdk.t(), opts :: keyword()) :: {:ok, map()} | {:error, Xdk.Errors.error()} def search_written(client, opts \\ []) do query = [ {"test_mode", Keyword.get(opts, :test_mode)}, {"pagination_token", Keyword.get(opts, :pagination_token)}, {"max_results", Keyword.get(opts, :max_results)}, {"note.fields", Keyword.get(opts, :note_fields)} ] |> Xdk.Query.build() Xdk.request(client, :get, "/2/notes/search/notes_written", query: query) end @doc """ Evaluate a Community Note POST /2/evaluate_note Endpoint to evaluate a community note. """ @spec evaluate(Xdk.t(), body :: map()) :: {:ok, map()} | {:error, Xdk.Errors.error()} def evaluate(client, body) do Xdk.request(client, :post, "/2/evaluate_note", json: body) end @doc """ Create a Community Note POST /2/notes Creates a community note endpoint for LLM use case. """ @spec create(Xdk.t(), body :: map()) :: {:ok, map()} | {:error, Xdk.Errors.error()} def create(client, body) do Xdk.request(client, :post, "/2/notes", json: body) end @doc """ Search for Posts Eligible for Community Notes GET /2/notes/search/posts_eligible_for_notes Returns all the posts that are eligible for community notes. """ @spec search_eligible_posts(Xdk.t(), opts :: keyword()) :: {:ok, map()} | {:error, Xdk.Errors.error()} def search_eligible_posts(client, opts \\ []) do query = [ {"test_mode", Keyword.get(opts, :test_mode)}, {"pagination_token", Keyword.get(opts, :pagination_token)}, {"max_results", Keyword.get(opts, :max_results)}, {"post_selection", Keyword.get(opts, :post_selection)}, {"tweet.fields", Keyword.get(opts, :tweet_fields)}, {"expansions", Keyword.get(opts, :expansions)}, {"media.fields", Keyword.get(opts, :media_fields)}, {"poll.fields", Keyword.get(opts, :poll_fields)}, {"user.fields", Keyword.get(opts, :user_fields)}, {"place.fields", Keyword.get(opts, :place_fields)} ] |> Xdk.Query.build() Xdk.request(client, :get, "/2/notes/search/posts_eligible_for_notes", query: query) end end