syntax = "proto3";

package devvit.data.api.admin.v1alpha;

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/data/api/admin/v1alpha";

message AccessToken {
  string id = 1;
  string organization_id = 2;
  google.protobuf.Timestamp created_at = 3;
  google.protobuf.Timestamp expires_at = 4;
  bool is_revoked = 5;
}

message CreateAccessTokenRequest {
  string organization_name = 1;
  google.protobuf.Duration expires_in = 2;
}

message CreateAccessTokenResponse {
  string token = 1;
  google.protobuf.Timestamp expires_at = 2;
  string token_id = 3;
}

message GetAccessTokenByIdRequest {
  string id = 1;
}

message GetAccessTokenByIdResponse {
  AccessToken token = 1;
}

message GetAccessTokensByOrganizationNameRequest {
  string organization_name = 1;
}

message GetAccessTokensByOrganizationNameResponse {
  repeated AccessToken tokens = 1;
}

message RevokeAccessTokenByIdRequest {
  string token_id = 1;
}

message RevokeAccessTokenByIdResponse {}
