summaryrefslogtreecommitdiff
path: root/api/nicolaspl/clawflake/generator/v3/generator.proto
blob: ce41d8518b1a1c2bcdf12e8428b2075718f58680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
syntax = "proto3";

package nicolaspl.clawflake.generator.v3;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";

option csharp_namespace = "NicolasPl.Clawflake.Generator.V3";
option go_package = "go.nicolaspl.com/clawflake/api/nc0/clawflake/generator/v3";
option java_package = "com.nicolaspl.clawflake.generator.v3";
option java_multiple_files = true;
option java_outer_classname = "GeneratorProto";

// The generator service allows requesting a new ID.
service GeneratorService {
  // Generate ID numbers.
  rpc Generate(GenerateRequest) returns (GenerateResponse) {
    option (google.api.http) = {
      post: "/v3/ids:generate"
      body: "*"
    };
    option (google.api.method_signature) = "amount";
  }
}

// The request of a Generate RPC.
message GenerateRequest {
  // The amount of ID numbers to generate.
  // The value should be in the interval [1, 4096].
  // Values not in the interval will not be coerced and the request will be
  // aborted.
  uint32 amount = 1 [(google.api.field_behavior) = REQUIRED];
}

// The response of a Generate RPC.
message GenerateResponse {
  // The generate ID numbers.
  repeated string id_numbers = 1 [(google.api.field_behavior) = UNORDERED_LIST];
}