syntax = "proto3";

package rpc;

import "events_resend.proto";
import "fixtures.proto";
import "listen.proto";
import "login.proto";
import "login_status.proto";
import "logs_tail.proto";
import "sample_configs.proto";
import "sample_create.proto";
import "samples_list.proto";
import "trigger.proto";
import "triggers_list.proto";
import "version.proto";
import "webhook_endpoint_create.proto";
import "webhook_endpoints_list.proto";

option go_package = "github.com/stripe/stripe-cli/rpc";

service StripeCLI {
  // Resend an event given an event ID. Like `stripe events resend`.
  rpc EventsResend(EventsResendRequest) returns (EventsResendResponse);

  // Retrieve the default fixture of given triggering event.
  rpc Fixture(FixtureRequest) returns (FixtureResponse);

  // Receive webhook events from the Stripe API to your local machine. Like `stripe listen`.
  rpc Listen(ListenRequest) returns (stream ListenResponse);

  // Get a link to log in to the Stripe CLI. The client will have to open the browser to complete
  // the login. Use `LoginStatus` after this method to wait for success. Like `stripe login`.
  rpc Login(LoginRequest) returns (LoginResponse);

  // Successfully returns when login has succeeded, or returns an error if login has failed or timed
  // out. Use this method after `Login` to check for success.
  rpc LoginStatus(LoginStatusRequest) returns (LoginStatusResponse);

  // Get a realtime stream of API logs. Like `stripe logs tail`.
  rpc LogsTail(LogsTailRequest) returns (stream LogsTailResponse);

  // Get a list of available configs for a given Stripe sample.
  rpc SampleConfigs(SampleConfigsRequest) returns (SampleConfigsResponse);

  // Clone a Stripe sample. Like `stripe samples create`.
  rpc SampleCreate(SampleCreateRequest) returns (SampleCreateResponse);

  // Get a list of available Stripe samples. Like `stripe samples list`.
  rpc SamplesList(SamplesListRequest) returns (SamplesListResponse);

  // Trigger a webhook event. Like `stripe trigger`.
  rpc Trigger(TriggerRequest) returns (TriggerResponse);

  // Get a list of supported events for `Trigger`.
  rpc TriggersList(TriggersListRequest) returns (TriggersListResponse);

  // Get the version of the Stripe CLI. Like `stripe version`.
  rpc Version(VersionRequest) returns (VersionResponse);

  // Create a new webhook endpoint
  rpc WebhookEndpointCreate(WebhookEndpointCreateRequest) returns (WebhookEndpointCreateResponse);

  // Get the list of webhook endpoints.
  rpc WebhookEndpointsList(WebhookEndpointsListRequest) returns (WebhookEndpointsListResponse);
}
