• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript web-request.json函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中web-request.json函数的典型用法代码示例。如果您正苦于以下问题:TypeScript json函数的具体用法?TypeScript json怎么用?TypeScript json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了json函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: init

  async init(investor: Investor): Promise<KycInitResult> {
    const id = investor.id.toHexString();
    const hash = base64encode(bcrypt.hashSync(id + config.kyc.apiSecret));

    const kycOptions = {
      baseUrl: this.baseUrl,
      method: 'POST',
      auth: {
        user: this.apiToken,
        password: this.apiSecret
      },
      headers: {
        'User-Agent': 'JINCOR ICO/1.0.0'
      },
      body: {
        merchantIdScanReference: uuid.v4(),
        successUrl: `${ config.app.apiUrl }/kyc/uploaded/${ id }/${ hash }`,
        errorUrl: `${ config.app.frontendUrl }/dashboard/verification/failure`,
        callbackUrl: `${ config.app.apiUrl }/kyc/callback`,
        customerId: investor.email,
        authorizationTokenLifetime: this.defaultTokenLifetime
      }
    };

    return await request.json<KycInitResult>('/initiateNetverify', kycOptions);
  }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:26,代码来源:kyc.client.ts


示例2: validateVerification

  async validateVerification(method: string, id: string, input: ValidateVerificationInput): Promise<ValidationResult> {
    try {
      return await request.json<ValidationResult>(`/methods/${ method }/verifiers/${ id }/actions/validate`, {
        baseUrl: this.baseUrl,
        auth: {
          bearer: this.tenantToken
        },
        method: 'POST',
        body: input
      });
    } catch (e) {
      if (e.statusCode === 422) {
        if (e.response.body.data.attempts >= config.verify.maxAttempts) {
          await this.invalidateVerification(method, id);
          throw new MaxVerificationsAttemptsReached('You have used all attempts to enter code');
        }

        throw new NotCorrectVerificationCode('Not correct code');
      }

      if (e.statusCode === 404) {
        throw new VerificationIsNotFound('Code was expired or not found. Please retry');
      }

      throw e;
    }
  }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:27,代码来源:verify.client.ts


示例3: resolve

 return new Promise<LandingsdataByLandingdate[]>((resolve, reject) => {
     const url = (window.location.origin + '/api/landingsdata');
     WebRequest.json<LandingsdataResponse>(url + params)
         .then(response => {
             resolve(transformLandingsdatoReponse(response))
         })
         .catch(rejection => reject(rejection));
 });
开发者ID:computerlove,项目名称:Fiskeoversikt,代码行数:8,代码来源:server.ts


示例4: deleteUser

 async deleteUser(login: string): Promise<void> {
   return await request.json<void>(`/user/${ login }`, {
     baseUrl: this.baseUrl,
     method: 'DELETE',
     headers: {
       'authorization': `Bearer ${ this.tenantToken }`
     }
   });
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:9,代码来源:auth.client.ts


示例5: logoutTenant

 async logoutTenant(token: string): Promise<void> {
   await request.json<TenantVerificationResult>('/tenant/logout', {
     baseUrl: this.baseUrl,
     method: 'POST',
     body: {
       token
     }
   });
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:9,代码来源:auth.client.ts


示例6: verifyTenantToken

 async verifyTenantToken(token: string): Promise<TenantVerificationResult> {
   return (await request.json<TenantVerificationResponse>('/tenant/verify', {
     baseUrl: this.baseUrl,
     method: 'POST',
     body: {
       token
     }
   })).decoded;
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:9,代码来源:auth.client.ts


示例7: invalidateVerification

 async invalidateVerification(method: string, id: string): Promise<void> {
   await request.json<Result>(`/methods/${ method }/verifiers/${ id }`, {
     baseUrl: this.baseUrl,
     auth: {
       bearer: this.tenantToken
     },
     method: 'DELETE'
   });
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:9,代码来源:verify.client.ts


示例8: verifyUserToken

 async verifyUserToken(token: string): Promise<UserVerificationResult> {
   return (await request.json<UserVerificationResponse>('/auth/verify', {
     baseUrl: this.baseUrl,
     method: 'POST',
     headers: {
       'authorization': `Bearer ${ this.tenantToken }`
     },
     body: { token }
   })).decoded;
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:10,代码来源:auth.client.ts


示例9: loginUser

 async loginUser(data: UserLoginData): Promise<AccessTokenResponse> {
   return await request.json<AccessTokenResponse>('/auth', {
     baseUrl: this.baseUrl,
     method: 'POST',
     headers: {
       'authorization': `Bearer ${ this.tenantToken }`
     },
     body: data
   });
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:10,代码来源:auth.client.ts


示例10: loginTenant

 async loginTenant(email: string, password: string): Promise<AccessTokenResponse> {
   return await request.json<AccessTokenResponse>('/tenant/login', {
     baseUrl: this.baseUrl,
     method: 'POST',
     body: {
       email,
       password
     }
   });
 }
开发者ID:Norestlabs-Mariya,项目名称:backend-ico-dashboard,代码行数:10,代码来源:auth.client.ts



注:本文中的web-request.json函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript web-stream-tools.concatStream函数代码示例发布时间:2022-05-25
下一篇:
TypeScript web-push.sendNotification函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap