PageSourceSearch

https://kuramore.jp/trend/js/components/api.js

js kuramore.jp collected 2026-10-04 13:25:50 UTC 5,226 bytes, 160 lines download raw bytes

1/**
2 * 都道府県コードに紐づく市区町村情報をAPIで取得する
3 * @param {string} prefCd 都道府県コード
4 * @return {object} 市区町村情報
5 */
6export const fetchCityData = async (prefCd) => {
7  const response = await fetch(`/form/api/${prefCd}/address/`);
8  const responseText = await response.text();
9  if (!response.ok || responseText === '') {
10    return {};
11  }
12  return JSON.parse(responseText);
13}
14
15/**
16 * 都道府県コード/市区町村コードに紐づく大字・通称情報をAPIで取得する
17 * @param {string} prefCd 都道府県コード
18 * @param {string} cityCd 市区町村コード
19 * @return {object} 大字・通称情報
20 */
21export const fetchTownData = async (prefCd, cityCd) => {
22  const response = await fetch(`/form/api/${prefCd}/${cityCd}/address/`);
23  const responseText = await response.text();
24  if (!response.ok || responseText === '') {
25    return {};
26  }
27  return JSON.parse(responseText);
28}
29
30/**
31 * 都道府県コード/市区町村コード/大字・通称コードに紐づく字・丁目情報をAPIで取得する
32 * @param {string} prefCd 都道府県コード
33 * @param {string} cityCd 市区町村コード
34 * @param {string} townCd 大字・通称コード
35 * @return {object} 字・丁目情報
36 */
37export const fetchChomeData = async (prefCd, cityCd, townCd) => {
38  const response = await fetch(`/form/api/${prefCd}/${cityCd}/${townCd}/address/`);
39  const responseText = await response.text();
40  if (!response.ok || responseText === '') {
41    return {};
42  }
43  return JSON.parse(responseText);
44}
45
46/**
47 * 郵便番号に紐づく住所情報リストをAPIで取得する
48 * @param {string} postCd 
49 * @return {object} 住所情報リスト
50 */
51export const fetchAddressData = async (postCd) => {
52  const response = await fetch(`/form/api/address/?postCd=${postCd}`);
53  const responseText = await response.text();
54  if (!response.ok || responseText === '') {
55    return {};
56  }
57  return JSON.parse(responseText);
58}
59
60/**
61 * 都道府県コード/市区町村コード/大字・通称コード/字・丁目コードに紐づく担当店舗情報をAPIで取得する
62 * @param {string} prefCd 
63 * @param {string} cityCd 
64 * @param {string} townCd 
65 * @param {string} chomeCd 
66 * @return {object} 担当店舗情報
67 */
68export const fetchAssignShopData = async (prefCd, cityCd, townCd, chomeCd) => {
69  const response = await fetch(`/form/api/assign-shops/?prefCd=${prefCd}&cityCd=${cityCd}&townCd=${townCd}&chomeCd=${chomeCd}`);
70  const responseText = await response.text();
71  if (!response.ok || responseText === '') {
72    return {};
73  }
74  return JSON.parse(responseText);
75}
76
77/**
78 * 店舗コードに紐づく店舗情報をAPIで取得する
79 * @param {string} shopCd 
80 * @return {object} 店舗情報
81 */
82export const fetchShopData = async (shopCd) => {
83  const response = await fetch(`/form/api/shops/?shopCd=${shopCd}`);
84  const responseText = await response.text();
85  if (!response.ok || responseText === '') {
86    return {};
87  }
88  return JSON.parse(responseText);
89}
90
91/**
92 * 都道府県コードに紐づく市区町村相場一覧をAPIで取得する
93 * @param {string} prefCd 
94 * @return {object} 店舗情報
95 */
96export const fetchCitySoubaData = async (prefCd) => {
97  const response = await fetch(`/trend/api/bukken/${prefCd}/cities/souba/`);
98  const responseText = await response.text();
99  if (!response.ok || responseText === '') {
100    return {};
101  }
102  return JSON.parse(responseText);
103}
104
105/**
106 * 物件IDに紐づく物件情報をAPIで取得する
107 * @param {string} bukkenId 
108 * @return {object} 物件情報
109 */
110export const fetchBukkenData = async (bukkenId) => {
111  const response = await fetch(`/trend/api/bukken/${bukkenId}/address/`);
112  const responseText = await response.text();
113  if (!response.ok || responseText === '') {
114    return {};
115  }
116  return JSON.parse(responseText);
117}
118
119/**
120 * 物件名に部分一致する物件住所情報をAPIで取得する
121 * @param {string} bukkenName 
122 * @returns {object} 物件情報
123 */
124export const fetchBukkenAddressData = async (bukkenName) => {
125  const response = await fetch(`/trend/api/bukken/?bukkenName=${bukkenName}`);
126  const responseText = await response.text();
127  if (!response.ok || responseText === '') {
128    return {};
129  }
130  return JSON.parse(responseText);
131}
132
133/**
134 * 都道府県コードに紐づく一戸建ての市区町村情報をAPIで取得する
135 * @param {string} prefCd 
136 * @returns {object} 一戸建て 市区町村情報
137 */
138export const fetchKodateCityData = async (prefCd) => {
139  const response = await fetch(`/trend/api/bukken/${prefCd}/cities/kodate/`);
140  const responseText = await response.text();
141  if (!response.ok || responseText === '') {
142    return {};
143  }
144  return JSON.parse(responseText);
145}
146
147/**
148 * 指定の物件IDで自動査定を行う
149 * @param {string} bukkenId 
150 * @param {string} roomCondition
151 * @returns 自動査定結果
152 */
153export const fetchBukkenSateiData = async (bukkenId, roomCondition = '') => {
154  const response = await fetch(`/trend/api/satei/${bukkenId}/?${roomCondition}`);
155  const responseText = await response.text();
156  if (!response.ok || responseText === '') {
157    return {};
158  }
159  return JSON.parse(responseText);
160}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.