Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-cloned / node_modules / @grpc / grpc-js / build / src / status-builder.js
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 /**
4  * A builder for gRPC status objects.
5  */
6 class StatusBuilder {
7     constructor() {
8         this.code = null;
9         this.details = null;
10         this.metadata = null;
11     }
12     /**
13      * Adds a status code to the builder.
14      */
15     withCode(code) {
16         this.code = code;
17         return this;
18     }
19     /**
20      * Adds details to the builder.
21      */
22     withDetails(details) {
23         this.details = details;
24         return this;
25     }
26     /**
27      * Adds metadata to the builder.
28      */
29     withMetadata(metadata) {
30         this.metadata = metadata;
31         return this;
32     }
33     /**
34      * Builds the status object.
35      */
36     build() {
37         const status = {};
38         if (this.code !== null) {
39             status.code = this.code;
40         }
41         if (this.details !== null) {
42             status.details = this.details;
43         }
44         if (this.metadata !== null) {
45             status.metadata = this.metadata;
46         }
47         return status;
48     }
49 }
50 exports.StatusBuilder = StatusBuilder;
51 //# sourceMappingURL=status-builder.js.map