How to use the google-protobuf/google/protobuf/duration_pb.Duration function in google-protobuf

To help you get started, we’ve selected a few google-protobuf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johanbrandhorst / grpc-web-compatibility-test / frontend / grpcweb / src / index.ts View on Github external
function makeServerStreamingEchoRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEcho(req, {});
  srv.on("data", function(msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("error", function(err: grpcWeb.Error) {
    console.log("Server stream errored!");
    console.log("Error:", err.message);
    console.log("Code:", err.code);
  });
  srv.on("end", function() {
    console.log("Server stream finished");
  });
github johanbrandhorst / grpc-web-compatibility-test / frontend / improbable / src / index.ts View on Github external
function makeServerStreamingEchoAbortRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEchoAbort(req);
  srv.on("data", function (msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("end", function () {
    console.log("Server stream finished");
  });
  srv.on("status", function (status: Status) {
    if (status.code != grpc.Code.OK) {
      console.log("Got streaming error (as expected)");
      console.log("Error:", status.details);
      console.log("Code:", status.code);
github improbable-eng / ts-protoc-gen / test / integration / wellKnownTypes.ts View on Github external
it("should allow setting and getting a Duration field", () => {
    const msg = new WellKnownMessage();
    const myDuration = new Duration();
    myDuration.setSeconds(1000);
    msg.setMyDuration(myDuration);
    assert.strictEqual(msg.getMyDuration()!.getSeconds() as number, 1000);
  });
github johanbrandhorst / grpc-web-compatibility-test / frontend / grpcweb / src / index.ts View on Github external
function makeServerStreamingEchoAbortRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEchoAbort(req, {});
  srv.on("data", function(msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("error", function(err: grpcWeb.Error) {
    console.log("Server stream errored (as expected)");
    console.log("Error:", err.message);
    console.log("Code:", err.code);
  });
  srv.on("end", function() {
    console.log("Server stream finished");
  });
github johanbrandhorst / grpc-web-compatibility-test / frontend / improbable-ws / src / index.ts View on Github external
function makeServerStreamingEchoRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEcho(req);
  srv.on("data", function(msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("end", function() {
    console.log("Server stream finished");
  });
  srv.on("status", function(status: Status) {
    if (status.code != grpc.Code.OK) {
      console.log("Got streaming error");
      console.log("Error:", status.details);
      console.log("Code:", status.code);
github johanbrandhorst / grpc-web-compatibility-test / frontend / improbable-ws / src / index.ts View on Github external
function makeServerStreamingEchoAbortRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEchoAbort(req);
  srv.on("data", function(msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("end", function() {
    console.log("Server stream finished");
  });
  srv.on("status", function(status: Status) {
    if (status.code != grpc.Code.OK) {
      console.log("Got streaming error (as expected)");
      console.log("Error:", status.details);
      console.log("Code:", status.code);
github johanbrandhorst / grpc-web-compatibility-test / frontend / improbable / src / index.ts View on Github external
function makeServerStreamingEchoRequest() {
  const req = new ServerStreamingEchoRequest();
  req.setMessageCount(5);
  var interval = new Duration();
  interval.setSeconds(1);
  req.setMessageInterval(interval);
  req.setMessage("test");
  const srv = client.serverStreamingEcho(req);
  srv.on("data", function (msg: ServerStreamingEchoResponse) {
    console.log("Streaming success");
    console.log("Message:", msg.getMessage());
  });
  srv.on("end", function () {
    console.log("Server stream finished");
  });
  srv.on("status", function (status: Status) {
    if (status.code != grpc.Code.OK) {
      console.log("Got streaming error");
      console.log("Error:", status.details);
      console.log("Code:", status.code);
github caos / zitadel / console / src / app / pages / projects / apps / app-detail / app-detail.component.ts View on Github external
const req = new OIDCConfigUpdate();
                req.setProjectId(this.projectId);
                req.setApplicationId(this.app.id);
                req.setRedirectUrisList(this.app.oidcConfig.redirectUrisList);
                req.setResponseTypesList(this.app.oidcConfig.responseTypesList);
                req.setAuthMethodType(this.app.oidcConfig.authMethodType);
                req.setPostLogoutRedirectUrisList(this.app.oidcConfig.postLogoutRedirectUrisList);
                req.setGrantTypesList(this.app.oidcConfig.grantTypesList);
                req.setApplicationType(this.app.oidcConfig.applicationType);
                req.setDevMode(this.app.oidcConfig.devMode);
                req.setAccessTokenType(this.app.oidcConfig.accessTokenType);
                req.setAccessTokenRoleAssertion(this.app.oidcConfig.accessTokenRoleAssertion);
                req.setIdTokenRoleAssertion(this.app.oidcConfig.idTokenRoleAssertion);
                req.setIdTokenUserinfoAssertion(this.app.oidcConfig.idTokenUserinfoAssertion);
                if (this.clockSkewSeconds?.value) {
                    const dur = new Duration();
                    dur.setSeconds(Math.floor(this.clockSkewSeconds?.value));
                    dur.setNanos((Math.floor(this.clockSkewSeconds?.value % 1) * 10000));
                    req.setClockSkew(dur);
                }
                this.mgmtService
                    .UpdateOIDCAppConfig(req)
                    .then(() => {
                        if (this.app.oidcConfig) {
                            this.currentAuthMethod = this.authMethodFromPartialConfig(this.app.oidcConfig);
                        }
                        this.toast.showInfo('APP.TOAST.OIDCUPDATED', true);
                    })
                    .catch(error => {
                        this.toast.showError(error);
                    });
            }
github caos / zitadel / console / src / app / pages / projects / apps / app-detail / app-detail.component.ts View on Github external
const req = new UpdateOIDCAppConfigRequest();
                req.setProjectId(this.projectId);
                req.setAppId(this.app.id);
                req.setRedirectUrisList(this.app.oidcConfig.redirectUrisList);
                req.setResponseTypesList(this.app.oidcConfig.responseTypesList);
                req.setAuthMethodType(this.app.oidcConfig.authMethodType);
                req.setPostLogoutRedirectUrisList(this.app.oidcConfig.postLogoutRedirectUrisList);
                req.setGrantTypesList(this.app.oidcConfig.grantTypesList);
                req.setAppType(this.app.oidcConfig.appType);
                req.setDevMode(this.app.oidcConfig.devMode);
                req.setAccessTokenType(this.app.oidcConfig.accessTokenType);
                req.setAccessTokenRoleAssertion(this.app.oidcConfig.accessTokenRoleAssertion);
                req.setIdTokenRoleAssertion(this.app.oidcConfig.idTokenRoleAssertion);
                req.setIdTokenUserinfoAssertion(this.app.oidcConfig.idTokenUserinfoAssertion);
                if (this.clockSkewSeconds?.value) {
                    const dur = new Duration();
                    dur.setSeconds(Math.floor(this.clockSkewSeconds?.value));
                    dur.setNanos((Math.floor(this.clockSkewSeconds?.value % 1) * 10000));
                    req.setClockSkew(dur);
                }
                this.mgmtService
                    .updateOIDCAppConfig(req)
                    .then(() => {
                        if (this.app.oidcConfig) {
                            const config = { oidc: this.app.oidcConfig };
                            this.currentAuthMethod = this.authMethodFromPartialConfig(config);
                        }
                        this.toast.showInfo('APP.TOAST.OIDCUPDATED', true);
                    })
                    .catch(error => {
                        this.toast.showError(error);
                    });