当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fetcher.getJSON函数代码示例

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


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

示例1: async

const readComplianceDataTypes = async (): Promise<Array<IComplianceDataType>> => {
  const { complianceDataTypes = [] } = await getJSON<IComplianceDataTypeResponse>({
    url: complianceDataTypesUrl
  });

  return complianceDataTypes;
};
开发者ID:linwenxue,项目名称:WhereHows,代码行数:7,代码来源:compliance-datatypes.ts

示例2: async

const readDatasetView = async (id: number): Promise<IDatasetView> => {
  const { status, dataset } = await getJSON<IDatasetViewGetResponse>({ url: datasetViewUrlById(id) });

  if (status === ApiStatus.OK && dataset) {
    return dataset;
  }

  throw new Error(datasetApiException);
};
开发者ID:linwenxue,项目名称:WhereHows,代码行数:9,代码来源:dataset.ts

示例3: async

const readDatasetRetentionByUrn = async (urn: string): Promise<IGetDatasetRetentionResponse | null> => {
  try {
    return await getJSON<IGetDatasetRetentionResponse>({ url: datasetRetentionUrlByUrn(urn) });
  } catch (e) {
    if (isNotFoundApiError(e)) {
      return null;
    }

    throw e;
  }
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:11,代码来源:retention.ts

示例4: async

export const readDatasetHealthByUrn = async (urn: string): Promise<IDatasetHealth> => {
  const defaultResponse = { score: 0, validations: [] };

  try {
    const { health } = await getJSON<IHealthScoreResponse>({ url: datasetHealthUrlByUrn(urn) });

    return health;
  } catch {
    return defaultResponse;
  }
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:11,代码来源:health.ts

示例5: async

const readDatasetSchemaComments = async (datasetId: number, columnId: number): Promise<Array<IDatasetComment>> => {
  const defaultData: { comments: Array<IDatasetComment> } = { comments: [] };
  const { status, data: { comments = [] } = defaultData } = await getJSON<IDatasetCommentsGetResponse>({
    url: datasetSchemaCommentUrlById(datasetId, columnId)
  });

  if (status === ApiStatus.OK) {
    return comments;
  }

  throw new Error('');
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:12,代码来源:schema-comments.ts

示例6: async

const readComplianceDataTypes = async (): Promise<Array<IComplianceDataType>> => {
  let complianceDataTypes: Array<IComplianceDataType> = [];

  try {
    ({ complianceDataTypes = [] } = await getJSON<IComplianceDataTypeResponse>({
      url: complianceDataTypesUrl
    }));
  } catch {
    //no-op
  }

  return complianceDataTypes;
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:13,代码来源:compliance-datatypes.ts

示例7: async

const readDatasetAcls = async (urn: string): Promise<Array<IAccessControlEntry>> => {
  let acls: Array<IAccessControlEntry> = [];

  try {
    return getJSON<IGetAclsResponse>({ url: datasetAclsUrlByUrn(urn) });
  } catch (e) {
    if (isNotFoundApiError(e)) {
      return acls;
    }

    throw e;
  }
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:13,代码来源:acl-access.ts

示例8: async

const readDatasetSchemaByUrn = async (urn: string): Promise<IDatasetSchema> => {
  let schema: IDatasetSchema;

  try {
    ({ schema } = await getJSON<IDatasetSchemaGetResponse>({ url: datasetSchemaUrlByUrn(urn) }));
  } catch {
    return {
      schemaless: false,
      rawSchema: null,
      keySchema: null,
      columns: []
    };
  }

  return schema;
};
开发者ID:alyiwang,项目名称:WhereHows,代码行数:16,代码来源:schema.ts


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