當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。