index.d.ts 160 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258
  1. /**
  2. * @license Angular v19.2.4
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import { Observable } from 'rxjs';
  7. import * as i0 from '@angular/core';
  8. import { InjectionToken, EnvironmentInjector, ModuleWithProviders, Provider, EnvironmentProviders, WritableResource, ResourceRef, Signal, Injector, ValueEqualityFn } from '@angular/core';
  9. import { XhrFactory } from '@angular/common';
  10. /**
  11. * A token used to manipulate and access values stored in `HttpContext`.
  12. *
  13. * @publicApi
  14. */
  15. declare class HttpContextToken<T> {
  16. readonly defaultValue: () => T;
  17. constructor(defaultValue: () => T);
  18. }
  19. /**
  20. * Http context stores arbitrary user defined values and ensures type safety without
  21. * actually knowing the types. It is backed by a `Map` and guarantees that keys do not clash.
  22. *
  23. * This context is mutable and is shared between cloned requests unless explicitly specified.
  24. *
  25. * @usageNotes
  26. *
  27. * ### Usage Example
  28. *
  29. * ```ts
  30. * // inside cache.interceptors.ts
  31. * export const IS_CACHE_ENABLED = new HttpContextToken<boolean>(() => false);
  32. *
  33. * export class CacheInterceptor implements HttpInterceptor {
  34. *
  35. * intercept(req: HttpRequest<any>, delegate: HttpHandler): Observable<HttpEvent<any>> {
  36. * if (req.context.get(IS_CACHE_ENABLED) === true) {
  37. * return ...;
  38. * }
  39. * return delegate.handle(req);
  40. * }
  41. * }
  42. *
  43. * // inside a service
  44. *
  45. * this.httpClient.get('/api/weather', {
  46. * context: new HttpContext().set(IS_CACHE_ENABLED, true)
  47. * }).subscribe(...);
  48. * ```
  49. *
  50. * @publicApi
  51. */
  52. declare class HttpContext {
  53. private readonly map;
  54. /**
  55. * Store a value in the context. If a value is already present it will be overwritten.
  56. *
  57. * @param token The reference to an instance of `HttpContextToken`.
  58. * @param value The value to store.
  59. *
  60. * @returns A reference to itself for easy chaining.
  61. */
  62. set<T>(token: HttpContextToken<T>, value: T): HttpContext;
  63. /**
  64. * Retrieve the value associated with the given token.
  65. *
  66. * @param token The reference to an instance of `HttpContextToken`.
  67. *
  68. * @returns The stored value or default if one is defined.
  69. */
  70. get<T>(token: HttpContextToken<T>): T;
  71. /**
  72. * Delete the value associated with the given token.
  73. *
  74. * @param token The reference to an instance of `HttpContextToken`.
  75. *
  76. * @returns A reference to itself for easy chaining.
  77. */
  78. delete(token: HttpContextToken<unknown>): HttpContext;
  79. /**
  80. * Checks for existence of a given token.
  81. *
  82. * @param token The reference to an instance of `HttpContextToken`.
  83. *
  84. * @returns True if the token exists, false otherwise.
  85. */
  86. has(token: HttpContextToken<unknown>): boolean;
  87. /**
  88. * @returns a list of tokens currently stored in the context.
  89. */
  90. keys(): IterableIterator<HttpContextToken<unknown>>;
  91. }
  92. /**
  93. * Represents the header configuration options for an HTTP request.
  94. * Instances are immutable. Modifying methods return a cloned
  95. * instance with the change. The original object is never changed.
  96. *
  97. * @publicApi
  98. */
  99. declare class HttpHeaders {
  100. /**
  101. * Internal map of lowercase header names to values.
  102. */
  103. private headers;
  104. /**
  105. * Internal map of lowercased header names to the normalized
  106. * form of the name (the form seen first).
  107. */
  108. private normalizedNames;
  109. /**
  110. * Complete the lazy initialization of this object (needed before reading).
  111. */
  112. private lazyInit;
  113. /**
  114. * Queued updates to be materialized the next initialization.
  115. */
  116. private lazyUpdate;
  117. /** Constructs a new HTTP header object with the given values.*/
  118. constructor(headers?: string | {
  119. [name: string]: string | number | (string | number)[];
  120. } | Headers);
  121. /**
  122. * Checks for existence of a given header.
  123. *
  124. * @param name The header name to check for existence.
  125. *
  126. * @returns True if the header exists, false otherwise.
  127. */
  128. has(name: string): boolean;
  129. /**
  130. * Retrieves the first value of a given header.
  131. *
  132. * @param name The header name.
  133. *
  134. * @returns The value string if the header exists, null otherwise
  135. */
  136. get(name: string): string | null;
  137. /**
  138. * Retrieves the names of the headers.
  139. *
  140. * @returns A list of header names.
  141. */
  142. keys(): string[];
  143. /**
  144. * Retrieves a list of values for a given header.
  145. *
  146. * @param name The header name from which to retrieve values.
  147. *
  148. * @returns A string of values if the header exists, null otherwise.
  149. */
  150. getAll(name: string): string[] | null;
  151. /**
  152. * Appends a new value to the existing set of values for a header
  153. * and returns them in a clone of the original instance.
  154. *
  155. * @param name The header name for which to append the values.
  156. * @param value The value to append.
  157. *
  158. * @returns A clone of the HTTP headers object with the value appended to the given header.
  159. */
  160. append(name: string, value: string | string[]): HttpHeaders;
  161. /**
  162. * Sets or modifies a value for a given header in a clone of the original instance.
  163. * If the header already exists, its value is replaced with the given value
  164. * in the returned object.
  165. *
  166. * @param name The header name.
  167. * @param value The value or values to set or override for the given header.
  168. *
  169. * @returns A clone of the HTTP headers object with the newly set header value.
  170. */
  171. set(name: string, value: string | string[]): HttpHeaders;
  172. /**
  173. * Deletes values for a given header in a clone of the original instance.
  174. *
  175. * @param name The header name.
  176. * @param value The value or values to delete for the given header.
  177. *
  178. * @returns A clone of the HTTP headers object with the given value deleted.
  179. */
  180. delete(name: string, value?: string | string[]): HttpHeaders;
  181. private maybeSetNormalizedName;
  182. private init;
  183. private copyFrom;
  184. private clone;
  185. private applyUpdate;
  186. private addHeaderEntry;
  187. private setHeaderEntries;
  188. }
  189. /**
  190. * A codec for encoding and decoding parameters in URLs.
  191. *
  192. * Used by `HttpParams`.
  193. *
  194. * @publicApi
  195. **/
  196. interface HttpParameterCodec {
  197. encodeKey(key: string): string;
  198. encodeValue(value: string): string;
  199. decodeKey(key: string): string;
  200. decodeValue(value: string): string;
  201. }
  202. /**
  203. * Provides encoding and decoding of URL parameter and query-string values.
  204. *
  205. * Serializes and parses URL parameter keys and values to encode and decode them.
  206. * If you pass URL query parameters without encoding,
  207. * the query parameters can be misinterpreted at the receiving end.
  208. *
  209. *
  210. * @publicApi
  211. */
  212. declare class HttpUrlEncodingCodec implements HttpParameterCodec {
  213. /**
  214. * Encodes a key name for a URL parameter or query-string.
  215. * @param key The key name.
  216. * @returns The encoded key name.
  217. */
  218. encodeKey(key: string): string;
  219. /**
  220. * Encodes the value of a URL parameter or query-string.
  221. * @param value The value.
  222. * @returns The encoded value.
  223. */
  224. encodeValue(value: string): string;
  225. /**
  226. * Decodes an encoded URL parameter or query-string key.
  227. * @param key The encoded key name.
  228. * @returns The decoded key name.
  229. */
  230. decodeKey(key: string): string;
  231. /**
  232. * Decodes an encoded URL parameter or query-string value.
  233. * @param value The encoded value.
  234. * @returns The decoded value.
  235. */
  236. decodeValue(value: string): string;
  237. }
  238. /**
  239. * Options used to construct an `HttpParams` instance.
  240. *
  241. * @publicApi
  242. */
  243. interface HttpParamsOptions {
  244. /**
  245. * String representation of the HTTP parameters in URL-query-string format.
  246. * Mutually exclusive with `fromObject`.
  247. */
  248. fromString?: string;
  249. /** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */
  250. fromObject?: {
  251. [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
  252. };
  253. /** Encoding codec used to parse and serialize the parameters. */
  254. encoder?: HttpParameterCodec;
  255. }
  256. /**
  257. * An HTTP request/response body that represents serialized parameters,
  258. * per the MIME type `application/x-www-form-urlencoded`.
  259. *
  260. * This class is immutable; all mutation operations return a new instance.
  261. *
  262. * @publicApi
  263. */
  264. declare class HttpParams {
  265. private map;
  266. private encoder;
  267. private updates;
  268. private cloneFrom;
  269. constructor(options?: HttpParamsOptions);
  270. /**
  271. * Reports whether the body includes one or more values for a given parameter.
  272. * @param param The parameter name.
  273. * @returns True if the parameter has one or more values,
  274. * false if it has no value or is not present.
  275. */
  276. has(param: string): boolean;
  277. /**
  278. * Retrieves the first value for a parameter.
  279. * @param param The parameter name.
  280. * @returns The first value of the given parameter,
  281. * or `null` if the parameter is not present.
  282. */
  283. get(param: string): string | null;
  284. /**
  285. * Retrieves all values for a parameter.
  286. * @param param The parameter name.
  287. * @returns All values in a string array,
  288. * or `null` if the parameter not present.
  289. */
  290. getAll(param: string): string[] | null;
  291. /**
  292. * Retrieves all the parameters for this body.
  293. * @returns The parameter names in a string array.
  294. */
  295. keys(): string[];
  296. /**
  297. * Appends a new value to existing values for a parameter.
  298. * @param param The parameter name.
  299. * @param value The new value to add.
  300. * @return A new body with the appended value.
  301. */
  302. append(param: string, value: string | number | boolean): HttpParams;
  303. /**
  304. * Constructs a new body with appended values for the given parameter name.
  305. * @param params parameters and values
  306. * @return A new body with the new value.
  307. */
  308. appendAll(params: {
  309. [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
  310. }): HttpParams;
  311. /**
  312. * Replaces the value for a parameter.
  313. * @param param The parameter name.
  314. * @param value The new value.
  315. * @return A new body with the new value.
  316. */
  317. set(param: string, value: string | number | boolean): HttpParams;
  318. /**
  319. * Removes a given value or all values from a parameter.
  320. * @param param The parameter name.
  321. * @param value The value to remove, if provided.
  322. * @return A new body with the given value removed, or with all values
  323. * removed if no value is specified.
  324. */
  325. delete(param: string, value?: string | number | boolean): HttpParams;
  326. /**
  327. * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
  328. * separated by `&`s.
  329. */
  330. toString(): string;
  331. private clone;
  332. private init;
  333. }
  334. /**
  335. * An outgoing HTTP request with an optional typed body.
  336. *
  337. * `HttpRequest` represents an outgoing request, including URL, method,
  338. * headers, body, and other request configuration options. Instances should be
  339. * assumed to be immutable. To modify a `HttpRequest`, the `clone`
  340. * method should be used.
  341. *
  342. * @publicApi
  343. */
  344. declare class HttpRequest<T> {
  345. readonly url: string;
  346. /**
  347. * The request body, or `null` if one isn't set.
  348. *
  349. * Bodies are not enforced to be immutable, as they can include a reference to any
  350. * user-defined data type. However, interceptors should take care to preserve
  351. * idempotence by treating them as such.
  352. */
  353. readonly body: T | null;
  354. /**
  355. * Outgoing headers for this request.
  356. */
  357. readonly headers: HttpHeaders;
  358. /**
  359. * Shared and mutable context that can be used by interceptors
  360. */
  361. readonly context: HttpContext;
  362. /**
  363. * Whether this request should be made in a way that exposes progress events.
  364. *
  365. * Progress events are expensive (change detection runs on each event) and so
  366. * they should only be requested if the consumer intends to monitor them.
  367. *
  368. * Note: The `FetchBackend` doesn't support progress report on uploads.
  369. */
  370. readonly reportProgress: boolean;
  371. /**
  372. * Whether this request should be sent with outgoing credentials (cookies).
  373. */
  374. readonly withCredentials: boolean;
  375. /**
  376. * The expected response type of the server.
  377. *
  378. * This is used to parse the response appropriately before returning it to
  379. * the requestee.
  380. */
  381. readonly responseType: 'arraybuffer' | 'blob' | 'json' | 'text';
  382. /**
  383. * The outgoing HTTP request method.
  384. */
  385. readonly method: string;
  386. /**
  387. * Outgoing URL parameters.
  388. *
  389. * To pass a string representation of HTTP parameters in the URL-query-string format,
  390. * the `HttpParamsOptions`' `fromString` may be used. For example:
  391. *
  392. * ```ts
  393. * new HttpParams({fromString: 'angular=awesome'})
  394. * ```
  395. */
  396. readonly params: HttpParams;
  397. /**
  398. * The outgoing URL with all URL parameters set.
  399. */
  400. readonly urlWithParams: string;
  401. /**
  402. * The HttpTransferCache option for the request
  403. */
  404. readonly transferCache?: {
  405. includeHeaders?: string[];
  406. } | boolean;
  407. constructor(method: 'GET' | 'HEAD', url: string, init?: {
  408. headers?: HttpHeaders;
  409. context?: HttpContext;
  410. reportProgress?: boolean;
  411. params?: HttpParams;
  412. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  413. withCredentials?: boolean;
  414. /**
  415. * This property accepts either a boolean to enable/disable transferring cache for eligible
  416. * requests performed using `HttpClient`, or an object, which allows to configure cache
  417. * parameters, such as which headers should be included (no headers are included by default).
  418. *
  419. * Setting this property will override the options passed to `provideClientHydration()` for this
  420. * particular request
  421. */
  422. transferCache?: {
  423. includeHeaders?: string[];
  424. } | boolean;
  425. });
  426. constructor(method: 'DELETE' | 'JSONP' | 'OPTIONS', url: string, init?: {
  427. headers?: HttpHeaders;
  428. context?: HttpContext;
  429. reportProgress?: boolean;
  430. params?: HttpParams;
  431. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  432. withCredentials?: boolean;
  433. });
  434. constructor(method: 'POST', url: string, body: T | null, init?: {
  435. headers?: HttpHeaders;
  436. context?: HttpContext;
  437. reportProgress?: boolean;
  438. params?: HttpParams;
  439. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  440. withCredentials?: boolean;
  441. /**
  442. * This property accepts either a boolean to enable/disable transferring cache for eligible
  443. * requests performed using `HttpClient`, or an object, which allows to configure cache
  444. * parameters, such as which headers should be included (no headers are included by default).
  445. *
  446. * Setting this property will override the options passed to `provideClientHydration()` for this
  447. * particular request
  448. */
  449. transferCache?: {
  450. includeHeaders?: string[];
  451. } | boolean;
  452. });
  453. constructor(method: 'PUT' | 'PATCH', url: string, body: T | null, init?: {
  454. headers?: HttpHeaders;
  455. context?: HttpContext;
  456. reportProgress?: boolean;
  457. params?: HttpParams;
  458. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  459. withCredentials?: boolean;
  460. });
  461. constructor(method: string, url: string, body: T | null, init?: {
  462. headers?: HttpHeaders;
  463. context?: HttpContext;
  464. reportProgress?: boolean;
  465. params?: HttpParams;
  466. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  467. withCredentials?: boolean;
  468. /**
  469. * This property accepts either a boolean to enable/disable transferring cache for eligible
  470. * requests performed using `HttpClient`, or an object, which allows to configure cache
  471. * parameters, such as which headers should be included (no headers are included by default).
  472. *
  473. * Setting this property will override the options passed to `provideClientHydration()` for this
  474. * particular request
  475. */
  476. transferCache?: {
  477. includeHeaders?: string[];
  478. } | boolean;
  479. });
  480. /**
  481. * Transform the free-form body into a serialized format suitable for
  482. * transmission to the server.
  483. */
  484. serializeBody(): ArrayBuffer | Blob | FormData | URLSearchParams | string | null;
  485. /**
  486. * Examine the body and attempt to infer an appropriate MIME type
  487. * for it.
  488. *
  489. * If no such type can be inferred, this method will return `null`.
  490. */
  491. detectContentTypeHeader(): string | null;
  492. clone(): HttpRequest<T>;
  493. clone(update: {
  494. headers?: HttpHeaders;
  495. context?: HttpContext;
  496. reportProgress?: boolean;
  497. params?: HttpParams;
  498. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  499. withCredentials?: boolean;
  500. transferCache?: {
  501. includeHeaders?: string[];
  502. } | boolean;
  503. body?: T | null;
  504. method?: string;
  505. url?: string;
  506. setHeaders?: {
  507. [name: string]: string | string[];
  508. };
  509. setParams?: {
  510. [param: string]: string;
  511. };
  512. }): HttpRequest<T>;
  513. clone<V>(update: {
  514. headers?: HttpHeaders;
  515. context?: HttpContext;
  516. reportProgress?: boolean;
  517. params?: HttpParams;
  518. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  519. withCredentials?: boolean;
  520. transferCache?: {
  521. includeHeaders?: string[];
  522. } | boolean;
  523. body?: V | null;
  524. method?: string;
  525. url?: string;
  526. setHeaders?: {
  527. [name: string]: string | string[];
  528. };
  529. setParams?: {
  530. [param: string]: string;
  531. };
  532. }): HttpRequest<V>;
  533. }
  534. /**
  535. * Type enumeration for the different kinds of `HttpEvent`.
  536. *
  537. * @publicApi
  538. */
  539. declare enum HttpEventType {
  540. /**
  541. * The request was sent out over the wire.
  542. */
  543. Sent = 0,
  544. /**
  545. * An upload progress event was received.
  546. *
  547. * Note: The `FetchBackend` doesn't support progress report on uploads.
  548. */
  549. UploadProgress = 1,
  550. /**
  551. * The response status code and headers were received.
  552. */
  553. ResponseHeader = 2,
  554. /**
  555. * A download progress event was received.
  556. */
  557. DownloadProgress = 3,
  558. /**
  559. * The full response including the body was received.
  560. */
  561. Response = 4,
  562. /**
  563. * A custom event from an interceptor or a backend.
  564. */
  565. User = 5
  566. }
  567. /**
  568. * Base interface for progress events.
  569. *
  570. * @publicApi
  571. */
  572. interface HttpProgressEvent {
  573. /**
  574. * Progress event type is either upload or download.
  575. */
  576. type: HttpEventType.DownloadProgress | HttpEventType.UploadProgress;
  577. /**
  578. * Number of bytes uploaded or downloaded.
  579. */
  580. loaded: number;
  581. /**
  582. * Total number of bytes to upload or download. Depending on the request or
  583. * response, this may not be computable and thus may not be present.
  584. */
  585. total?: number;
  586. }
  587. /**
  588. * A download progress event.
  589. *
  590. * @publicApi
  591. */
  592. interface HttpDownloadProgressEvent extends HttpProgressEvent {
  593. type: HttpEventType.DownloadProgress;
  594. /**
  595. * The partial response body as downloaded so far.
  596. *
  597. * Only present if the responseType was `text`.
  598. */
  599. partialText?: string;
  600. }
  601. /**
  602. * An upload progress event.
  603. *
  604. * Note: The `FetchBackend` doesn't support progress report on uploads.
  605. *
  606. * @publicApi
  607. */
  608. interface HttpUploadProgressEvent extends HttpProgressEvent {
  609. type: HttpEventType.UploadProgress;
  610. }
  611. /**
  612. * An event indicating that the request was sent to the server. Useful
  613. * when a request may be retried multiple times, to distinguish between
  614. * retries on the final event stream.
  615. *
  616. * @publicApi
  617. */
  618. interface HttpSentEvent {
  619. type: HttpEventType.Sent;
  620. }
  621. /**
  622. * A user-defined event.
  623. *
  624. * Grouping all custom events under this type ensures they will be handled
  625. * and forwarded by all implementations of interceptors.
  626. *
  627. * @publicApi
  628. */
  629. interface HttpUserEvent<T> {
  630. type: HttpEventType.User;
  631. }
  632. /**
  633. * Union type for all possible events on the response stream.
  634. *
  635. * Typed according to the expected type of the response.
  636. *
  637. * @publicApi
  638. */
  639. type HttpEvent<T> = HttpSentEvent | HttpHeaderResponse | HttpResponse<T> | HttpProgressEvent | HttpUserEvent<T>;
  640. /**
  641. * Base class for both `HttpResponse` and `HttpHeaderResponse`.
  642. *
  643. * @publicApi
  644. */
  645. declare abstract class HttpResponseBase {
  646. /**
  647. * All response headers.
  648. */
  649. readonly headers: HttpHeaders;
  650. /**
  651. * Response status code.
  652. */
  653. readonly status: number;
  654. /**
  655. * Textual description of response status code, defaults to OK.
  656. *
  657. * Do not depend on this.
  658. */
  659. readonly statusText: string;
  660. /**
  661. * URL of the resource retrieved, or null if not available.
  662. */
  663. readonly url: string | null;
  664. /**
  665. * Whether the status code falls in the 2xx range.
  666. */
  667. readonly ok: boolean;
  668. /**
  669. * Type of the response, narrowed to either the full response or the header.
  670. */
  671. readonly type: HttpEventType.Response | HttpEventType.ResponseHeader;
  672. /**
  673. * Super-constructor for all responses.
  674. *
  675. * The single parameter accepted is an initialization hash. Any properties
  676. * of the response passed there will override the default values.
  677. */
  678. constructor(init: {
  679. headers?: HttpHeaders;
  680. status?: number;
  681. statusText?: string;
  682. url?: string;
  683. }, defaultStatus?: number, defaultStatusText?: string);
  684. }
  685. /**
  686. * A partial HTTP response which only includes the status and header data,
  687. * but no response body.
  688. *
  689. * `HttpHeaderResponse` is a `HttpEvent` available on the response
  690. * event stream, only when progress events are requested.
  691. *
  692. * @publicApi
  693. */
  694. declare class HttpHeaderResponse extends HttpResponseBase {
  695. /**
  696. * Create a new `HttpHeaderResponse` with the given parameters.
  697. */
  698. constructor(init?: {
  699. headers?: HttpHeaders;
  700. status?: number;
  701. statusText?: string;
  702. url?: string;
  703. });
  704. readonly type: HttpEventType.ResponseHeader;
  705. /**
  706. * Copy this `HttpHeaderResponse`, overriding its contents with the
  707. * given parameter hash.
  708. */
  709. clone(update?: {
  710. headers?: HttpHeaders;
  711. status?: number;
  712. statusText?: string;
  713. url?: string;
  714. }): HttpHeaderResponse;
  715. }
  716. /**
  717. * A full HTTP response, including a typed response body (which may be `null`
  718. * if one was not returned).
  719. *
  720. * `HttpResponse` is a `HttpEvent` available on the response event
  721. * stream.
  722. *
  723. * @publicApi
  724. */
  725. declare class HttpResponse<T> extends HttpResponseBase {
  726. /**
  727. * The response body, or `null` if one was not returned.
  728. */
  729. readonly body: T | null;
  730. /**
  731. * Construct a new `HttpResponse`.
  732. */
  733. constructor(init?: {
  734. body?: T | null;
  735. headers?: HttpHeaders;
  736. status?: number;
  737. statusText?: string;
  738. url?: string;
  739. });
  740. readonly type: HttpEventType.Response;
  741. clone(): HttpResponse<T>;
  742. clone(update: {
  743. headers?: HttpHeaders;
  744. status?: number;
  745. statusText?: string;
  746. url?: string;
  747. }): HttpResponse<T>;
  748. clone<V>(update: {
  749. body?: V | null;
  750. headers?: HttpHeaders;
  751. status?: number;
  752. statusText?: string;
  753. url?: string;
  754. }): HttpResponse<V>;
  755. }
  756. /**
  757. * A response that represents an error or failure, either from a
  758. * non-successful HTTP status, an error while executing the request,
  759. * or some other failure which occurred during the parsing of the response.
  760. *
  761. * Any error returned on the `Observable` response stream will be
  762. * wrapped in an `HttpErrorResponse` to provide additional context about
  763. * the state of the HTTP layer when the error occurred. The error property
  764. * will contain either a wrapped Error object or the error response returned
  765. * from the server.
  766. *
  767. * @publicApi
  768. */
  769. declare class HttpErrorResponse extends HttpResponseBase implements Error {
  770. readonly name = "HttpErrorResponse";
  771. readonly message: string;
  772. readonly error: any | null;
  773. /**
  774. * Errors are never okay, even when the status code is in the 2xx success range.
  775. */
  776. readonly ok = false;
  777. constructor(init: {
  778. error?: any;
  779. headers?: HttpHeaders;
  780. status?: number;
  781. statusText?: string;
  782. url?: string;
  783. });
  784. }
  785. /**
  786. * Http status codes.
  787. * As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
  788. * @publicApi
  789. */
  790. declare enum HttpStatusCode {
  791. Continue = 100,
  792. SwitchingProtocols = 101,
  793. Processing = 102,
  794. EarlyHints = 103,
  795. Ok = 200,
  796. Created = 201,
  797. Accepted = 202,
  798. NonAuthoritativeInformation = 203,
  799. NoContent = 204,
  800. ResetContent = 205,
  801. PartialContent = 206,
  802. MultiStatus = 207,
  803. AlreadyReported = 208,
  804. ImUsed = 226,
  805. MultipleChoices = 300,
  806. MovedPermanently = 301,
  807. Found = 302,
  808. SeeOther = 303,
  809. NotModified = 304,
  810. UseProxy = 305,
  811. Unused = 306,
  812. TemporaryRedirect = 307,
  813. PermanentRedirect = 308,
  814. BadRequest = 400,
  815. Unauthorized = 401,
  816. PaymentRequired = 402,
  817. Forbidden = 403,
  818. NotFound = 404,
  819. MethodNotAllowed = 405,
  820. NotAcceptable = 406,
  821. ProxyAuthenticationRequired = 407,
  822. RequestTimeout = 408,
  823. Conflict = 409,
  824. Gone = 410,
  825. LengthRequired = 411,
  826. PreconditionFailed = 412,
  827. PayloadTooLarge = 413,
  828. UriTooLong = 414,
  829. UnsupportedMediaType = 415,
  830. RangeNotSatisfiable = 416,
  831. ExpectationFailed = 417,
  832. ImATeapot = 418,
  833. MisdirectedRequest = 421,
  834. UnprocessableEntity = 422,
  835. Locked = 423,
  836. FailedDependency = 424,
  837. TooEarly = 425,
  838. UpgradeRequired = 426,
  839. PreconditionRequired = 428,
  840. TooManyRequests = 429,
  841. RequestHeaderFieldsTooLarge = 431,
  842. UnavailableForLegalReasons = 451,
  843. InternalServerError = 500,
  844. NotImplemented = 501,
  845. BadGateway = 502,
  846. ServiceUnavailable = 503,
  847. GatewayTimeout = 504,
  848. HttpVersionNotSupported = 505,
  849. VariantAlsoNegotiates = 506,
  850. InsufficientStorage = 507,
  851. LoopDetected = 508,
  852. NotExtended = 510,
  853. NetworkAuthenticationRequired = 511
  854. }
  855. /**
  856. * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
  857. * `HttpResponse`.
  858. *
  859. * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
  860. * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
  861. * `HttpBackend`.
  862. *
  863. * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
  864. *
  865. * @publicApi
  866. */
  867. declare abstract class HttpHandler {
  868. abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  869. }
  870. /**
  871. * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
  872. *
  873. * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
  874. *
  875. * When injected, `HttpBackend` dispatches requests directly to the backend, without going
  876. * through the interceptor chain.
  877. *
  878. * @publicApi
  879. */
  880. declare abstract class HttpBackend implements HttpHandler {
  881. abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  882. }
  883. /**
  884. * Performs HTTP requests.
  885. * This service is available as an injectable class, with methods to perform HTTP requests.
  886. * Each request method has multiple signatures, and the return type varies based on
  887. * the signature that is called (mainly the values of `observe` and `responseType`).
  888. *
  889. * Note that the `responseType` *options* value is a String that identifies the
  890. * single data type of the response.
  891. * A single overload version of the method handles each response type.
  892. * The value of `responseType` cannot be a union, as the combined signature could imply.
  893. *
  894. * @usageNotes
  895. *
  896. * ### HTTP Request Example
  897. *
  898. * ```ts
  899. * // GET heroes whose name contains search term
  900. * searchHeroes(term: string): observable<Hero[]>{
  901. *
  902. * const params = new HttpParams({fromString: 'name=term'});
  903. * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
  904. * }
  905. * ```
  906. *
  907. * Alternatively, the parameter string can be used without invoking HttpParams
  908. * by directly joining to the URL.
  909. * ```ts
  910. * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});
  911. * ```
  912. *
  913. *
  914. * ### JSONP Example
  915. * ```ts
  916. * requestJsonp(url, callback = 'callback') {
  917. * return this.httpClient.jsonp(this.heroesURL, callback);
  918. * }
  919. * ```
  920. *
  921. * ### PATCH Example
  922. * ```ts
  923. * // PATCH one of the heroes' name
  924. * patchHero (id: number, heroName: string): Observable<{}> {
  925. * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42
  926. * return this.httpClient.patch(url, {name: heroName}, httpOptions)
  927. * .pipe(catchError(this.handleError('patchHero')));
  928. * }
  929. * ```
  930. *
  931. * @see [HTTP Guide](guide/http)
  932. * @see [HTTP Request](api/common/http/HttpRequest)
  933. *
  934. * @publicApi
  935. */
  936. declare class HttpClient {
  937. private handler;
  938. constructor(handler: HttpHandler);
  939. /**
  940. * Sends an `HttpRequest` and returns a stream of `HttpEvent`s.
  941. *
  942. * @return An `Observable` of the response, with the response body as a stream of `HttpEvent`s.
  943. */
  944. request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>;
  945. /**
  946. * Constructs a request that interprets the body as an `ArrayBuffer` and returns the response in
  947. * an `ArrayBuffer`.
  948. *
  949. * @param method The HTTP method.
  950. * @param url The endpoint URL.
  951. * @param options The HTTP options to send with the request.
  952. *
  953. *
  954. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  955. */
  956. request(method: string, url: string, options: {
  957. body?: any;
  958. headers?: HttpHeaders | Record<string, string | string[]>;
  959. context?: HttpContext;
  960. observe?: 'body';
  961. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  962. reportProgress?: boolean;
  963. responseType: 'arraybuffer';
  964. withCredentials?: boolean;
  965. transferCache?: {
  966. includeHeaders?: string[];
  967. } | boolean;
  968. }): Observable<ArrayBuffer>;
  969. /**
  970. * Constructs a request that interprets the body as a blob and returns
  971. * the response as a blob.
  972. *
  973. * @param method The HTTP method.
  974. * @param url The endpoint URL.
  975. * @param options The HTTP options to send with the request.
  976. *
  977. * @return An `Observable` of the response, with the response body of type `Blob`.
  978. */
  979. request(method: string, url: string, options: {
  980. body?: any;
  981. headers?: HttpHeaders | Record<string, string | string[]>;
  982. context?: HttpContext;
  983. observe?: 'body';
  984. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  985. reportProgress?: boolean;
  986. responseType: 'blob';
  987. withCredentials?: boolean;
  988. transferCache?: {
  989. includeHeaders?: string[];
  990. } | boolean;
  991. }): Observable<Blob>;
  992. /**
  993. * Constructs a request that interprets the body as a text string and
  994. * returns a string value.
  995. *
  996. * @param method The HTTP method.
  997. * @param url The endpoint URL.
  998. * @param options The HTTP options to send with the request.
  999. *
  1000. * @return An `Observable` of the response, with the response body of type string.
  1001. */
  1002. request(method: string, url: string, options: {
  1003. body?: any;
  1004. headers?: HttpHeaders | Record<string, string | string[]>;
  1005. context?: HttpContext;
  1006. observe?: 'body';
  1007. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1008. reportProgress?: boolean;
  1009. responseType: 'text';
  1010. withCredentials?: boolean;
  1011. transferCache?: {
  1012. includeHeaders?: string[];
  1013. } | boolean;
  1014. }): Observable<string>;
  1015. /**
  1016. * Constructs a request that interprets the body as an `ArrayBuffer` and returns the
  1017. * the full event stream.
  1018. *
  1019. * @param method The HTTP method.
  1020. * @param url The endpoint URL.
  1021. * @param options The HTTP options to send with the request.
  1022. *
  1023. * @return An `Observable` of the response, with the response body as an array of `HttpEvent`s for
  1024. * the request.
  1025. */
  1026. request(method: string, url: string, options: {
  1027. body?: any;
  1028. headers?: HttpHeaders | Record<string, string | string[]>;
  1029. context?: HttpContext;
  1030. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1031. observe: 'events';
  1032. reportProgress?: boolean;
  1033. responseType: 'arraybuffer';
  1034. withCredentials?: boolean;
  1035. transferCache?: {
  1036. includeHeaders?: string[];
  1037. } | boolean;
  1038. }): Observable<HttpEvent<ArrayBuffer>>;
  1039. /**
  1040. * Constructs a request that interprets the body as a `Blob` and returns
  1041. * the full event stream.
  1042. *
  1043. * @param method The HTTP method.
  1044. * @param url The endpoint URL.
  1045. * @param options The HTTP options to send with the request.
  1046. *
  1047. * @return An `Observable` of all `HttpEvent`s for the request,
  1048. * with the response body of type `Blob`.
  1049. */
  1050. request(method: string, url: string, options: {
  1051. body?: any;
  1052. headers?: HttpHeaders | Record<string, string | string[]>;
  1053. observe: 'events';
  1054. context?: HttpContext;
  1055. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1056. reportProgress?: boolean;
  1057. responseType: 'blob';
  1058. withCredentials?: boolean;
  1059. transferCache?: {
  1060. includeHeaders?: string[];
  1061. } | boolean;
  1062. }): Observable<HttpEvent<Blob>>;
  1063. /**
  1064. * Constructs a request which interprets the body as a text string and returns the full event
  1065. * stream.
  1066. *
  1067. * @param method The HTTP method.
  1068. * @param url The endpoint URL.
  1069. * @param options The HTTP options to send with the request.
  1070. *
  1071. * @return An `Observable` of all `HttpEvent`s for the request,
  1072. * with the response body of type string.
  1073. */
  1074. request(method: string, url: string, options: {
  1075. body?: any;
  1076. headers?: HttpHeaders | Record<string, string | string[]>;
  1077. observe: 'events';
  1078. context?: HttpContext;
  1079. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1080. reportProgress?: boolean;
  1081. responseType: 'text';
  1082. withCredentials?: boolean;
  1083. transferCache?: {
  1084. includeHeaders?: string[];
  1085. } | boolean;
  1086. }): Observable<HttpEvent<string>>;
  1087. /**
  1088. * Constructs a request which interprets the body as a JavaScript object and returns the full
  1089. * event stream.
  1090. *
  1091. * @param method The HTTP method.
  1092. * @param url The endpoint URL.
  1093. * @param options The HTTP options to send with the request.
  1094. *
  1095. * @return An `Observable` of all `HttpEvent`s for the request,
  1096. * with the response body of type `Object`.
  1097. */
  1098. request(method: string, url: string, options: {
  1099. body?: any;
  1100. headers?: HttpHeaders | Record<string, string | string[]>;
  1101. context?: HttpContext;
  1102. reportProgress?: boolean;
  1103. observe: 'events';
  1104. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1105. responseType?: 'json';
  1106. withCredentials?: boolean;
  1107. transferCache?: {
  1108. includeHeaders?: string[];
  1109. } | boolean;
  1110. }): Observable<HttpEvent<any>>;
  1111. /**
  1112. * Constructs a request which interprets the body as a JavaScript object and returns the full
  1113. * event stream.
  1114. *
  1115. * @param method The HTTP method.
  1116. * @param url The endpoint URL.
  1117. * @param options The HTTP options to send with the request.
  1118. *
  1119. * @return An `Observable` of all `HttpEvent`s for the request,
  1120. * with the response body of type `R`.
  1121. */
  1122. request<R>(method: string, url: string, options: {
  1123. body?: any;
  1124. headers?: HttpHeaders | Record<string, string | string[]>;
  1125. context?: HttpContext;
  1126. reportProgress?: boolean;
  1127. observe: 'events';
  1128. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1129. responseType?: 'json';
  1130. withCredentials?: boolean;
  1131. transferCache?: {
  1132. includeHeaders?: string[];
  1133. } | boolean;
  1134. }): Observable<HttpEvent<R>>;
  1135. /**
  1136. * Constructs a request which interprets the body as an `ArrayBuffer`
  1137. * and returns the full `HttpResponse`.
  1138. *
  1139. * @param method The HTTP method.
  1140. * @param url The endpoint URL.
  1141. * @param options The HTTP options to send with the request.
  1142. *
  1143. * @return An `Observable` of the `HttpResponse`, with the response body as an `ArrayBuffer`.
  1144. */
  1145. request(method: string, url: string, options: {
  1146. body?: any;
  1147. headers?: HttpHeaders | Record<string, string | string[]>;
  1148. observe: 'response';
  1149. context?: HttpContext;
  1150. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1151. reportProgress?: boolean;
  1152. responseType: 'arraybuffer';
  1153. withCredentials?: boolean;
  1154. transferCache?: {
  1155. includeHeaders?: string[];
  1156. } | boolean;
  1157. }): Observable<HttpResponse<ArrayBuffer>>;
  1158. /**
  1159. * Constructs a request which interprets the body as a `Blob` and returns the full `HttpResponse`.
  1160. *
  1161. * @param method The HTTP method.
  1162. * @param url The endpoint URL.
  1163. * @param options The HTTP options to send with the request.
  1164. *
  1165. * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.
  1166. */
  1167. request(method: string, url: string, options: {
  1168. body?: any;
  1169. headers?: HttpHeaders | Record<string, string | string[]>;
  1170. observe: 'response';
  1171. context?: HttpContext;
  1172. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1173. reportProgress?: boolean;
  1174. responseType: 'blob';
  1175. withCredentials?: boolean;
  1176. transferCache?: {
  1177. includeHeaders?: string[];
  1178. } | boolean;
  1179. }): Observable<HttpResponse<Blob>>;
  1180. /**
  1181. * Constructs a request which interprets the body as a text stream and returns the full
  1182. * `HttpResponse`.
  1183. *
  1184. * @param method The HTTP method.
  1185. * @param url The endpoint URL.
  1186. * @param options The HTTP options to send with the request.
  1187. *
  1188. * @return An `Observable` of the HTTP response, with the response body of type string.
  1189. */
  1190. request(method: string, url: string, options: {
  1191. body?: any;
  1192. headers?: HttpHeaders | Record<string, string | string[]>;
  1193. observe: 'response';
  1194. context?: HttpContext;
  1195. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1196. reportProgress?: boolean;
  1197. responseType: 'text';
  1198. withCredentials?: boolean;
  1199. transferCache?: {
  1200. includeHeaders?: string[];
  1201. } | boolean;
  1202. }): Observable<HttpResponse<string>>;
  1203. /**
  1204. * Constructs a request which interprets the body as a JavaScript object and returns the full
  1205. * `HttpResponse`.
  1206. *
  1207. * @param method The HTTP method.
  1208. * @param url The endpoint URL.
  1209. * @param options The HTTP options to send with the request.
  1210. *
  1211. * @return An `Observable` of the full `HttpResponse`,
  1212. * with the response body of type `Object`.
  1213. */
  1214. request(method: string, url: string, options: {
  1215. body?: any;
  1216. headers?: HttpHeaders | Record<string, string | string[]>;
  1217. context?: HttpContext;
  1218. reportProgress?: boolean;
  1219. observe: 'response';
  1220. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1221. responseType?: 'json';
  1222. withCredentials?: boolean;
  1223. }): Observable<HttpResponse<Object>>;
  1224. /**
  1225. * Constructs a request which interprets the body as a JavaScript object and returns
  1226. * the full `HttpResponse` with the response body in the requested type.
  1227. *
  1228. * @param method The HTTP method.
  1229. * @param url The endpoint URL.
  1230. * @param options The HTTP options to send with the request.
  1231. *
  1232. * @return An `Observable` of the full `HttpResponse`, with the response body of type `R`.
  1233. */
  1234. request<R>(method: string, url: string, options: {
  1235. body?: any;
  1236. headers?: HttpHeaders | Record<string, string | string[]>;
  1237. context?: HttpContext;
  1238. reportProgress?: boolean;
  1239. observe: 'response';
  1240. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1241. responseType?: 'json';
  1242. withCredentials?: boolean;
  1243. transferCache?: {
  1244. includeHeaders?: string[];
  1245. } | boolean;
  1246. }): Observable<HttpResponse<R>>;
  1247. /**
  1248. * Constructs a request which interprets the body as a JavaScript object and returns the full
  1249. * `HttpResponse` as a JavaScript object.
  1250. *
  1251. * @param method The HTTP method.
  1252. * @param url The endpoint URL.
  1253. * @param options The HTTP options to send with the request.
  1254. *
  1255. * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.
  1256. */
  1257. request(method: string, url: string, options?: {
  1258. body?: any;
  1259. headers?: HttpHeaders | Record<string, string | string[]>;
  1260. context?: HttpContext;
  1261. observe?: 'body';
  1262. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1263. responseType?: 'json';
  1264. reportProgress?: boolean;
  1265. withCredentials?: boolean;
  1266. transferCache?: {
  1267. includeHeaders?: string[];
  1268. } | boolean;
  1269. }): Observable<Object>;
  1270. /**
  1271. * Constructs a request which interprets the body as a JavaScript object
  1272. * with the response body of the requested type.
  1273. *
  1274. * @param method The HTTP method.
  1275. * @param url The endpoint URL.
  1276. * @param options The HTTP options to send with the request.
  1277. *
  1278. * @return An `Observable` of the `HttpResponse`, with the response body of type `R`.
  1279. */
  1280. request<R>(method: string, url: string, options?: {
  1281. body?: any;
  1282. headers?: HttpHeaders | Record<string, string | string[]>;
  1283. context?: HttpContext;
  1284. observe?: 'body';
  1285. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1286. responseType?: 'json';
  1287. reportProgress?: boolean;
  1288. withCredentials?: boolean;
  1289. transferCache?: {
  1290. includeHeaders?: string[];
  1291. } | boolean;
  1292. }): Observable<R>;
  1293. /**
  1294. * Constructs a request where response type and requested observable are not known statically.
  1295. *
  1296. * @param method The HTTP method.
  1297. * @param url The endpoint URL.
  1298. * @param options The HTTP options to send with the request.
  1299. *
  1300. * @return An `Observable` of the requested response, with body of type `any`.
  1301. */
  1302. request(method: string, url: string, options?: {
  1303. body?: any;
  1304. headers?: HttpHeaders | Record<string, string | string[]>;
  1305. context?: HttpContext;
  1306. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1307. observe?: 'body' | 'events' | 'response';
  1308. reportProgress?: boolean;
  1309. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  1310. withCredentials?: boolean;
  1311. transferCache?: {
  1312. includeHeaders?: string[];
  1313. } | boolean;
  1314. }): Observable<any>;
  1315. /**
  1316. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`
  1317. * and returns the response as an `ArrayBuffer`.
  1318. *
  1319. * @param url The endpoint URL.
  1320. * @param options The HTTP options to send with the request.
  1321. *
  1322. * @return An `Observable` of the response body as an `ArrayBuffer`.
  1323. */
  1324. delete(url: string, options: {
  1325. headers?: HttpHeaders | Record<string, string | string[]>;
  1326. context?: HttpContext;
  1327. observe?: 'body';
  1328. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1329. reportProgress?: boolean;
  1330. responseType: 'arraybuffer';
  1331. withCredentials?: boolean;
  1332. body?: any | null;
  1333. }): Observable<ArrayBuffer>;
  1334. /**
  1335. * Constructs a `DELETE` request that interprets the body as a `Blob` and returns
  1336. * the response as a `Blob`.
  1337. *
  1338. * @param url The endpoint URL.
  1339. * @param options The HTTP options to send with the request.
  1340. *
  1341. * @return An `Observable` of the response body as a `Blob`.
  1342. */
  1343. delete(url: string, options: {
  1344. headers?: HttpHeaders | Record<string, string | string[]>;
  1345. context?: HttpContext;
  1346. observe?: 'body';
  1347. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1348. reportProgress?: boolean;
  1349. responseType: 'blob';
  1350. withCredentials?: boolean;
  1351. body?: any | null;
  1352. }): Observable<Blob>;
  1353. /**
  1354. * Constructs a `DELETE` request that interprets the body as a text string and returns
  1355. * a string.
  1356. *
  1357. * @param url The endpoint URL.
  1358. * @param options The HTTP options to send with the request.
  1359. *
  1360. * @return An `Observable` of the response, with the response body of type string.
  1361. */
  1362. delete(url: string, options: {
  1363. headers?: HttpHeaders | Record<string, string | string[]>;
  1364. context?: HttpContext;
  1365. observe?: 'body';
  1366. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1367. reportProgress?: boolean;
  1368. responseType: 'text';
  1369. withCredentials?: boolean;
  1370. body?: any | null;
  1371. }): Observable<string>;
  1372. /**
  1373. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`
  1374. * and returns the full event stream.
  1375. *
  1376. * @param url The endpoint URL.
  1377. * @param options The HTTP options to send with the request.
  1378. *
  1379. * @return An `Observable` of all `HttpEvent`s for the request,
  1380. * with response body as an `ArrayBuffer`.
  1381. */
  1382. delete(url: string, options: {
  1383. headers?: HttpHeaders | Record<string, string | string[]>;
  1384. observe: 'events';
  1385. context?: HttpContext;
  1386. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1387. reportProgress?: boolean;
  1388. responseType: 'arraybuffer';
  1389. withCredentials?: boolean;
  1390. body?: any | null;
  1391. }): Observable<HttpEvent<ArrayBuffer>>;
  1392. /**
  1393. * Constructs a `DELETE` request that interprets the body as a `Blob`
  1394. * and returns the full event stream.
  1395. *
  1396. * @param url The endpoint URL.
  1397. * @param options The HTTP options to send with the request.
  1398. *
  1399. * @return An `Observable` of all the `HttpEvent`s for the request, with the response body as a
  1400. * `Blob`.
  1401. */
  1402. delete(url: string, options: {
  1403. headers?: HttpHeaders | Record<string, string | string[]>;
  1404. observe: 'events';
  1405. context?: HttpContext;
  1406. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1407. reportProgress?: boolean;
  1408. responseType: 'blob';
  1409. withCredentials?: boolean;
  1410. body?: any | null;
  1411. }): Observable<HttpEvent<Blob>>;
  1412. /**
  1413. * Constructs a `DELETE` request that interprets the body as a text string
  1414. * and returns the full event stream.
  1415. *
  1416. * @param url The endpoint URL.
  1417. * @param options The HTTP options to send with the request.
  1418. *
  1419. * @return An `Observable` of all `HttpEvent`s for the request, with the response
  1420. * body of type string.
  1421. */
  1422. delete(url: string, options: {
  1423. headers?: HttpHeaders | Record<string, string | string[]>;
  1424. observe: 'events';
  1425. context?: HttpContext;
  1426. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1427. reportProgress?: boolean;
  1428. responseType: 'text';
  1429. withCredentials?: boolean;
  1430. body?: any | null;
  1431. }): Observable<HttpEvent<string>>;
  1432. /**
  1433. * Constructs a `DELETE` request that interprets the body as JSON
  1434. * and returns the full event stream.
  1435. *
  1436. * @param url The endpoint URL.
  1437. * @param options The HTTP options to send with the request.
  1438. *
  1439. * @return An `Observable` of all `HttpEvent`s for the request, with response body of
  1440. * type `Object`.
  1441. */
  1442. delete(url: string, options: {
  1443. headers?: HttpHeaders | Record<string, string | string[]>;
  1444. observe: 'events';
  1445. context?: HttpContext;
  1446. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1447. reportProgress?: boolean;
  1448. responseType?: 'json';
  1449. withCredentials?: boolean;
  1450. body?: any | null;
  1451. }): Observable<HttpEvent<Object>>;
  1452. /**
  1453. * Constructs a `DELETE`request that interprets the body as JSON
  1454. * and returns the full event stream.
  1455. *
  1456. * @param url The endpoint URL.
  1457. * @param options The HTTP options to send with the request.
  1458. *
  1459. * @return An `Observable` of all the `HttpEvent`s for the request, with a response
  1460. * body in the requested type.
  1461. */
  1462. delete<T>(url: string, options: {
  1463. headers?: HttpHeaders | Record<string, string | string[]>;
  1464. observe: 'events';
  1465. context?: HttpContext;
  1466. params?: HttpParams | Record<string, string | number | boolean | (string | number | boolean)[]>;
  1467. reportProgress?: boolean;
  1468. responseType?: 'json';
  1469. withCredentials?: boolean;
  1470. body?: any | null;
  1471. }): Observable<HttpEvent<T>>;
  1472. /**
  1473. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` and returns
  1474. * the full `HttpResponse`.
  1475. *
  1476. * @param url The endpoint URL.
  1477. * @param options The HTTP options to send with the request.
  1478. *
  1479. * @return An `Observable` of the full `HttpResponse`, with the response body as an `ArrayBuffer`.
  1480. */
  1481. delete(url: string, options: {
  1482. headers?: HttpHeaders | Record<string, string | string[]>;
  1483. observe: 'response';
  1484. context?: HttpContext;
  1485. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1486. reportProgress?: boolean;
  1487. responseType: 'arraybuffer';
  1488. withCredentials?: boolean;
  1489. body?: any | null;
  1490. }): Observable<HttpResponse<ArrayBuffer>>;
  1491. /**
  1492. * Constructs a `DELETE` request that interprets the body as a `Blob` and returns the full
  1493. * `HttpResponse`.
  1494. *
  1495. * @param url The endpoint URL.
  1496. * @param options The HTTP options to send with the request.
  1497. *
  1498. * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.
  1499. */
  1500. delete(url: string, options: {
  1501. headers?: HttpHeaders | Record<string, string | string[]>;
  1502. observe: 'response';
  1503. context?: HttpContext;
  1504. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1505. reportProgress?: boolean;
  1506. responseType: 'blob';
  1507. withCredentials?: boolean;
  1508. body?: any | null;
  1509. }): Observable<HttpResponse<Blob>>;
  1510. /**
  1511. * Constructs a `DELETE` request that interprets the body as a text stream and
  1512. * returns the full `HttpResponse`.
  1513. *
  1514. * @param url The endpoint URL.
  1515. * @param options The HTTP options to send with the request.
  1516. *
  1517. * @return An `Observable` of the full `HttpResponse`, with the response body of type string.
  1518. */
  1519. delete(url: string, options: {
  1520. headers?: HttpHeaders | Record<string, string | string[]>;
  1521. observe: 'response';
  1522. context?: HttpContext;
  1523. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1524. reportProgress?: boolean;
  1525. responseType: 'text';
  1526. withCredentials?: boolean;
  1527. body?: any | null;
  1528. }): Observable<HttpResponse<string>>;
  1529. /**
  1530. * Constructs a `DELETE` request the interprets the body as a JavaScript object and returns
  1531. * the full `HttpResponse`.
  1532. *
  1533. * @param url The endpoint URL.
  1534. * @param options The HTTP options to send with the request.
  1535. *
  1536. * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.
  1537. *
  1538. */
  1539. delete(url: string, options: {
  1540. headers?: HttpHeaders | Record<string, string | string[]>;
  1541. observe: 'response';
  1542. context?: HttpContext;
  1543. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1544. reportProgress?: boolean;
  1545. responseType?: 'json';
  1546. withCredentials?: boolean;
  1547. body?: any | null;
  1548. }): Observable<HttpResponse<Object>>;
  1549. /**
  1550. * Constructs a `DELETE` request that interprets the body as JSON
  1551. * and returns the full `HttpResponse`.
  1552. *
  1553. * @param url The endpoint URL.
  1554. * @param options The HTTP options to send with the request.
  1555. *
  1556. * @return An `Observable` of the `HttpResponse`, with the response body of the requested type.
  1557. */
  1558. delete<T>(url: string, options: {
  1559. headers?: HttpHeaders | Record<string, string | string[]>;
  1560. observe: 'response';
  1561. context?: HttpContext;
  1562. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1563. reportProgress?: boolean;
  1564. responseType?: 'json';
  1565. withCredentials?: boolean;
  1566. body?: any | null;
  1567. }): Observable<HttpResponse<T>>;
  1568. /**
  1569. * Constructs a `DELETE` request that interprets the body as JSON and
  1570. * returns the response body as an object parsed from JSON.
  1571. *
  1572. * @param url The endpoint URL.
  1573. * @param options The HTTP options to send with the request.
  1574. *
  1575. * @return An `Observable` of the response, with the response body of type `Object`.
  1576. */
  1577. delete(url: string, options?: {
  1578. headers?: HttpHeaders | Record<string, string | string[]>;
  1579. context?: HttpContext;
  1580. observe?: 'body';
  1581. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1582. reportProgress?: boolean;
  1583. responseType?: 'json';
  1584. withCredentials?: boolean;
  1585. body?: any | null;
  1586. }): Observable<Object>;
  1587. /**
  1588. * Constructs a DELETE request that interprets the body as JSON and returns
  1589. * the response in a given type.
  1590. *
  1591. * @param url The endpoint URL.
  1592. * @param options The HTTP options to send with the request.
  1593. *
  1594. * @return An `Observable` of the `HttpResponse`, with response body in the requested type.
  1595. */
  1596. delete<T>(url: string, options?: {
  1597. headers?: HttpHeaders | Record<string, string | string[]>;
  1598. context?: HttpContext;
  1599. observe?: 'body';
  1600. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1601. reportProgress?: boolean;
  1602. responseType?: 'json';
  1603. withCredentials?: boolean;
  1604. body?: any | null;
  1605. }): Observable<T>;
  1606. /**
  1607. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns the
  1608. * response in an `ArrayBuffer`.
  1609. *
  1610. * @param url The endpoint URL.
  1611. * @param options The HTTP options to send with the request.
  1612. *
  1613. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  1614. */
  1615. get(url: string, options: {
  1616. headers?: HttpHeaders | Record<string, string | string[]>;
  1617. context?: HttpContext;
  1618. observe?: 'body';
  1619. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1620. reportProgress?: boolean;
  1621. responseType: 'arraybuffer';
  1622. withCredentials?: boolean;
  1623. transferCache?: {
  1624. includeHeaders?: string[];
  1625. } | boolean;
  1626. }): Observable<ArrayBuffer>;
  1627. /**
  1628. * Constructs a `GET` request that interprets the body as a `Blob`
  1629. * and returns the response as a `Blob`.
  1630. *
  1631. * @param url The endpoint URL.
  1632. * @param options The HTTP options to send with the request.
  1633. *
  1634. * @return An `Observable` of the response, with the response body as a `Blob`.
  1635. */
  1636. get(url: string, options: {
  1637. headers?: HttpHeaders | Record<string, string | string[]>;
  1638. context?: HttpContext;
  1639. observe?: 'body';
  1640. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1641. reportProgress?: boolean;
  1642. responseType: 'blob';
  1643. withCredentials?: boolean;
  1644. transferCache?: {
  1645. includeHeaders?: string[];
  1646. } | boolean;
  1647. }): Observable<Blob>;
  1648. /**
  1649. * Constructs a `GET` request that interprets the body as a text string
  1650. * and returns the response as a string value.
  1651. *
  1652. * @param url The endpoint URL.
  1653. * @param options The HTTP options to send with the request.
  1654. *
  1655. * @return An `Observable` of the response, with the response body of type string.
  1656. */
  1657. get(url: string, options: {
  1658. headers?: HttpHeaders | Record<string, string | string[]>;
  1659. context?: HttpContext;
  1660. observe?: 'body';
  1661. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1662. reportProgress?: boolean;
  1663. responseType: 'text';
  1664. withCredentials?: boolean;
  1665. transferCache?: {
  1666. includeHeaders?: string[];
  1667. } | boolean;
  1668. }): Observable<string>;
  1669. /**
  1670. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns
  1671. * the full event stream.
  1672. *
  1673. * @param url The endpoint URL.
  1674. * @param options The HTTP options to send with the request.
  1675. *
  1676. * @return An `Observable` of all `HttpEvent`s for the request, with the response
  1677. * body as an `ArrayBuffer`.
  1678. */
  1679. get(url: string, options: {
  1680. headers?: HttpHeaders | Record<string, string | string[]>;
  1681. observe: 'events';
  1682. context?: HttpContext;
  1683. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1684. reportProgress?: boolean;
  1685. responseType: 'arraybuffer';
  1686. withCredentials?: boolean;
  1687. transferCache?: {
  1688. includeHeaders?: string[];
  1689. } | boolean;
  1690. }): Observable<HttpEvent<ArrayBuffer>>;
  1691. /**
  1692. * Constructs a `GET` request that interprets the body as a `Blob` and
  1693. * returns the full event stream.
  1694. *
  1695. * @param url The endpoint URL.
  1696. * @param options The HTTP options to send with the request.
  1697. *
  1698. * @return An `Observable` of the response, with the response body as a `Blob`.
  1699. */
  1700. get(url: string, options: {
  1701. headers?: HttpHeaders | Record<string, string | string[]>;
  1702. observe: 'events';
  1703. context?: HttpContext;
  1704. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1705. reportProgress?: boolean;
  1706. responseType: 'blob';
  1707. withCredentials?: boolean;
  1708. transferCache?: {
  1709. includeHeaders?: string[];
  1710. } | boolean;
  1711. }): Observable<HttpEvent<Blob>>;
  1712. /**
  1713. * Constructs a `GET` request that interprets the body as a text string and returns
  1714. * the full event stream.
  1715. *
  1716. * @param url The endpoint URL.
  1717. * @param options The HTTP options to send with the request.
  1718. *
  1719. * @return An `Observable` of the response, with the response body of type string.
  1720. */
  1721. get(url: string, options: {
  1722. headers?: HttpHeaders | Record<string, string | string[]>;
  1723. observe: 'events';
  1724. context?: HttpContext;
  1725. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1726. reportProgress?: boolean;
  1727. responseType: 'text';
  1728. withCredentials?: boolean;
  1729. transferCache?: {
  1730. includeHeaders?: string[];
  1731. } | boolean;
  1732. }): Observable<HttpEvent<string>>;
  1733. /**
  1734. * Constructs a `GET` request that interprets the body as JSON
  1735. * and returns the full event stream.
  1736. *
  1737. * @param url The endpoint URL.
  1738. * @param options The HTTP options to send with the request.
  1739. *
  1740. * @return An `Observable` of the response, with the response body of type `Object`.
  1741. */
  1742. get(url: string, options: {
  1743. headers?: HttpHeaders | Record<string, string | string[]>;
  1744. observe: 'events';
  1745. context?: HttpContext;
  1746. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1747. reportProgress?: boolean;
  1748. responseType?: 'json';
  1749. withCredentials?: boolean;
  1750. transferCache?: {
  1751. includeHeaders?: string[];
  1752. } | boolean;
  1753. }): Observable<HttpEvent<Object>>;
  1754. /**
  1755. * Constructs a `GET` request that interprets the body as JSON and returns the full
  1756. * event stream.
  1757. *
  1758. * @param url The endpoint URL.
  1759. * @param options The HTTP options to send with the request.
  1760. *
  1761. * @return An `Observable` of the response, with a response body in the requested type.
  1762. */
  1763. get<T>(url: string, options: {
  1764. headers?: HttpHeaders | Record<string, string | string[]>;
  1765. observe: 'events';
  1766. context?: HttpContext;
  1767. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1768. reportProgress?: boolean;
  1769. responseType?: 'json';
  1770. withCredentials?: boolean;
  1771. transferCache?: {
  1772. includeHeaders?: string[];
  1773. } | boolean;
  1774. }): Observable<HttpEvent<T>>;
  1775. /**
  1776. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and
  1777. * returns the full `HttpResponse`.
  1778. *
  1779. * @param url The endpoint URL.
  1780. * @param options The HTTP options to send with the request.
  1781. *
  1782. * @return An `Observable` of the `HttpResponse` for the request,
  1783. * with the response body as an `ArrayBuffer`.
  1784. */
  1785. get(url: string, options: {
  1786. headers?: HttpHeaders | Record<string, string | string[]>;
  1787. observe: 'response';
  1788. context?: HttpContext;
  1789. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1790. reportProgress?: boolean;
  1791. responseType: 'arraybuffer';
  1792. withCredentials?: boolean;
  1793. transferCache?: {
  1794. includeHeaders?: string[];
  1795. } | boolean;
  1796. }): Observable<HttpResponse<ArrayBuffer>>;
  1797. /**
  1798. * Constructs a `GET` request that interprets the body as a `Blob` and
  1799. * returns the full `HttpResponse`.
  1800. *
  1801. * @param url The endpoint URL.
  1802. * @param options The HTTP options to send with the request.
  1803. *
  1804. * @return An `Observable` of the `HttpResponse` for the request,
  1805. * with the response body as a `Blob`.
  1806. */
  1807. get(url: string, options: {
  1808. headers?: HttpHeaders | Record<string, string | string[]>;
  1809. observe: 'response';
  1810. context?: HttpContext;
  1811. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1812. reportProgress?: boolean;
  1813. responseType: 'blob';
  1814. withCredentials?: boolean;
  1815. transferCache?: {
  1816. includeHeaders?: string[];
  1817. } | boolean;
  1818. }): Observable<HttpResponse<Blob>>;
  1819. /**
  1820. * Constructs a `GET` request that interprets the body as a text stream and
  1821. * returns the full `HttpResponse`.
  1822. *
  1823. * @param url The endpoint URL.
  1824. * @param options The HTTP options to send with the request.
  1825. *
  1826. * @return An `Observable` of the `HttpResponse` for the request,
  1827. * with the response body of type string.
  1828. */
  1829. get(url: string, options: {
  1830. headers?: HttpHeaders | Record<string, string | string[]>;
  1831. observe: 'response';
  1832. context?: HttpContext;
  1833. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1834. reportProgress?: boolean;
  1835. responseType: 'text';
  1836. withCredentials?: boolean;
  1837. transferCache?: {
  1838. includeHeaders?: string[];
  1839. } | boolean;
  1840. }): Observable<HttpResponse<string>>;
  1841. /**
  1842. * Constructs a `GET` request that interprets the body as JSON and
  1843. * returns the full `HttpResponse`.
  1844. *
  1845. * @param url The endpoint URL.
  1846. * @param options The HTTP options to send with the request.
  1847. *
  1848. * @return An `Observable` of the full `HttpResponse`,
  1849. * with the response body of type `Object`.
  1850. */
  1851. get(url: string, options: {
  1852. headers?: HttpHeaders | Record<string, string | string[]>;
  1853. observe: 'response';
  1854. context?: HttpContext;
  1855. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1856. reportProgress?: boolean;
  1857. responseType?: 'json';
  1858. withCredentials?: boolean;
  1859. transferCache?: {
  1860. includeHeaders?: string[];
  1861. } | boolean;
  1862. }): Observable<HttpResponse<Object>>;
  1863. /**
  1864. * Constructs a `GET` request that interprets the body as JSON and
  1865. * returns the full `HttpResponse`.
  1866. *
  1867. * @param url The endpoint URL.
  1868. * @param options The HTTP options to send with the request.
  1869. *
  1870. * @return An `Observable` of the full `HttpResponse` for the request,
  1871. * with a response body in the requested type.
  1872. */
  1873. get<T>(url: string, options: {
  1874. headers?: HttpHeaders | Record<string, string | string[]>;
  1875. observe: 'response';
  1876. context?: HttpContext;
  1877. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1878. reportProgress?: boolean;
  1879. responseType?: 'json';
  1880. withCredentials?: boolean;
  1881. transferCache?: {
  1882. includeHeaders?: string[];
  1883. } | boolean;
  1884. }): Observable<HttpResponse<T>>;
  1885. /**
  1886. * Constructs a `GET` request that interprets the body as JSON and
  1887. * returns the response body as an object parsed from JSON.
  1888. *
  1889. * @param url The endpoint URL.
  1890. * @param options The HTTP options to send with the request.
  1891. *
  1892. *
  1893. * @return An `Observable` of the response body as a JavaScript object.
  1894. */
  1895. get(url: string, options?: {
  1896. headers?: HttpHeaders | Record<string, string | string[]>;
  1897. context?: HttpContext;
  1898. observe?: 'body';
  1899. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1900. reportProgress?: boolean;
  1901. responseType?: 'json';
  1902. withCredentials?: boolean;
  1903. transferCache?: {
  1904. includeHeaders?: string[];
  1905. } | boolean;
  1906. }): Observable<Object>;
  1907. /**
  1908. * Constructs a `GET` request that interprets the body as JSON and returns
  1909. * the response body in a given type.
  1910. *
  1911. * @param url The endpoint URL.
  1912. * @param options The HTTP options to send with the request.
  1913. *
  1914. * @return An `Observable` of the `HttpResponse`, with a response body in the requested type.
  1915. */
  1916. get<T>(url: string, options?: {
  1917. headers?: HttpHeaders | Record<string, string | string[]>;
  1918. context?: HttpContext;
  1919. observe?: 'body';
  1920. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1921. reportProgress?: boolean;
  1922. responseType?: 'json';
  1923. withCredentials?: boolean;
  1924. transferCache?: {
  1925. includeHeaders?: string[];
  1926. } | boolean;
  1927. }): Observable<T>;
  1928. /**
  1929. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer` and
  1930. * returns the response as an `ArrayBuffer`.
  1931. *
  1932. * @param url The endpoint URL.
  1933. * @param options The HTTP options to send with the request.
  1934. *
  1935. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  1936. */
  1937. head(url: string, options: {
  1938. headers?: HttpHeaders | Record<string, string | string[]>;
  1939. context?: HttpContext;
  1940. observe?: 'body';
  1941. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1942. reportProgress?: boolean;
  1943. responseType: 'arraybuffer';
  1944. withCredentials?: boolean;
  1945. transferCache?: {
  1946. includeHeaders?: string[];
  1947. } | boolean;
  1948. }): Observable<ArrayBuffer>;
  1949. /**
  1950. * Constructs a `HEAD` request that interprets the body as a `Blob` and returns
  1951. * the response as a `Blob`.
  1952. *
  1953. * @param url The endpoint URL.
  1954. * @param options The HTTP options to send with the request.
  1955. *
  1956. * @return An `Observable` of the response, with the response body as a `Blob`.
  1957. */
  1958. head(url: string, options: {
  1959. headers?: HttpHeaders | Record<string, string | string[]>;
  1960. context?: HttpContext;
  1961. observe?: 'body';
  1962. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1963. reportProgress?: boolean;
  1964. responseType: 'blob';
  1965. withCredentials?: boolean;
  1966. transferCache?: {
  1967. includeHeaders?: string[];
  1968. } | boolean;
  1969. }): Observable<Blob>;
  1970. /**
  1971. * Constructs a `HEAD` request that interprets the body as a text string and returns the response
  1972. * as a string value.
  1973. *
  1974. * @param url The endpoint URL.
  1975. * @param options The HTTP options to send with the request.
  1976. *
  1977. * @return An `Observable` of the response, with the response body of type string.
  1978. */
  1979. head(url: string, options: {
  1980. headers?: HttpHeaders | Record<string, string | string[]>;
  1981. context?: HttpContext;
  1982. observe?: 'body';
  1983. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1984. reportProgress?: boolean;
  1985. responseType: 'text';
  1986. withCredentials?: boolean;
  1987. transferCache?: {
  1988. includeHeaders?: string[];
  1989. } | boolean;
  1990. }): Observable<string>;
  1991. /**
  1992. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`
  1993. * and returns the full event stream.
  1994. *
  1995. * @param url The endpoint URL.
  1996. * @param options The HTTP options to send with the request.
  1997. *
  1998. * @return An `Observable` of all `HttpEvent`s for the request,
  1999. * with the response body as an `ArrayBuffer`.
  2000. */
  2001. head(url: string, options: {
  2002. headers?: HttpHeaders | Record<string, string | string[]>;
  2003. observe: 'events';
  2004. context?: HttpContext;
  2005. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2006. reportProgress?: boolean;
  2007. responseType: 'arraybuffer';
  2008. withCredentials?: boolean;
  2009. transferCache?: {
  2010. includeHeaders?: string[];
  2011. } | boolean;
  2012. }): Observable<HttpEvent<ArrayBuffer>>;
  2013. /**
  2014. * Constructs a `HEAD` request that interprets the body as a `Blob` and
  2015. * returns the full event stream.
  2016. *
  2017. * @param url The endpoint URL.
  2018. * @param options The HTTP options to send with the request.
  2019. *
  2020. * @return An `Observable` of all `HttpEvent`s for the request,
  2021. * with the response body as a `Blob`.
  2022. */
  2023. head(url: string, options: {
  2024. headers?: HttpHeaders | Record<string, string | string[]>;
  2025. observe: 'events';
  2026. context?: HttpContext;
  2027. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2028. reportProgress?: boolean;
  2029. responseType: 'blob';
  2030. withCredentials?: boolean;
  2031. transferCache?: {
  2032. includeHeaders?: string[];
  2033. } | boolean;
  2034. }): Observable<HttpEvent<Blob>>;
  2035. /**
  2036. * Constructs a `HEAD` request that interprets the body as a text string
  2037. * and returns the full event stream.
  2038. *
  2039. * @param url The endpoint URL.
  2040. * @param options The HTTP options to send with the request.
  2041. *
  2042. * @return An `Observable` of all `HttpEvent`s for the request, with the response body of type
  2043. * string.
  2044. */
  2045. head(url: string, options: {
  2046. headers?: HttpHeaders | Record<string, string | string[]>;
  2047. observe: 'events';
  2048. context?: HttpContext;
  2049. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2050. reportProgress?: boolean;
  2051. responseType: 'text';
  2052. withCredentials?: boolean;
  2053. transferCache?: {
  2054. includeHeaders?: string[];
  2055. } | boolean;
  2056. }): Observable<HttpEvent<string>>;
  2057. /**
  2058. * Constructs a `HEAD` request that interprets the body as JSON
  2059. * and returns the full HTTP event stream.
  2060. *
  2061. * @param url The endpoint URL.
  2062. * @param options The HTTP options to send with the request.
  2063. *
  2064. * @return An `Observable` of all `HttpEvent`s for the request, with a response body of
  2065. * type `Object`.
  2066. */
  2067. head(url: string, options: {
  2068. headers?: HttpHeaders | Record<string, string | string[]>;
  2069. observe: 'events';
  2070. context?: HttpContext;
  2071. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2072. reportProgress?: boolean;
  2073. responseType?: 'json';
  2074. withCredentials?: boolean;
  2075. transferCache?: {
  2076. includeHeaders?: string[];
  2077. } | boolean;
  2078. }): Observable<HttpEvent<Object>>;
  2079. /**
  2080. * Constructs a `HEAD` request that interprets the body as JSON and
  2081. * returns the full event stream.
  2082. *
  2083. * @return An `Observable` of all the `HttpEvent`s for the request,
  2084. * with a response body in the requested type.
  2085. *
  2086. * @param url The endpoint URL.
  2087. * @param options The HTTP options to send with the request.
  2088. */
  2089. head<T>(url: string, options: {
  2090. headers?: HttpHeaders | Record<string, string | string[]>;
  2091. observe: 'events';
  2092. context?: HttpContext;
  2093. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2094. reportProgress?: boolean;
  2095. responseType?: 'json';
  2096. withCredentials?: boolean;
  2097. transferCache?: {
  2098. includeHeaders?: string[];
  2099. } | boolean;
  2100. }): Observable<HttpEvent<T>>;
  2101. /**
  2102. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`
  2103. * and returns the full HTTP response.
  2104. *
  2105. * @param url The endpoint URL.
  2106. * @param options The HTTP options to send with the request.
  2107. *
  2108. * @return An `Observable` of the `HttpResponse` for the request,
  2109. * with the response body as an `ArrayBuffer`.
  2110. */
  2111. head(url: string, options: {
  2112. headers?: HttpHeaders | Record<string, string | string[]>;
  2113. observe: 'response';
  2114. context?: HttpContext;
  2115. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2116. reportProgress?: boolean;
  2117. responseType: 'arraybuffer';
  2118. withCredentials?: boolean;
  2119. transferCache?: {
  2120. includeHeaders?: string[];
  2121. } | boolean;
  2122. }): Observable<HttpResponse<ArrayBuffer>>;
  2123. /**
  2124. * Constructs a `HEAD` request that interprets the body as a `Blob` and returns
  2125. * the full `HttpResponse`.
  2126. *
  2127. * @param url The endpoint URL.
  2128. * @param options The HTTP options to send with the request.
  2129. *
  2130. * @return An `Observable` of the `HttpResponse` for the request,
  2131. * with the response body as a blob.
  2132. */
  2133. head(url: string, options: {
  2134. headers?: HttpHeaders | Record<string, string | string[]>;
  2135. observe: 'response';
  2136. context?: HttpContext;
  2137. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2138. reportProgress?: boolean;
  2139. responseType: 'blob';
  2140. withCredentials?: boolean;
  2141. transferCache?: {
  2142. includeHeaders?: string[];
  2143. } | boolean;
  2144. }): Observable<HttpResponse<Blob>>;
  2145. /**
  2146. * Constructs a `HEAD` request that interprets the body as text stream
  2147. * and returns the full `HttpResponse`.
  2148. *
  2149. * @param url The endpoint URL.
  2150. * @param options The HTTP options to send with the request.
  2151. *
  2152. * @return An `Observable` of the `HttpResponse` for the request,
  2153. * with the response body of type string.
  2154. */
  2155. head(url: string, options: {
  2156. headers?: HttpHeaders | Record<string, string | string[]>;
  2157. observe: 'response';
  2158. context?: HttpContext;
  2159. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2160. reportProgress?: boolean;
  2161. responseType: 'text';
  2162. withCredentials?: boolean;
  2163. transferCache?: {
  2164. includeHeaders?: string[];
  2165. } | boolean;
  2166. }): Observable<HttpResponse<string>>;
  2167. /**
  2168. * Constructs a `HEAD` request that interprets the body as JSON and
  2169. * returns the full `HttpResponse`.
  2170. *
  2171. * @param url The endpoint URL.
  2172. * @param options The HTTP options to send with the request.
  2173. *
  2174. * @return An `Observable` of the `HttpResponse` for the request,
  2175. * with the response body of type `Object`.
  2176. */
  2177. head(url: string, options: {
  2178. headers?: HttpHeaders | Record<string, string | string[]>;
  2179. observe: 'response';
  2180. context?: HttpContext;
  2181. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2182. reportProgress?: boolean;
  2183. responseType?: 'json';
  2184. withCredentials?: boolean;
  2185. transferCache?: {
  2186. includeHeaders?: string[];
  2187. } | boolean;
  2188. }): Observable<HttpResponse<Object>>;
  2189. /**
  2190. * Constructs a `HEAD` request that interprets the body as JSON
  2191. * and returns the full `HttpResponse`.
  2192. *
  2193. * @param url The endpoint URL.
  2194. * @param options The HTTP options to send with the request.
  2195. *
  2196. * @return An `Observable` of the `HttpResponse` for the request,
  2197. * with a response body of the requested type.
  2198. */
  2199. head<T>(url: string, options: {
  2200. headers?: HttpHeaders | Record<string, string | string[]>;
  2201. observe: 'response';
  2202. context?: HttpContext;
  2203. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2204. reportProgress?: boolean;
  2205. responseType?: 'json';
  2206. withCredentials?: boolean;
  2207. transferCache?: {
  2208. includeHeaders?: string[];
  2209. } | boolean;
  2210. }): Observable<HttpResponse<T>>;
  2211. /**
  2212. * Constructs a `HEAD` request that interprets the body as JSON and
  2213. * returns the response body as an object parsed from JSON.
  2214. *
  2215. * @param url The endpoint URL.
  2216. * @param options The HTTP options to send with the request.
  2217. *
  2218. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  2219. */
  2220. head(url: string, options?: {
  2221. headers?: HttpHeaders | Record<string, string | string[]>;
  2222. context?: HttpContext;
  2223. observe?: 'body';
  2224. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2225. reportProgress?: boolean;
  2226. responseType?: 'json';
  2227. withCredentials?: boolean;
  2228. transferCache?: {
  2229. includeHeaders?: string[];
  2230. } | boolean;
  2231. }): Observable<Object>;
  2232. /**
  2233. * Constructs a `HEAD` request that interprets the body as JSON and returns
  2234. * the response in a given type.
  2235. *
  2236. * @param url The endpoint URL.
  2237. * @param options The HTTP options to send with the request.
  2238. *
  2239. * @return An `Observable` of the `HttpResponse` for the request,
  2240. * with a response body of the given type.
  2241. */
  2242. head<T>(url: string, options?: {
  2243. headers?: HttpHeaders | Record<string, string | string[]>;
  2244. context?: HttpContext;
  2245. observe?: 'body';
  2246. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2247. reportProgress?: boolean;
  2248. responseType?: 'json';
  2249. withCredentials?: boolean;
  2250. transferCache?: {
  2251. includeHeaders?: string[];
  2252. } | boolean;
  2253. }): Observable<T>;
  2254. /**
  2255. * Constructs a `JSONP` request for the given URL and name of the callback parameter.
  2256. *
  2257. * @param url The resource URL.
  2258. * @param callbackParam The callback function name.
  2259. *
  2260. * @return An `Observable` of the response object, with response body as an object.
  2261. */
  2262. jsonp(url: string, callbackParam: string): Observable<Object>;
  2263. /**
  2264. * Constructs a `JSONP` request for the given URL and name of the callback parameter.
  2265. *
  2266. * @param url The resource URL.
  2267. * @param callbackParam The callback function name.
  2268. *
  2269. * You must install a suitable interceptor, such as one provided by `HttpClientJsonpModule`.
  2270. * If no such interceptor is reached,
  2271. * then the `JSONP` request can be rejected by the configured backend.
  2272. *
  2273. * @return An `Observable` of the response object, with response body in the requested type.
  2274. */
  2275. jsonp<T>(url: string, callbackParam: string): Observable<T>;
  2276. /**
  2277. * Constructs an `OPTIONS` request that interprets the body as an
  2278. * `ArrayBuffer` and returns the response as an `ArrayBuffer`.
  2279. *
  2280. * @param url The endpoint URL.
  2281. * @param options HTTP options.
  2282. *
  2283. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  2284. */
  2285. options(url: string, options: {
  2286. headers?: HttpHeaders | Record<string, string | string[]>;
  2287. context?: HttpContext;
  2288. observe?: 'body';
  2289. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2290. reportProgress?: boolean;
  2291. responseType: 'arraybuffer';
  2292. withCredentials?: boolean;
  2293. }): Observable<ArrayBuffer>;
  2294. /**
  2295. * Constructs an `OPTIONS` request that interprets the body as a `Blob` and returns
  2296. * the response as a `Blob`.
  2297. *
  2298. * @param url The endpoint URL.
  2299. * @param options HTTP options.
  2300. *
  2301. * @return An `Observable` of the response, with the response body as a `Blob`.
  2302. */
  2303. options(url: string, options: {
  2304. headers?: HttpHeaders | Record<string, string | string[]>;
  2305. context?: HttpContext;
  2306. observe?: 'body';
  2307. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2308. reportProgress?: boolean;
  2309. responseType: 'blob';
  2310. withCredentials?: boolean;
  2311. }): Observable<Blob>;
  2312. /**
  2313. * Constructs an `OPTIONS` request that interprets the body as a text string and
  2314. * returns a string value.
  2315. *
  2316. * @param url The endpoint URL.
  2317. * @param options HTTP options.
  2318. *
  2319. * @return An `Observable` of the response, with the response body of type string.
  2320. */
  2321. options(url: string, options: {
  2322. headers?: HttpHeaders | Record<string, string | string[]>;
  2323. context?: HttpContext;
  2324. observe?: 'body';
  2325. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2326. reportProgress?: boolean;
  2327. responseType: 'text';
  2328. withCredentials?: boolean;
  2329. }): Observable<string>;
  2330. /**
  2331. * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`
  2332. * and returns the full event stream.
  2333. *
  2334. * @param url The endpoint URL.
  2335. * @param options HTTP options.
  2336. *
  2337. * @return An `Observable` of all `HttpEvent`s for the request,
  2338. * with the response body as an `ArrayBuffer`.
  2339. */
  2340. options(url: string, options: {
  2341. headers?: HttpHeaders | Record<string, string | string[]>;
  2342. observe: 'events';
  2343. context?: HttpContext;
  2344. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2345. reportProgress?: boolean;
  2346. responseType: 'arraybuffer';
  2347. withCredentials?: boolean;
  2348. }): Observable<HttpEvent<ArrayBuffer>>;
  2349. /**
  2350. * Constructs an `OPTIONS` request that interprets the body as a `Blob` and
  2351. * returns the full event stream.
  2352. *
  2353. * @param url The endpoint URL.
  2354. * @param options HTTP options.
  2355. *
  2356. * @return An `Observable` of all `HttpEvent`s for the request,
  2357. * with the response body as a `Blob`.
  2358. */
  2359. options(url: string, options: {
  2360. headers?: HttpHeaders | Record<string, string | string[]>;
  2361. observe: 'events';
  2362. context?: HttpContext;
  2363. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2364. reportProgress?: boolean;
  2365. responseType: 'blob';
  2366. withCredentials?: boolean;
  2367. }): Observable<HttpEvent<Blob>>;
  2368. /**
  2369. * Constructs an `OPTIONS` request that interprets the body as a text string
  2370. * and returns the full event stream.
  2371. *
  2372. * @param url The endpoint URL.
  2373. * @param options HTTP options.
  2374. *
  2375. * @return An `Observable` of all the `HttpEvent`s for the request,
  2376. * with the response body of type string.
  2377. */
  2378. options(url: string, options: {
  2379. headers?: HttpHeaders | Record<string, string | string[]>;
  2380. observe: 'events';
  2381. context?: HttpContext;
  2382. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2383. reportProgress?: boolean;
  2384. responseType: 'text';
  2385. withCredentials?: boolean;
  2386. }): Observable<HttpEvent<string>>;
  2387. /**
  2388. * Constructs an `OPTIONS` request that interprets the body as JSON
  2389. * and returns the full event stream.
  2390. *
  2391. * @param url The endpoint URL.
  2392. * @param options HTTP options.
  2393. *
  2394. * @return An `Observable` of all the `HttpEvent`s for the request with the response
  2395. * body of type `Object`.
  2396. */
  2397. options(url: string, options: {
  2398. headers?: HttpHeaders | Record<string, string | string[]>;
  2399. observe: 'events';
  2400. context?: HttpContext;
  2401. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2402. reportProgress?: boolean;
  2403. responseType?: 'json';
  2404. withCredentials?: boolean;
  2405. }): Observable<HttpEvent<Object>>;
  2406. /**
  2407. * Constructs an `OPTIONS` request that interprets the body as JSON and
  2408. * returns the full event stream.
  2409. *
  2410. * @param url The endpoint URL.
  2411. * @param options HTTP options.
  2412. *
  2413. * @return An `Observable` of all the `HttpEvent`s for the request,
  2414. * with a response body in the requested type.
  2415. */
  2416. options<T>(url: string, options: {
  2417. headers?: HttpHeaders | Record<string, string | string[]>;
  2418. observe: 'events';
  2419. context?: HttpContext;
  2420. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2421. reportProgress?: boolean;
  2422. responseType?: 'json';
  2423. withCredentials?: boolean;
  2424. }): Observable<HttpEvent<T>>;
  2425. /**
  2426. * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`
  2427. * and returns the full HTTP response.
  2428. *
  2429. * @param url The endpoint URL.
  2430. * @param options HTTP options.
  2431. *
  2432. * @return An `Observable` of the `HttpResponse` for the request,
  2433. * with the response body as an `ArrayBuffer`.
  2434. */
  2435. options(url: string, options: {
  2436. headers?: HttpHeaders | Record<string, string | string[]>;
  2437. observe: 'response';
  2438. context?: HttpContext;
  2439. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2440. reportProgress?: boolean;
  2441. responseType: 'arraybuffer';
  2442. withCredentials?: boolean;
  2443. }): Observable<HttpResponse<ArrayBuffer>>;
  2444. /**
  2445. * Constructs an `OPTIONS` request that interprets the body as a `Blob`
  2446. * and returns the full `HttpResponse`.
  2447. *
  2448. * @param url The endpoint URL.
  2449. * @param options HTTP options.
  2450. *
  2451. * @return An `Observable` of the `HttpResponse` for the request,
  2452. * with the response body as a `Blob`.
  2453. */
  2454. options(url: string, options: {
  2455. headers?: HttpHeaders | Record<string, string | string[]>;
  2456. observe: 'response';
  2457. context?: HttpContext;
  2458. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2459. reportProgress?: boolean;
  2460. responseType: 'blob';
  2461. withCredentials?: boolean;
  2462. }): Observable<HttpResponse<Blob>>;
  2463. /**
  2464. * Constructs an `OPTIONS` request that interprets the body as text stream
  2465. * and returns the full `HttpResponse`.
  2466. *
  2467. * @param url The endpoint URL.
  2468. * @param options HTTP options.
  2469. *
  2470. * @return An `Observable` of the `HttpResponse` for the request,
  2471. * with the response body of type string.
  2472. */
  2473. options(url: string, options: {
  2474. headers?: HttpHeaders | Record<string, string | string[]>;
  2475. observe: 'response';
  2476. context?: HttpContext;
  2477. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2478. reportProgress?: boolean;
  2479. responseType: 'text';
  2480. withCredentials?: boolean;
  2481. }): Observable<HttpResponse<string>>;
  2482. /**
  2483. * Constructs an `OPTIONS` request that interprets the body as JSON
  2484. * and returns the full `HttpResponse`.
  2485. *
  2486. * @param url The endpoint URL.
  2487. * @param options HTTP options.
  2488. *
  2489. * @return An `Observable` of the `HttpResponse` for the request,
  2490. * with the response body of type `Object`.
  2491. */
  2492. options(url: string, options: {
  2493. headers?: HttpHeaders | Record<string, string | string[]>;
  2494. observe: 'response';
  2495. context?: HttpContext;
  2496. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2497. reportProgress?: boolean;
  2498. responseType?: 'json';
  2499. withCredentials?: boolean;
  2500. }): Observable<HttpResponse<Object>>;
  2501. /**
  2502. * Constructs an `OPTIONS` request that interprets the body as JSON and
  2503. * returns the full `HttpResponse`.
  2504. *
  2505. * @param url The endpoint URL.
  2506. * @param options HTTP options.
  2507. *
  2508. * @return An `Observable` of the `HttpResponse` for the request,
  2509. * with a response body in the requested type.
  2510. */
  2511. options<T>(url: string, options: {
  2512. headers?: HttpHeaders | Record<string, string | string[]>;
  2513. observe: 'response';
  2514. context?: HttpContext;
  2515. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2516. reportProgress?: boolean;
  2517. responseType?: 'json';
  2518. withCredentials?: boolean;
  2519. }): Observable<HttpResponse<T>>;
  2520. /**
  2521. * Constructs an `OPTIONS` request that interprets the body as JSON and returns the
  2522. * response body as an object parsed from JSON.
  2523. *
  2524. * @param url The endpoint URL.
  2525. * @param options HTTP options.
  2526. *
  2527. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  2528. */
  2529. options(url: string, options?: {
  2530. headers?: HttpHeaders | Record<string, string | string[]>;
  2531. context?: HttpContext;
  2532. observe?: 'body';
  2533. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2534. reportProgress?: boolean;
  2535. responseType?: 'json';
  2536. withCredentials?: boolean;
  2537. }): Observable<Object>;
  2538. /**
  2539. * Constructs an `OPTIONS` request that interprets the body as JSON and returns the
  2540. * response in a given type.
  2541. *
  2542. * @param url The endpoint URL.
  2543. * @param options HTTP options.
  2544. *
  2545. * @return An `Observable` of the `HttpResponse`, with a response body of the given type.
  2546. */
  2547. options<T>(url: string, options?: {
  2548. headers?: HttpHeaders | Record<string, string | string[]>;
  2549. context?: HttpContext;
  2550. observe?: 'body';
  2551. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2552. reportProgress?: boolean;
  2553. responseType?: 'json';
  2554. withCredentials?: boolean;
  2555. }): Observable<T>;
  2556. /**
  2557. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and returns
  2558. * the response as an `ArrayBuffer`.
  2559. *
  2560. * @param url The endpoint URL.
  2561. * @param body The resources to edit.
  2562. * @param options HTTP options.
  2563. *
  2564. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  2565. */
  2566. patch(url: string, body: any | null, options: {
  2567. headers?: HttpHeaders | Record<string, string | string[]>;
  2568. context?: HttpContext;
  2569. observe?: 'body';
  2570. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2571. reportProgress?: boolean;
  2572. responseType: 'arraybuffer';
  2573. withCredentials?: boolean;
  2574. }): Observable<ArrayBuffer>;
  2575. /**
  2576. * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the response
  2577. * as a `Blob`.
  2578. *
  2579. * @param url The endpoint URL.
  2580. * @param body The resources to edit.
  2581. * @param options HTTP options.
  2582. *
  2583. * @return An `Observable` of the response, with the response body as a `Blob`.
  2584. */
  2585. patch(url: string, body: any | null, options: {
  2586. headers?: HttpHeaders | Record<string, string | string[]>;
  2587. context?: HttpContext;
  2588. observe?: 'body';
  2589. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2590. reportProgress?: boolean;
  2591. responseType: 'blob';
  2592. withCredentials?: boolean;
  2593. }): Observable<Blob>;
  2594. /**
  2595. * Constructs a `PATCH` request that interprets the body as a text string and
  2596. * returns the response as a string value.
  2597. *
  2598. * @param url The endpoint URL.
  2599. * @param body The resources to edit.
  2600. * @param options HTTP options.
  2601. *
  2602. * @return An `Observable` of the response, with a response body of type string.
  2603. */
  2604. patch(url: string, body: any | null, options: {
  2605. headers?: HttpHeaders | Record<string, string | string[]>;
  2606. context?: HttpContext;
  2607. observe?: 'body';
  2608. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2609. reportProgress?: boolean;
  2610. responseType: 'text';
  2611. withCredentials?: boolean;
  2612. }): Observable<string>;
  2613. /**
  2614. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and
  2615. * returns the full event stream.
  2616. *
  2617. * @param url The endpoint URL.
  2618. * @param body The resources to edit.
  2619. * @param options HTTP options.
  2620. *
  2621. * @return An `Observable` of all the `HttpEvent`s for the request,
  2622. * with the response body as an `ArrayBuffer`.
  2623. */
  2624. patch(url: string, body: any | null, options: {
  2625. headers?: HttpHeaders | Record<string, string | string[]>;
  2626. observe: 'events';
  2627. context?: HttpContext;
  2628. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2629. reportProgress?: boolean;
  2630. responseType: 'arraybuffer';
  2631. withCredentials?: boolean;
  2632. }): Observable<HttpEvent<ArrayBuffer>>;
  2633. /**
  2634. * Constructs a `PATCH` request that interprets the body as a `Blob`
  2635. * and returns the full event stream.
  2636. *
  2637. * @param url The endpoint URL.
  2638. * @param body The resources to edit.
  2639. * @param options HTTP options.
  2640. *
  2641. * @return An `Observable` of all the `HttpEvent`s for the request, with the
  2642. * response body as `Blob`.
  2643. */
  2644. patch(url: string, body: any | null, options: {
  2645. headers?: HttpHeaders | Record<string, string | string[]>;
  2646. observe: 'events';
  2647. context?: HttpContext;
  2648. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2649. reportProgress?: boolean;
  2650. responseType: 'blob';
  2651. withCredentials?: boolean;
  2652. }): Observable<HttpEvent<Blob>>;
  2653. /**
  2654. * Constructs a `PATCH` request that interprets the body as a text string and
  2655. * returns the full event stream.
  2656. *
  2657. * @param url The endpoint URL.
  2658. * @param body The resources to edit.
  2659. * @param options HTTP options.
  2660. *
  2661. * @return An `Observable` of all the `HttpEvent`s for the request, with a
  2662. * response body of type string.
  2663. */
  2664. patch(url: string, body: any | null, options: {
  2665. headers?: HttpHeaders | Record<string, string | string[]>;
  2666. observe: 'events';
  2667. context?: HttpContext;
  2668. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2669. reportProgress?: boolean;
  2670. responseType: 'text';
  2671. withCredentials?: boolean;
  2672. }): Observable<HttpEvent<string>>;
  2673. /**
  2674. * Constructs a `PATCH` request that interprets the body as JSON
  2675. * and returns the full event stream.
  2676. *
  2677. * @param url The endpoint URL.
  2678. * @param body The resources to edit.
  2679. * @param options HTTP options.
  2680. *
  2681. * @return An `Observable` of all the `HttpEvent`s for the request,
  2682. * with a response body of type `Object`.
  2683. */
  2684. patch(url: string, body: any | null, options: {
  2685. headers?: HttpHeaders | Record<string, string | string[]>;
  2686. observe: 'events';
  2687. context?: HttpContext;
  2688. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2689. reportProgress?: boolean;
  2690. responseType?: 'json';
  2691. withCredentials?: boolean;
  2692. }): Observable<HttpEvent<Object>>;
  2693. /**
  2694. * Constructs a `PATCH` request that interprets the body as JSON
  2695. * and returns the full event stream.
  2696. *
  2697. * @param url The endpoint URL.
  2698. * @param body The resources to edit.
  2699. * @param options HTTP options.
  2700. *
  2701. * @return An `Observable` of all the `HttpEvent`s for the request,
  2702. * with a response body in the requested type.
  2703. */
  2704. patch<T>(url: string, body: any | null, options: {
  2705. headers?: HttpHeaders | Record<string, string | string[]>;
  2706. observe: 'events';
  2707. context?: HttpContext;
  2708. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2709. reportProgress?: boolean;
  2710. responseType?: 'json';
  2711. withCredentials?: boolean;
  2712. }): Observable<HttpEvent<T>>;
  2713. /**
  2714. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer`
  2715. * and returns the full `HttpResponse`.
  2716. *
  2717. * @param url The endpoint URL.
  2718. * @param body The resources to edit.
  2719. * @param options HTTP options.
  2720. *
  2721. * @return An `Observable` of the `HttpResponse` for the request,
  2722. * with the response body as an `ArrayBuffer`.
  2723. */
  2724. patch(url: string, body: any | null, options: {
  2725. headers?: HttpHeaders | Record<string, string | string[]>;
  2726. observe: 'response';
  2727. context?: HttpContext;
  2728. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2729. reportProgress?: boolean;
  2730. responseType: 'arraybuffer';
  2731. withCredentials?: boolean;
  2732. }): Observable<HttpResponse<ArrayBuffer>>;
  2733. /**
  2734. * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the full
  2735. * `HttpResponse`.
  2736. *
  2737. * @param url The endpoint URL.
  2738. * @param body The resources to edit.
  2739. * @param options HTTP options.
  2740. *
  2741. * @return An `Observable` of the `HttpResponse` for the request,
  2742. * with the response body as a `Blob`.
  2743. */
  2744. patch(url: string, body: any | null, options: {
  2745. headers?: HttpHeaders | Record<string, string | string[]>;
  2746. observe: 'response';
  2747. context?: HttpContext;
  2748. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2749. reportProgress?: boolean;
  2750. responseType: 'blob';
  2751. withCredentials?: boolean;
  2752. }): Observable<HttpResponse<Blob>>;
  2753. /**
  2754. * Constructs a `PATCH` request that interprets the body as a text stream and returns the
  2755. * full `HttpResponse`.
  2756. *
  2757. * @param url The endpoint URL.
  2758. * @param body The resources to edit.
  2759. * @param options HTTP options.
  2760. *
  2761. * @return An `Observable` of the `HttpResponse` for the request,
  2762. * with a response body of type string.
  2763. */
  2764. patch(url: string, body: any | null, options: {
  2765. headers?: HttpHeaders | Record<string, string | string[]>;
  2766. observe: 'response';
  2767. context?: HttpContext;
  2768. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2769. reportProgress?: boolean;
  2770. responseType: 'text';
  2771. withCredentials?: boolean;
  2772. }): Observable<HttpResponse<string>>;
  2773. /**
  2774. * Constructs a `PATCH` request that interprets the body as JSON
  2775. * and returns the full `HttpResponse`.
  2776. *
  2777. * @param url The endpoint URL.
  2778. * @param body The resources to edit.
  2779. * @param options HTTP options.
  2780. *
  2781. * @return An `Observable` of the `HttpResponse` for the request,
  2782. * with a response body in the requested type.
  2783. */
  2784. patch(url: string, body: any | null, options: {
  2785. headers?: HttpHeaders | Record<string, string | string[]>;
  2786. observe: 'response';
  2787. context?: HttpContext;
  2788. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2789. reportProgress?: boolean;
  2790. responseType?: 'json';
  2791. withCredentials?: boolean;
  2792. }): Observable<HttpResponse<Object>>;
  2793. /**
  2794. * Constructs a `PATCH` request that interprets the body as JSON
  2795. * and returns the full `HttpResponse`.
  2796. *
  2797. * @param url The endpoint URL.
  2798. * @param body The resources to edit.
  2799. * @param options HTTP options.
  2800. *
  2801. * @return An `Observable` of the `HttpResponse` for the request,
  2802. * with a response body in the given type.
  2803. */
  2804. patch<T>(url: string, body: any | null, options: {
  2805. headers?: HttpHeaders | Record<string, string | string[]>;
  2806. observe: 'response';
  2807. context?: HttpContext;
  2808. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2809. reportProgress?: boolean;
  2810. responseType?: 'json';
  2811. withCredentials?: boolean;
  2812. }): Observable<HttpResponse<T>>;
  2813. /**
  2814. * Constructs a `PATCH` request that interprets the body as JSON and
  2815. * returns the response body as an object parsed from JSON.
  2816. *
  2817. * @param url The endpoint URL.
  2818. * @param body The resources to edit.
  2819. * @param options HTTP options.
  2820. *
  2821. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  2822. */
  2823. patch(url: string, body: any | null, options?: {
  2824. headers?: HttpHeaders | Record<string, string | string[]>;
  2825. context?: HttpContext;
  2826. observe?: 'body';
  2827. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2828. reportProgress?: boolean;
  2829. responseType?: 'json';
  2830. withCredentials?: boolean;
  2831. }): Observable<Object>;
  2832. /**
  2833. * Constructs a `PATCH` request that interprets the body as JSON
  2834. * and returns the response in a given type.
  2835. *
  2836. * @param url The endpoint URL.
  2837. * @param body The resources to edit.
  2838. * @param options HTTP options.
  2839. *
  2840. * @return An `Observable` of the `HttpResponse` for the request,
  2841. * with a response body in the given type.
  2842. */
  2843. patch<T>(url: string, body: any | null, options?: {
  2844. headers?: HttpHeaders | Record<string, string | string[]>;
  2845. context?: HttpContext;
  2846. observe?: 'body';
  2847. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2848. reportProgress?: boolean;
  2849. responseType?: 'json';
  2850. withCredentials?: boolean;
  2851. }): Observable<T>;
  2852. /**
  2853. * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and returns
  2854. * an `ArrayBuffer`.
  2855. *
  2856. * @param url The endpoint URL.
  2857. * @param body The content to replace with.
  2858. * @param options HTTP options.
  2859. *
  2860. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  2861. */
  2862. post(url: string, body: any | null, options: {
  2863. headers?: HttpHeaders | Record<string, string | string[]>;
  2864. context?: HttpContext;
  2865. observe?: 'body';
  2866. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2867. reportProgress?: boolean;
  2868. responseType: 'arraybuffer';
  2869. withCredentials?: boolean;
  2870. transferCache?: {
  2871. includeHeaders?: string[];
  2872. } | boolean;
  2873. }): Observable<ArrayBuffer>;
  2874. /**
  2875. * Constructs a `POST` request that interprets the body as a `Blob` and returns the
  2876. * response as a `Blob`.
  2877. *
  2878. * @param url The endpoint URL.
  2879. * @param body The content to replace with.
  2880. * @param options HTTP options
  2881. *
  2882. * @return An `Observable` of the response, with the response body as a `Blob`.
  2883. */
  2884. post(url: string, body: any | null, options: {
  2885. headers?: HttpHeaders | Record<string, string | string[]>;
  2886. context?: HttpContext;
  2887. observe?: 'body';
  2888. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2889. reportProgress?: boolean;
  2890. responseType: 'blob';
  2891. withCredentials?: boolean;
  2892. transferCache?: {
  2893. includeHeaders?: string[];
  2894. } | boolean;
  2895. }): Observable<Blob>;
  2896. /**
  2897. * Constructs a `POST` request that interprets the body as a text string and
  2898. * returns the response as a string value.
  2899. *
  2900. * @param url The endpoint URL.
  2901. * @param body The content to replace with.
  2902. * @param options HTTP options
  2903. *
  2904. * @return An `Observable` of the response, with a response body of type string.
  2905. */
  2906. post(url: string, body: any | null, options: {
  2907. headers?: HttpHeaders | Record<string, string | string[]>;
  2908. context?: HttpContext;
  2909. observe?: 'body';
  2910. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2911. reportProgress?: boolean;
  2912. responseType: 'text';
  2913. withCredentials?: boolean;
  2914. transferCache?: {
  2915. includeHeaders?: string[];
  2916. } | boolean;
  2917. }): Observable<string>;
  2918. /**
  2919. * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and
  2920. * returns the full event stream.
  2921. *
  2922. * @param url The endpoint URL.
  2923. * @param body The content to replace with.
  2924. * @param options HTTP options
  2925. *
  2926. * @return An `Observable` of all `HttpEvent`s for the request,
  2927. * with the response body as an `ArrayBuffer`.
  2928. */
  2929. post(url: string, body: any | null, options: {
  2930. headers?: HttpHeaders | Record<string, string | string[]>;
  2931. observe: 'events';
  2932. context?: HttpContext;
  2933. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2934. reportProgress?: boolean;
  2935. responseType: 'arraybuffer';
  2936. withCredentials?: boolean;
  2937. transferCache?: {
  2938. includeHeaders?: string[];
  2939. } | boolean;
  2940. }): Observable<HttpEvent<ArrayBuffer>>;
  2941. /**
  2942. * Constructs a `POST` request that interprets the body as a `Blob`
  2943. * and returns the response in an observable of the full event stream.
  2944. *
  2945. * @param url The endpoint URL.
  2946. * @param body The content to replace with.
  2947. * @param options HTTP options
  2948. *
  2949. * @return An `Observable` of all `HttpEvent`s for the request, with the response body as `Blob`.
  2950. */
  2951. post(url: string, body: any | null, options: {
  2952. headers?: HttpHeaders | Record<string, string | string[]>;
  2953. observe: 'events';
  2954. context?: HttpContext;
  2955. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2956. reportProgress?: boolean;
  2957. responseType: 'blob';
  2958. withCredentials?: boolean;
  2959. transferCache?: {
  2960. includeHeaders?: string[];
  2961. } | boolean;
  2962. }): Observable<HttpEvent<Blob>>;
  2963. /**
  2964. * Constructs a `POST` request that interprets the body as a text string and returns the full
  2965. * event stream.
  2966. *
  2967. * @param url The endpoint URL.
  2968. * @param body The content to replace with.
  2969. * @param options HTTP options
  2970. *
  2971. * @return An `Observable` of all `HttpEvent`s for the request,
  2972. * with a response body of type string.
  2973. */
  2974. post(url: string, body: any | null, options: {
  2975. headers?: HttpHeaders | Record<string, string | string[]>;
  2976. observe: 'events';
  2977. context?: HttpContext;
  2978. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2979. reportProgress?: boolean;
  2980. responseType: 'text';
  2981. withCredentials?: boolean;
  2982. transferCache?: {
  2983. includeHeaders?: string[];
  2984. } | boolean;
  2985. }): Observable<HttpEvent<string>>;
  2986. /**
  2987. * Constructs a POST request that interprets the body as JSON and returns the full
  2988. * event stream.
  2989. *
  2990. * @param url The endpoint URL.
  2991. * @param body The content to replace with.
  2992. * @param options HTTP options
  2993. *
  2994. * @return An `Observable` of all `HttpEvent`s for the request,
  2995. * with a response body of type `Object`.
  2996. */
  2997. post(url: string, body: any | null, options: {
  2998. headers?: HttpHeaders | Record<string, string | string[]>;
  2999. observe: 'events';
  3000. context?: HttpContext;
  3001. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3002. reportProgress?: boolean;
  3003. responseType?: 'json';
  3004. withCredentials?: boolean;
  3005. transferCache?: {
  3006. includeHeaders?: string[];
  3007. } | boolean;
  3008. }): Observable<HttpEvent<Object>>;
  3009. /**
  3010. * Constructs a POST request that interprets the body as JSON and returns the full
  3011. * event stream.
  3012. *
  3013. * @param url The endpoint URL.
  3014. * @param body The content to replace with.
  3015. * @param options HTTP options
  3016. *
  3017. * @return An `Observable` of all `HttpEvent`s for the request,
  3018. * with a response body in the requested type.
  3019. */
  3020. post<T>(url: string, body: any | null, options: {
  3021. headers?: HttpHeaders | Record<string, string | string[]>;
  3022. observe: 'events';
  3023. context?: HttpContext;
  3024. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3025. reportProgress?: boolean;
  3026. responseType?: 'json';
  3027. withCredentials?: boolean;
  3028. transferCache?: {
  3029. includeHeaders?: string[];
  3030. } | boolean;
  3031. }): Observable<HttpEvent<T>>;
  3032. /**
  3033. * Constructs a POST request that interprets the body as an `ArrayBuffer`
  3034. * and returns the full `HttpResponse`.
  3035. *
  3036. * @param url The endpoint URL.
  3037. * @param body The content to replace with.
  3038. * @param options HTTP options
  3039. *
  3040. * @return An `Observable` of the `HttpResponse` for the request, with the response body as an
  3041. * `ArrayBuffer`.
  3042. */
  3043. post(url: string, body: any | null, options: {
  3044. headers?: HttpHeaders | Record<string, string | string[]>;
  3045. observe: 'response';
  3046. context?: HttpContext;
  3047. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3048. reportProgress?: boolean;
  3049. responseType: 'arraybuffer';
  3050. withCredentials?: boolean;
  3051. transferCache?: {
  3052. includeHeaders?: string[];
  3053. } | boolean;
  3054. }): Observable<HttpResponse<ArrayBuffer>>;
  3055. /**
  3056. * Constructs a `POST` request that interprets the body as a `Blob` and returns the full
  3057. * `HttpResponse`.
  3058. *
  3059. * @param url The endpoint URL.
  3060. * @param body The content to replace with.
  3061. * @param options HTTP options
  3062. *
  3063. * @return An `Observable` of the `HttpResponse` for the request,
  3064. * with the response body as a `Blob`.
  3065. */
  3066. post(url: string, body: any | null, options: {
  3067. headers?: HttpHeaders | Record<string, string | string[]>;
  3068. observe: 'response';
  3069. context?: HttpContext;
  3070. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3071. reportProgress?: boolean;
  3072. responseType: 'blob';
  3073. withCredentials?: boolean;
  3074. transferCache?: {
  3075. includeHeaders?: string[];
  3076. } | boolean;
  3077. }): Observable<HttpResponse<Blob>>;
  3078. /**
  3079. * Constructs a `POST` request that interprets the body as a text stream and returns
  3080. * the full `HttpResponse`.
  3081. *
  3082. * @param url The endpoint URL.
  3083. * @param body The content to replace with.
  3084. * @param options HTTP options
  3085. *
  3086. * @return An `Observable` of the `HttpResponse` for the request,
  3087. * with a response body of type string.
  3088. */
  3089. post(url: string, body: any | null, options: {
  3090. headers?: HttpHeaders | Record<string, string | string[]>;
  3091. observe: 'response';
  3092. context?: HttpContext;
  3093. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3094. reportProgress?: boolean;
  3095. responseType: 'text';
  3096. withCredentials?: boolean;
  3097. transferCache?: {
  3098. includeHeaders?: string[];
  3099. } | boolean;
  3100. }): Observable<HttpResponse<string>>;
  3101. /**
  3102. * Constructs a `POST` request that interprets the body as JSON
  3103. * and returns the full `HttpResponse`.
  3104. *
  3105. * @param url The endpoint URL.
  3106. * @param body The content to replace with.
  3107. * @param options HTTP options
  3108. *
  3109. * @return An `Observable` of the `HttpResponse` for the request, with a response body of type
  3110. * `Object`.
  3111. */
  3112. post(url: string, body: any | null, options: {
  3113. headers?: HttpHeaders | Record<string, string | string[]>;
  3114. observe: 'response';
  3115. context?: HttpContext;
  3116. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3117. reportProgress?: boolean;
  3118. responseType?: 'json';
  3119. withCredentials?: boolean;
  3120. transferCache?: {
  3121. includeHeaders?: string[];
  3122. } | boolean;
  3123. }): Observable<HttpResponse<Object>>;
  3124. /**
  3125. * Constructs a `POST` request that interprets the body as JSON and returns the
  3126. * full `HttpResponse`.
  3127. *
  3128. *
  3129. * @param url The endpoint URL.
  3130. * @param body The content to replace with.
  3131. * @param options HTTP options
  3132. *
  3133. * @return An `Observable` of the `HttpResponse` for the request, with a response body in the
  3134. * requested type.
  3135. */
  3136. post<T>(url: string, body: any | null, options: {
  3137. headers?: HttpHeaders | Record<string, string | string[]>;
  3138. observe: 'response';
  3139. context?: HttpContext;
  3140. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3141. reportProgress?: boolean;
  3142. responseType?: 'json';
  3143. withCredentials?: boolean;
  3144. transferCache?: {
  3145. includeHeaders?: string[];
  3146. } | boolean;
  3147. }): Observable<HttpResponse<T>>;
  3148. /**
  3149. * Constructs a `POST` request that interprets the body as JSON
  3150. * and returns the response body as an object parsed from JSON.
  3151. *
  3152. * @param url The endpoint URL.
  3153. * @param body The content to replace with.
  3154. * @param options HTTP options
  3155. *
  3156. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  3157. */
  3158. post(url: string, body: any | null, options?: {
  3159. headers?: HttpHeaders | Record<string, string | string[]>;
  3160. context?: HttpContext;
  3161. observe?: 'body';
  3162. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3163. reportProgress?: boolean;
  3164. responseType?: 'json';
  3165. withCredentials?: boolean;
  3166. transferCache?: {
  3167. includeHeaders?: string[];
  3168. } | boolean;
  3169. }): Observable<Object>;
  3170. /**
  3171. * Constructs a `POST` request that interprets the body as JSON
  3172. * and returns an observable of the response.
  3173. *
  3174. * @param url The endpoint URL.
  3175. * @param body The content to replace with.
  3176. * @param options HTTP options
  3177. *
  3178. * @return An `Observable` of the `HttpResponse` for the request, with a response body in the
  3179. * requested type.
  3180. */
  3181. post<T>(url: string, body: any | null, options?: {
  3182. headers?: HttpHeaders | Record<string, string | string[]>;
  3183. context?: HttpContext;
  3184. observe?: 'body';
  3185. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3186. reportProgress?: boolean;
  3187. responseType?: 'json';
  3188. withCredentials?: boolean;
  3189. transferCache?: {
  3190. includeHeaders?: string[];
  3191. } | boolean;
  3192. }): Observable<T>;
  3193. /**
  3194. * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and returns the
  3195. * response as an `ArrayBuffer`.
  3196. *
  3197. * @param url The endpoint URL.
  3198. * @param body The resources to add/update.
  3199. * @param options HTTP options
  3200. *
  3201. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  3202. */
  3203. put(url: string, body: any | null, options: {
  3204. headers?: HttpHeaders | Record<string, string | string[]>;
  3205. context?: HttpContext;
  3206. observe?: 'body';
  3207. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3208. reportProgress?: boolean;
  3209. responseType: 'arraybuffer';
  3210. withCredentials?: boolean;
  3211. }): Observable<ArrayBuffer>;
  3212. /**
  3213. * Constructs a `PUT` request that interprets the body as a `Blob` and returns
  3214. * the response as a `Blob`.
  3215. *
  3216. * @param url The endpoint URL.
  3217. * @param body The resources to add/update.
  3218. * @param options HTTP options
  3219. *
  3220. * @return An `Observable` of the response, with the response body as a `Blob`.
  3221. */
  3222. put(url: string, body: any | null, options: {
  3223. headers?: HttpHeaders | Record<string, string | string[]>;
  3224. context?: HttpContext;
  3225. observe?: 'body';
  3226. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3227. reportProgress?: boolean;
  3228. responseType: 'blob';
  3229. withCredentials?: boolean;
  3230. }): Observable<Blob>;
  3231. /**
  3232. * Constructs a `PUT` request that interprets the body as a text string and
  3233. * returns the response as a string value.
  3234. *
  3235. * @param url The endpoint URL.
  3236. * @param body The resources to add/update.
  3237. * @param options HTTP options
  3238. *
  3239. * @return An `Observable` of the response, with a response body of type string.
  3240. */
  3241. put(url: string, body: any | null, options: {
  3242. headers?: HttpHeaders | Record<string, string | string[]>;
  3243. context?: HttpContext;
  3244. observe?: 'body';
  3245. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3246. reportProgress?: boolean;
  3247. responseType: 'text';
  3248. withCredentials?: boolean;
  3249. }): Observable<string>;
  3250. /**
  3251. * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and
  3252. * returns the full event stream.
  3253. *
  3254. * @param url The endpoint URL.
  3255. * @param body The resources to add/update.
  3256. * @param options HTTP options
  3257. *
  3258. * @return An `Observable` of all `HttpEvent`s for the request,
  3259. * with the response body as an `ArrayBuffer`.
  3260. */
  3261. put(url: string, body: any | null, options: {
  3262. headers?: HttpHeaders | Record<string, string | string[]>;
  3263. observe: 'events';
  3264. context?: HttpContext;
  3265. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3266. reportProgress?: boolean;
  3267. responseType: 'arraybuffer';
  3268. withCredentials?: boolean;
  3269. }): Observable<HttpEvent<ArrayBuffer>>;
  3270. /**
  3271. * Constructs a `PUT` request that interprets the body as a `Blob` and returns the full event
  3272. * stream.
  3273. *
  3274. * @param url The endpoint URL.
  3275. * @param body The resources to add/update.
  3276. * @param options HTTP options
  3277. *
  3278. * @return An `Observable` of all `HttpEvent`s for the request,
  3279. * with the response body as a `Blob`.
  3280. */
  3281. put(url: string, body: any | null, options: {
  3282. headers?: HttpHeaders | Record<string, string | string[]>;
  3283. observe: 'events';
  3284. context?: HttpContext;
  3285. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3286. reportProgress?: boolean;
  3287. responseType: 'blob';
  3288. withCredentials?: boolean;
  3289. }): Observable<HttpEvent<Blob>>;
  3290. /**
  3291. * Constructs a `PUT` request that interprets the body as a text string and returns the full event
  3292. * stream.
  3293. *
  3294. * @param url The endpoint URL.
  3295. * @param body The resources to add/update.
  3296. * @param options HTTP options
  3297. *
  3298. * @return An `Observable` of all `HttpEvent`s for the request, with a response body
  3299. * of type string.
  3300. */
  3301. put(url: string, body: any | null, options: {
  3302. headers?: HttpHeaders | Record<string, string | string[]>;
  3303. observe: 'events';
  3304. context?: HttpContext;
  3305. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3306. reportProgress?: boolean;
  3307. responseType: 'text';
  3308. withCredentials?: boolean;
  3309. }): Observable<HttpEvent<string>>;
  3310. /**
  3311. * Constructs a `PUT` request that interprets the body as JSON and returns the full
  3312. * event stream.
  3313. *
  3314. * @param url The endpoint URL.
  3315. * @param body The resources to add/update.
  3316. * @param options HTTP options
  3317. *
  3318. * @return An `Observable` of all `HttpEvent`s for the request, with a response body of
  3319. * type `Object`.
  3320. */
  3321. put(url: string, body: any | null, options: {
  3322. headers?: HttpHeaders | Record<string, string | string[]>;
  3323. observe: 'events';
  3324. context?: HttpContext;
  3325. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3326. reportProgress?: boolean;
  3327. responseType?: 'json';
  3328. withCredentials?: boolean;
  3329. }): Observable<HttpEvent<Object>>;
  3330. /**
  3331. * Constructs a `PUT` request that interprets the body as JSON and returns the
  3332. * full event stream.
  3333. *
  3334. * @param url The endpoint URL.
  3335. * @param body The resources to add/update.
  3336. * @param options HTTP options
  3337. *
  3338. * @return An `Observable` of all `HttpEvent`s for the request,
  3339. * with a response body in the requested type.
  3340. */
  3341. put<T>(url: string, body: any | null, options: {
  3342. headers?: HttpHeaders | Record<string, string | string[]>;
  3343. observe: 'events';
  3344. context?: HttpContext;
  3345. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3346. reportProgress?: boolean;
  3347. responseType?: 'json';
  3348. withCredentials?: boolean;
  3349. }): Observable<HttpEvent<T>>;
  3350. /**
  3351. * Constructs a `PUT` request that interprets the body as an
  3352. * `ArrayBuffer` and returns an observable of the full HTTP response.
  3353. *
  3354. * @param url The endpoint URL.
  3355. * @param body The resources to add/update.
  3356. * @param options HTTP options
  3357. *
  3358. * @return An `Observable` of the `HttpResponse` for the request, with the response body as an
  3359. * `ArrayBuffer`.
  3360. */
  3361. put(url: string, body: any | null, options: {
  3362. headers?: HttpHeaders | Record<string, string | string[]>;
  3363. observe: 'response';
  3364. context?: HttpContext;
  3365. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3366. reportProgress?: boolean;
  3367. responseType: 'arraybuffer';
  3368. withCredentials?: boolean;
  3369. }): Observable<HttpResponse<ArrayBuffer>>;
  3370. /**
  3371. * Constructs a `PUT` request that interprets the body as a `Blob` and returns the
  3372. * full HTTP response.
  3373. *
  3374. * @param url The endpoint URL.
  3375. * @param body The resources to add/update.
  3376. * @param options HTTP options
  3377. *
  3378. * @return An `Observable` of the `HttpResponse` for the request,
  3379. * with the response body as a `Blob`.
  3380. */
  3381. put(url: string, body: any | null, options: {
  3382. headers?: HttpHeaders | Record<string, string | string[]>;
  3383. observe: 'response';
  3384. context?: HttpContext;
  3385. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3386. reportProgress?: boolean;
  3387. responseType: 'blob';
  3388. withCredentials?: boolean;
  3389. }): Observable<HttpResponse<Blob>>;
  3390. /**
  3391. * Constructs a `PUT` request that interprets the body as a text stream and returns the
  3392. * full HTTP response.
  3393. *
  3394. * @param url The endpoint URL.
  3395. * @param body The resources to add/update.
  3396. * @param options HTTP options
  3397. *
  3398. * @return An `Observable` of the `HttpResponse` for the request, with a response body of type
  3399. * string.
  3400. */
  3401. put(url: string, body: any | null, options: {
  3402. headers?: HttpHeaders | Record<string, string | string[]>;
  3403. observe: 'response';
  3404. context?: HttpContext;
  3405. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3406. reportProgress?: boolean;
  3407. responseType: 'text';
  3408. withCredentials?: boolean;
  3409. }): Observable<HttpResponse<string>>;
  3410. /**
  3411. * Constructs a `PUT` request that interprets the body as JSON and returns the full
  3412. * HTTP response.
  3413. *
  3414. * @param url The endpoint URL.
  3415. * @param body The resources to add/update.
  3416. * @param options HTTP options
  3417. *
  3418. * @return An `Observable` of the `HttpResponse` for the request, with a response body
  3419. * of type 'Object`.
  3420. */
  3421. put(url: string, body: any | null, options: {
  3422. headers?: HttpHeaders | Record<string, string | string[]>;
  3423. observe: 'response';
  3424. context?: HttpContext;
  3425. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3426. reportProgress?: boolean;
  3427. responseType?: 'json';
  3428. withCredentials?: boolean;
  3429. }): Observable<HttpResponse<Object>>;
  3430. /**
  3431. * Constructs a `PUT` request that interprets the body as an instance of the requested type and
  3432. * returns the full HTTP response.
  3433. *
  3434. * @param url The endpoint URL.
  3435. * @param body The resources to add/update.
  3436. * @param options HTTP options
  3437. *
  3438. * @return An `Observable` of the `HttpResponse` for the request,
  3439. * with a response body in the requested type.
  3440. */
  3441. put<T>(url: string, body: any | null, options: {
  3442. headers?: HttpHeaders | Record<string, string | string[]>;
  3443. observe: 'response';
  3444. context?: HttpContext;
  3445. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3446. reportProgress?: boolean;
  3447. responseType?: 'json';
  3448. withCredentials?: boolean;
  3449. }): Observable<HttpResponse<T>>;
  3450. /**
  3451. * Constructs a `PUT` request that interprets the body as JSON
  3452. * and returns an observable of JavaScript object.
  3453. *
  3454. * @param url The endpoint URL.
  3455. * @param body The resources to add/update.
  3456. * @param options HTTP options
  3457. *
  3458. * @return An `Observable` of the response as a JavaScript object.
  3459. */
  3460. put(url: string, body: any | null, options?: {
  3461. headers?: HttpHeaders | Record<string, string | string[]>;
  3462. context?: HttpContext;
  3463. observe?: 'body';
  3464. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3465. reportProgress?: boolean;
  3466. responseType?: 'json';
  3467. withCredentials?: boolean;
  3468. }): Observable<Object>;
  3469. /**
  3470. * Constructs a `PUT` request that interprets the body as an instance of the requested type
  3471. * and returns an observable of the requested type.
  3472. *
  3473. * @param url The endpoint URL.
  3474. * @param body The resources to add/update.
  3475. * @param options HTTP options
  3476. *
  3477. * @return An `Observable` of the requested type.
  3478. */
  3479. put<T>(url: string, body: any | null, options?: {
  3480. headers?: HttpHeaders | Record<string, string | string[]>;
  3481. context?: HttpContext;
  3482. observe?: 'body';
  3483. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3484. reportProgress?: boolean;
  3485. responseType?: 'json';
  3486. withCredentials?: boolean;
  3487. }): Observable<T>;
  3488. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClient, never>;
  3489. static ɵprov: i0.ɵɵInjectableDeclaration<HttpClient>;
  3490. }
  3491. /**
  3492. * Uses `fetch` to send requests to a backend server.
  3493. *
  3494. * This `FetchBackend` requires the support of the
  3495. * [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) which is available on all
  3496. * supported browsers and on Node.js v18 or later.
  3497. *
  3498. * @see {@link HttpHandler}
  3499. *
  3500. * @publicApi
  3501. */
  3502. declare class FetchBackend implements HttpBackend {
  3503. private readonly fetchImpl;
  3504. private readonly ngZone;
  3505. handle(request: HttpRequest<any>): Observable<HttpEvent<any>>;
  3506. private doRequest;
  3507. private parseBody;
  3508. private createRequestInit;
  3509. private concatChunks;
  3510. static ɵfac: i0.ɵɵFactoryDeclaration<FetchBackend, never>;
  3511. static ɵprov: i0.ɵɵInjectableDeclaration<FetchBackend>;
  3512. }
  3513. /**
  3514. * Intercepts and handles an `HttpRequest` or `HttpResponse`.
  3515. *
  3516. * Most interceptors transform the outgoing request before passing it to the
  3517. * next interceptor in the chain, by calling `next.handle(transformedReq)`.
  3518. * An interceptor may transform the
  3519. * response event stream as well, by applying additional RxJS operators on the stream
  3520. * returned by `next.handle()`.
  3521. *
  3522. * More rarely, an interceptor may handle the request entirely,
  3523. * and compose a new event stream instead of invoking `next.handle()`. This is an
  3524. * acceptable behavior, but keep in mind that further interceptors will be skipped entirely.
  3525. *
  3526. * It is also rare but valid for an interceptor to return multiple responses on the
  3527. * event stream for a single request.
  3528. *
  3529. * @publicApi
  3530. *
  3531. * @see [HTTP Guide](guide/http/interceptors)
  3532. * @see {@link HttpInterceptorFn}
  3533. *
  3534. * @usageNotes
  3535. *
  3536. * To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule`
  3537. * only in your `AppModule`, and add the interceptors to the root application injector.
  3538. * If you import `HttpClientModule` multiple times across different modules (for example, in lazy
  3539. * loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the
  3540. * interceptors provided in the root module.
  3541. */
  3542. interface HttpInterceptor {
  3543. /**
  3544. * Identifies and handles a given HTTP request.
  3545. * @param req The outgoing request object to handle.
  3546. * @param next The next interceptor in the chain, or the backend
  3547. * if no interceptors remain in the chain.
  3548. * @returns An observable of the event stream.
  3549. */
  3550. intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
  3551. }
  3552. /**
  3553. * Represents the next interceptor in an interceptor chain, or the real backend if there are no
  3554. * further interceptors.
  3555. *
  3556. * Most interceptors will delegate to this function, and either modify the outgoing request or the
  3557. * response when it arrives. Within the scope of the current request, however, this function may be
  3558. * called any number of times, for any number of downstream requests. Such downstream requests need
  3559. * not be to the same URL or even the same origin as the current request. It is also valid to not
  3560. * call the downstream handler at all, and process the current request entirely within the
  3561. * interceptor.
  3562. *
  3563. * This function should only be called within the scope of the request that's currently being
  3564. * intercepted. Once that request is complete, this downstream handler function should not be
  3565. * called.
  3566. *
  3567. * @publicApi
  3568. *
  3569. * @see [HTTP Guide](guide/http/interceptors)
  3570. */
  3571. type HttpHandlerFn = (req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>;
  3572. /**
  3573. * An interceptor for HTTP requests made via `HttpClient`.
  3574. *
  3575. * `HttpInterceptorFn`s are middleware functions which `HttpClient` calls when a request is made.
  3576. * These functions have the opportunity to modify the outgoing request or any response that comes
  3577. * back, as well as block, redirect, or otherwise change the request or response semantics.
  3578. *
  3579. * An `HttpHandlerFn` representing the next interceptor (or the backend which will make a real HTTP
  3580. * request) is provided. Most interceptors will delegate to this function, but that is not required
  3581. * (see `HttpHandlerFn` for more details).
  3582. *
  3583. * `HttpInterceptorFn`s are executed in an [injection context](guide/di/dependency-injection-context).
  3584. * They have access to `inject()` via the `EnvironmentInjector` from which they were configured.
  3585. *
  3586. * @see [HTTP Guide](guide/http/interceptors)
  3587. * @see {@link withInterceptors}
  3588. *
  3589. * @usageNotes
  3590. * Here is a noop interceptor that passes the request through without modifying it:
  3591. * ```ts
  3592. * export const noopInterceptor: HttpInterceptorFn = (req: HttpRequest<unknown>, next:
  3593. * HttpHandlerFn) => {
  3594. * return next(modifiedReq);
  3595. * };
  3596. * ```
  3597. *
  3598. * If you want to alter a request, clone it first and modify the clone before passing it to the
  3599. * `next()` handler function.
  3600. *
  3601. * Here is a basic interceptor that adds a bearer token to the headers
  3602. * ```ts
  3603. * export const authenticationInterceptor: HttpInterceptorFn = (req: HttpRequest<unknown>, next:
  3604. * HttpHandlerFn) => {
  3605. * const userToken = 'MY_TOKEN'; const modifiedReq = req.clone({
  3606. * headers: req.headers.set('Authorization', `Bearer ${userToken}`),
  3607. * });
  3608. *
  3609. * return next(modifiedReq);
  3610. * };
  3611. * ```
  3612. */
  3613. type HttpInterceptorFn = (req: HttpRequest<unknown>, next: HttpHandlerFn) => Observable<HttpEvent<unknown>>;
  3614. /**
  3615. * A multi-provider token that represents the array of registered
  3616. * `HttpInterceptor` objects.
  3617. *
  3618. * @publicApi
  3619. */
  3620. declare const HTTP_INTERCEPTORS: InjectionToken<readonly HttpInterceptor[]>;
  3621. /**
  3622. * A multi-provided token of `HttpInterceptorFn`s that are only set in root.
  3623. */
  3624. declare const HTTP_ROOT_INTERCEPTOR_FNS: InjectionToken<readonly HttpInterceptorFn[]>;
  3625. declare const REQUESTS_CONTRIBUTE_TO_STABILITY: InjectionToken<boolean>;
  3626. declare class HttpInterceptorHandler extends HttpHandler {
  3627. private backend;
  3628. private injector;
  3629. private chain;
  3630. private readonly pendingTasks;
  3631. private readonly contributeToStability;
  3632. constructor(backend: HttpBackend, injector: EnvironmentInjector);
  3633. handle(initialRequest: HttpRequest<any>): Observable<HttpEvent<any>>;
  3634. static ɵfac: i0.ɵɵFactoryDeclaration<HttpInterceptorHandler, never>;
  3635. static ɵprov: i0.ɵɵInjectableDeclaration<HttpInterceptorHandler>;
  3636. }
  3637. /**
  3638. * DI token/abstract type representing a map of JSONP callbacks.
  3639. *
  3640. * In the browser, this should always be the `window` object.
  3641. *
  3642. *
  3643. */
  3644. declare abstract class JsonpCallbackContext {
  3645. [key: string]: (data: any) => void;
  3646. }
  3647. /**
  3648. * Processes an `HttpRequest` with the JSONP method,
  3649. * by performing JSONP style requests.
  3650. * @see {@link HttpHandler}
  3651. * @see {@link HttpXhrBackend}
  3652. *
  3653. * @publicApi
  3654. */
  3655. declare class JsonpClientBackend implements HttpBackend {
  3656. private callbackMap;
  3657. private document;
  3658. /**
  3659. * A resolved promise that can be used to schedule microtasks in the event handlers.
  3660. */
  3661. private readonly resolvedPromise;
  3662. constructor(callbackMap: JsonpCallbackContext, document: any);
  3663. /**
  3664. * Get the name of the next callback method, by incrementing the global `nextRequestId`.
  3665. */
  3666. private nextCallback;
  3667. /**
  3668. * Processes a JSONP request and returns an event stream of the results.
  3669. * @param req The request object.
  3670. * @returns An observable of the response events.
  3671. *
  3672. */
  3673. handle(req: HttpRequest<never>): Observable<HttpEvent<any>>;
  3674. private removeListeners;
  3675. static ɵfac: i0.ɵɵFactoryDeclaration<JsonpClientBackend, never>;
  3676. static ɵprov: i0.ɵɵInjectableDeclaration<JsonpClientBackend>;
  3677. }
  3678. /**
  3679. * Identifies requests with the method JSONP and
  3680. * shifts them to the `JsonpClientBackend`.
  3681. *
  3682. * @see {@link HttpInterceptor}
  3683. *
  3684. * @publicApi
  3685. */
  3686. declare class JsonpInterceptor {
  3687. private injector;
  3688. constructor(injector: EnvironmentInjector);
  3689. /**
  3690. * Identifies and handles a given JSONP request.
  3691. * @param initialRequest The outgoing request object to handle.
  3692. * @param next The next interceptor in the chain, or the backend
  3693. * if no interceptors remain in the chain.
  3694. * @returns An observable of the event stream.
  3695. */
  3696. intercept(initialRequest: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
  3697. static ɵfac: i0.ɵɵFactoryDeclaration<JsonpInterceptor, never>;
  3698. static ɵprov: i0.ɵɵInjectableDeclaration<JsonpInterceptor>;
  3699. }
  3700. /**
  3701. * Configures XSRF protection support for outgoing requests.
  3702. *
  3703. * For a server that supports a cookie-based XSRF protection system,
  3704. * use directly to configure XSRF protection with the correct
  3705. * cookie and header names.
  3706. *
  3707. * If no names are supplied, the default cookie name is `XSRF-TOKEN`
  3708. * and the default header name is `X-XSRF-TOKEN`.
  3709. *
  3710. * @publicApi
  3711. * @deprecated Use withXsrfConfiguration({cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN'}) as
  3712. * providers instead or `withNoXsrfProtection` if you want to disabled XSRF protection.
  3713. */
  3714. declare class HttpClientXsrfModule {
  3715. /**
  3716. * Disable the default XSRF protection.
  3717. */
  3718. static disable(): ModuleWithProviders<HttpClientXsrfModule>;
  3719. /**
  3720. * Configure XSRF protection.
  3721. * @param options An object that can specify either or both
  3722. * cookie name or header name.
  3723. * - Cookie name default is `XSRF-TOKEN`.
  3724. * - Header name default is `X-XSRF-TOKEN`.
  3725. *
  3726. */
  3727. static withOptions(options?: {
  3728. cookieName?: string;
  3729. headerName?: string;
  3730. }): ModuleWithProviders<HttpClientXsrfModule>;
  3731. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientXsrfModule, never>;
  3732. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientXsrfModule, never, never, never>;
  3733. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientXsrfModule>;
  3734. }
  3735. /**
  3736. * Configures the dependency injector for `HttpClient`
  3737. * with supporting services for XSRF. Automatically imported by `HttpClientModule`.
  3738. *
  3739. * You can add interceptors to the chain behind `HttpClient` by binding them to the
  3740. * multiprovider for built-in DI token `HTTP_INTERCEPTORS`.
  3741. *
  3742. * @publicApi
  3743. * @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
  3744. */
  3745. declare class HttpClientModule {
  3746. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientModule, never>;
  3747. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientModule, never, never, never>;
  3748. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientModule>;
  3749. }
  3750. /**
  3751. * Configures the dependency injector for `HttpClient`
  3752. * with supporting services for JSONP.
  3753. * Without this module, Jsonp requests reach the backend
  3754. * with method JSONP, where they are rejected.
  3755. *
  3756. * @publicApi
  3757. * @deprecated `withJsonpSupport()` as providers instead
  3758. */
  3759. declare class HttpClientJsonpModule {
  3760. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientJsonpModule, never>;
  3761. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientJsonpModule, never, never, never>;
  3762. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientJsonpModule>;
  3763. }
  3764. /**
  3765. * Identifies a particular kind of `HttpFeature`.
  3766. *
  3767. * @publicApi
  3768. */
  3769. declare enum HttpFeatureKind {
  3770. Interceptors = 0,
  3771. LegacyInterceptors = 1,
  3772. CustomXsrfConfiguration = 2,
  3773. NoXsrfProtection = 3,
  3774. JsonpSupport = 4,
  3775. RequestsMadeViaParent = 5,
  3776. Fetch = 6
  3777. }
  3778. /**
  3779. * A feature for use when configuring `provideHttpClient`.
  3780. *
  3781. * @publicApi
  3782. */
  3783. interface HttpFeature<KindT extends HttpFeatureKind> {
  3784. ɵkind: KindT;
  3785. ɵproviders: Provider[];
  3786. }
  3787. /**
  3788. * Configures Angular's `HttpClient` service to be available for injection.
  3789. *
  3790. * By default, `HttpClient` will be configured for injection with its default options for XSRF
  3791. * protection of outgoing requests. Additional configuration options can be provided by passing
  3792. * feature functions to `provideHttpClient`. For example, HTTP interceptors can be added using the
  3793. * `withInterceptors(...)` feature.
  3794. *
  3795. * <div class="docs-alert docs-alert-helpful">
  3796. *
  3797. * It's strongly recommended to enable
  3798. * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for applications that use
  3799. * Server-Side Rendering for better performance and compatibility. To enable `fetch`, add
  3800. * `withFetch()` feature to the `provideHttpClient()` call at the root of the application:
  3801. *
  3802. * ```ts
  3803. * provideHttpClient(withFetch());
  3804. * ```
  3805. *
  3806. * </div>
  3807. *
  3808. * @see {@link withInterceptors}
  3809. * @see {@link withInterceptorsFromDi}
  3810. * @see {@link withXsrfConfiguration}
  3811. * @see {@link withNoXsrfProtection}
  3812. * @see {@link withJsonpSupport}
  3813. * @see {@link withRequestsMadeViaParent}
  3814. * @see {@link withFetch}
  3815. */
  3816. declare function provideHttpClient(...features: HttpFeature<HttpFeatureKind>[]): EnvironmentProviders;
  3817. /**
  3818. * Adds one or more functional-style HTTP interceptors to the configuration of the `HttpClient`
  3819. * instance.
  3820. *
  3821. * @see {@link HttpInterceptorFn}
  3822. * @see {@link provideHttpClient}
  3823. * @publicApi
  3824. */
  3825. declare function withInterceptors(interceptorFns: HttpInterceptorFn[]): HttpFeature<HttpFeatureKind.Interceptors>;
  3826. /**
  3827. * Includes class-based interceptors configured using a multi-provider in the current injector into
  3828. * the configured `HttpClient` instance.
  3829. *
  3830. * Prefer `withInterceptors` and functional interceptors instead, as support for DI-provided
  3831. * interceptors may be phased out in a later release.
  3832. *
  3833. * @see {@link HttpInterceptor}
  3834. * @see {@link HTTP_INTERCEPTORS}
  3835. * @see {@link provideHttpClient}
  3836. */
  3837. declare function withInterceptorsFromDi(): HttpFeature<HttpFeatureKind.LegacyInterceptors>;
  3838. /**
  3839. * Customizes the XSRF protection for the configuration of the current `HttpClient` instance.
  3840. *
  3841. * This feature is incompatible with the `withNoXsrfProtection` feature.
  3842. *
  3843. * @see {@link provideHttpClient}
  3844. */
  3845. declare function withXsrfConfiguration({ cookieName, headerName, }: {
  3846. cookieName?: string;
  3847. headerName?: string;
  3848. }): HttpFeature<HttpFeatureKind.CustomXsrfConfiguration>;
  3849. /**
  3850. * Disables XSRF protection in the configuration of the current `HttpClient` instance.
  3851. *
  3852. * This feature is incompatible with the `withXsrfConfiguration` feature.
  3853. *
  3854. * @see {@link provideHttpClient}
  3855. */
  3856. declare function withNoXsrfProtection(): HttpFeature<HttpFeatureKind.NoXsrfProtection>;
  3857. /**
  3858. * Add JSONP support to the configuration of the current `HttpClient` instance.
  3859. *
  3860. * @see {@link provideHttpClient}
  3861. */
  3862. declare function withJsonpSupport(): HttpFeature<HttpFeatureKind.JsonpSupport>;
  3863. /**
  3864. * Configures the current `HttpClient` instance to make requests via the parent injector's
  3865. * `HttpClient` instead of directly.
  3866. *
  3867. * By default, `provideHttpClient` configures `HttpClient` in its injector to be an independent
  3868. * instance. For example, even if `HttpClient` is configured in the parent injector with
  3869. * one or more interceptors, they will not intercept requests made via this instance.
  3870. *
  3871. * With this option enabled, once the request has passed through the current injector's
  3872. * interceptors, it will be delegated to the parent injector's `HttpClient` chain instead of
  3873. * dispatched directly, and interceptors in the parent configuration will be applied to the request.
  3874. *
  3875. * If there are several `HttpClient` instances in the injector hierarchy, it's possible for
  3876. * `withRequestsMadeViaParent` to be used at multiple levels, which will cause the request to
  3877. * "bubble up" until either reaching the root level or an `HttpClient` which was not configured with
  3878. * this option.
  3879. *
  3880. * @see {@link provideHttpClient}
  3881. * @publicApi
  3882. */
  3883. declare function withRequestsMadeViaParent(): HttpFeature<HttpFeatureKind.RequestsMadeViaParent>;
  3884. /**
  3885. * Configures the current `HttpClient` instance to make requests using the fetch API.
  3886. *
  3887. * Note: The Fetch API doesn't support progress report on uploads.
  3888. *
  3889. * @publicApi
  3890. */
  3891. declare function withFetch(): HttpFeature<HttpFeatureKind.Fetch>;
  3892. /**
  3893. * The structure of an `httpResource` request which will be sent to the backend.
  3894. *
  3895. * @experimental
  3896. */
  3897. interface HttpResourceRequest {
  3898. /**
  3899. * URL of the request.
  3900. *
  3901. * This URL should not include query parameters. Instead, specify query parameters through the
  3902. * `params` field.
  3903. */
  3904. url: string;
  3905. /**
  3906. * HTTP method of the request, which defaults to GET if not specified.
  3907. */
  3908. method?: string;
  3909. /**
  3910. * Body to send with the request, if there is one.
  3911. *
  3912. * If no Content-Type header is specified by the user, Angular will attempt to set one based on
  3913. * the type of `body`.
  3914. */
  3915. body?: unknown;
  3916. /**
  3917. * Dictionary of query parameters which will be appeneded to the request URL.
  3918. */
  3919. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3920. /**
  3921. * Dictionary of headers to include with the outgoing request.
  3922. */
  3923. headers?: HttpHeaders | Record<string, string | ReadonlyArray<string>>;
  3924. /**
  3925. * Context of the request stored in a dictionary of key-value pairs.
  3926. */
  3927. context?: HttpContext;
  3928. /**
  3929. * If `true`, progress events will be enabled for the request and delivered through the
  3930. * `HttpResource.progress` signal.
  3931. */
  3932. reportProgress?: boolean;
  3933. /**
  3934. * Specifies whether the `withCredentials` flag should be set on the outgoing request.
  3935. *
  3936. * This flag causes the browser to send cookies and other authentication information along with
  3937. * the request.
  3938. */
  3939. withCredentials?: boolean;
  3940. /**
  3941. * Configures the server-side rendering transfer cache for this request.
  3942. *
  3943. * See the documentation on the transfer cache for more information.
  3944. */
  3945. transferCache?: {
  3946. includeHeaders?: string[];
  3947. } | boolean;
  3948. }
  3949. /**
  3950. * Options for creating an `httpResource`.
  3951. *
  3952. * @experimental
  3953. */
  3954. interface HttpResourceOptions<TResult, TRaw> {
  3955. /**
  3956. * Transform the result of the HTTP request before it's delivered to the resource.
  3957. *
  3958. * `parse` receives the value from the HTTP layer as its raw type (e.g. as `unknown` for JSON data).
  3959. * It can be used to validate or transform the type of the resource, and return a more specific
  3960. * type. This is also useful for validating backend responses using a runtime schema validation
  3961. * library such as Zod.
  3962. */
  3963. parse?: (value: TRaw) => TResult;
  3964. /**
  3965. * Value that the resource will take when in Idle, Loading, or Error states.
  3966. *
  3967. * If not set, the resource will use `undefined` as its default value.
  3968. */
  3969. defaultValue?: NoInfer<TResult>;
  3970. /**
  3971. * The `Injector` in which to create the `httpResource`.
  3972. *
  3973. * If this is not provided, the current [injection context](guide/di/dependency-injection-context)
  3974. * will be used instead (via `inject`).
  3975. */
  3976. injector?: Injector;
  3977. /**
  3978. * A comparison function which defines equality for the response value.
  3979. */
  3980. equal?: ValueEqualityFn<NoInfer<TResult>>;
  3981. }
  3982. /**
  3983. * A `WritableResource` that represents the results of a reactive HTTP request.
  3984. *
  3985. * `HttpResource`s are backed by `HttpClient`, including support for interceptors, testing, and the
  3986. * other features of the `HttpClient` API.
  3987. *
  3988. * @experimental
  3989. */
  3990. interface HttpResourceRef<T> extends WritableResource<T>, ResourceRef<T> {
  3991. /**
  3992. * Signal of the response headers, when available.
  3993. */
  3994. readonly headers: Signal<HttpHeaders | undefined>;
  3995. /**
  3996. * Signal of the response status code, when available.
  3997. */
  3998. readonly statusCode: Signal<number | undefined>;
  3999. /**
  4000. * Signal of the latest progress update, if the request was made with `reportProgress: true`.
  4001. */
  4002. readonly progress: Signal<HttpProgressEvent | undefined>;
  4003. hasValue(): this is HttpResourceRef<Exclude<T, undefined>>;
  4004. destroy(): void;
  4005. }
  4006. /**
  4007. * Type for the `httpRequest` top-level function, which includes the call signatures for the JSON-
  4008. * based `httpRequest` as well as sub-functions for `ArrayBuffer`, `Blob`, and `string` type
  4009. * requests.
  4010. *
  4011. * @experimental
  4012. */
  4013. interface HttpResourceFn {
  4014. /**
  4015. * Create a `Resource` that fetches data with an HTTP GET request to the given URL.
  4016. *
  4017. * If a reactive function is passed for the URL, the resource will update when the URL changes via
  4018. * signals.
  4019. *
  4020. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4021. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  4022. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  4023. *
  4024. * @experimental
  4025. */
  4026. <TResult = unknown>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, unknown> & {
  4027. defaultValue: NoInfer<TResult>;
  4028. }): HttpResourceRef<TResult>;
  4029. /**
  4030. * Create a `Resource` that fetches data with an HTTP GET request to the given URL.
  4031. *
  4032. * If a reactive function is passed for the URL, the resource will update when the URL changes via
  4033. * signals.
  4034. *
  4035. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4036. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  4037. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  4038. *
  4039. * @experimental
  4040. */
  4041. <TResult = unknown>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, unknown>): HttpResourceRef<TResult | undefined>;
  4042. /**
  4043. * Create a `Resource` that fetches data with the configured HTTP request.
  4044. *
  4045. * If a reactive function is passed for the request, the resource will update when the request
  4046. * changes via signals.
  4047. *
  4048. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4049. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  4050. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  4051. *
  4052. * @experimental
  4053. */
  4054. <TResult = unknown>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, unknown> & {
  4055. defaultValue: NoInfer<TResult>;
  4056. }): HttpResourceRef<TResult>;
  4057. /**
  4058. * Create a `Resource` that fetches data with the configured HTTP request.
  4059. *
  4060. * If a reactive function is passed for the request, the resource will update when the request
  4061. * changes via signals.
  4062. *
  4063. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4064. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  4065. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  4066. *
  4067. * @experimental
  4068. */
  4069. <TResult = unknown>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, unknown>): HttpResourceRef<TResult | undefined>;
  4070. /**
  4071. * Create a `Resource` that fetches data with the configured HTTP request.
  4072. *
  4073. * If a reactive function is passed for the URL or request, the resource will update when the
  4074. * URL or request changes via signals.
  4075. *
  4076. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4077. * of the `HttpClient` API. Data is parsed into an `ArrayBuffer`.
  4078. *
  4079. * @experimental
  4080. */
  4081. arrayBuffer: {
  4082. <TResult = ArrayBuffer>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, ArrayBuffer> & {
  4083. defaultValue: NoInfer<TResult>;
  4084. }): HttpResourceRef<TResult>;
  4085. <TResult = ArrayBuffer>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, ArrayBuffer>): HttpResourceRef<TResult | undefined>;
  4086. <TResult = ArrayBuffer>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, ArrayBuffer> & {
  4087. defaultValue: NoInfer<TResult>;
  4088. }): HttpResourceRef<TResult>;
  4089. <TResult = ArrayBuffer>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, ArrayBuffer>): HttpResourceRef<TResult | undefined>;
  4090. };
  4091. /**
  4092. * Create a `Resource` that fetches data with the configured HTTP request.
  4093. *
  4094. * If a reactive function is passed for the URL or request, the resource will update when the
  4095. * URL or request changes via signals.
  4096. *
  4097. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4098. * of the `HttpClient` API. Data is parsed into a `Blob`.
  4099. *
  4100. * @experimental
  4101. */
  4102. blob: {
  4103. <TResult = Blob>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, Blob> & {
  4104. defaultValue: NoInfer<TResult>;
  4105. }): HttpResourceRef<TResult>;
  4106. <TResult = Blob>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, Blob>): HttpResourceRef<TResult | undefined>;
  4107. <TResult = Blob>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, Blob> & {
  4108. defaultValue: NoInfer<TResult>;
  4109. }): HttpResourceRef<TResult>;
  4110. <TResult = Blob>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, Blob>): HttpResourceRef<TResult | undefined>;
  4111. };
  4112. /**
  4113. * Create a `Resource` that fetches data with the configured HTTP request.
  4114. *
  4115. * If a reactive function is passed for the URL or request, the resource will update when the
  4116. * URL or request changes via signals.
  4117. *
  4118. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  4119. * of the `HttpClient` API. Data is parsed as a `string`.
  4120. *
  4121. * @experimental
  4122. */
  4123. text: {
  4124. <TResult = string>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, string> & {
  4125. defaultValue: NoInfer<TResult>;
  4126. }): HttpResourceRef<TResult>;
  4127. <TResult = string>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, string>): HttpResourceRef<TResult | undefined>;
  4128. <TResult = string>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, string> & {
  4129. defaultValue: NoInfer<TResult>;
  4130. }): HttpResourceRef<TResult>;
  4131. <TResult = string>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, string>): HttpResourceRef<TResult | undefined>;
  4132. };
  4133. }
  4134. /**
  4135. * `httpResource` makes a reactive HTTP request and exposes the request status and response value as
  4136. * a `WritableResource`. By default, it assumes that the backend will return JSON data. To make a
  4137. * request that expects a different kind of data, you can use a sub-constructor of `httpResource`,
  4138. * such as `httpResource.text`.
  4139. *
  4140. * @experimental
  4141. * @initializerApiFunction
  4142. */
  4143. declare const httpResource: HttpResourceFn;
  4144. /**
  4145. * Options to configure how TransferCache should be used to cache requests made via HttpClient.
  4146. *
  4147. * @param includeHeaders Specifies which headers should be included into cached responses. No
  4148. * headers are included by default.
  4149. * @param filter A function that receives a request as an argument and returns a boolean to indicate
  4150. * whether a request should be included into the cache.
  4151. * @param includePostRequests Enables caching for POST requests. By default, only GET and HEAD
  4152. * requests are cached. This option can be enabled if POST requests are used to retrieve data
  4153. * (for example using GraphQL).
  4154. * @param includeRequestsWithAuthHeaders Enables caching of requests containing either `Authorization`
  4155. * or `Proxy-Authorization` headers. By default, these requests are excluded from caching.
  4156. *
  4157. * @publicApi
  4158. */
  4159. type HttpTransferCacheOptions = {
  4160. includeHeaders?: string[];
  4161. filter?: (req: HttpRequest<unknown>) => boolean;
  4162. includePostRequests?: boolean;
  4163. includeRequestsWithAuthHeaders?: boolean;
  4164. };
  4165. /**
  4166. * If your application uses different HTTP origins to make API calls (via `HttpClient`) on the server and
  4167. * on the client, the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token allows you to establish a mapping
  4168. * between those origins, so that `HttpTransferCache` feature can recognize those requests as the same
  4169. * ones and reuse the data cached on the server during hydration on the client.
  4170. *
  4171. * **Important note**: the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token should *only* be provided in
  4172. * the *server* code of your application (typically in the `app.server.config.ts` script). Angular throws an
  4173. * error if it detects that the token is defined while running on the client.
  4174. *
  4175. * @usageNotes
  4176. *
  4177. * When the same API endpoint is accessed via `http://internal-domain.com:8080` on the server and
  4178. * via `https://external-domain.com` on the client, you can use the following configuration:
  4179. * ```ts
  4180. * // in app.server.config.ts
  4181. * {
  4182. * provide: HTTP_TRANSFER_CACHE_ORIGIN_MAP,
  4183. * useValue: {
  4184. * 'http://internal-domain.com:8080': 'https://external-domain.com'
  4185. * }
  4186. * }
  4187. * ```
  4188. *
  4189. * @publicApi
  4190. */
  4191. declare const HTTP_TRANSFER_CACHE_ORIGIN_MAP: InjectionToken<Record<string, string>>;
  4192. /**
  4193. * Returns the DI providers needed to enable HTTP transfer cache.
  4194. *
  4195. * By default, when using server rendering, requests are performed twice: once on the server and
  4196. * other one on the browser.
  4197. *
  4198. * When these providers are added, requests performed on the server are cached and reused during the
  4199. * bootstrapping of the application in the browser thus avoiding duplicate requests and reducing
  4200. * load time.
  4201. *
  4202. */
  4203. declare function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[];
  4204. /**
  4205. * Uses `XMLHttpRequest` to send requests to a backend server.
  4206. * @see {@link HttpHandler}
  4207. * @see {@link JsonpClientBackend}
  4208. *
  4209. * @publicApi
  4210. */
  4211. declare class HttpXhrBackend implements HttpBackend {
  4212. private xhrFactory;
  4213. constructor(xhrFactory: XhrFactory);
  4214. /**
  4215. * Processes a request and returns a stream of response events.
  4216. * @param req The request object.
  4217. * @returns An observable of the response events.
  4218. */
  4219. handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  4220. static ɵfac: i0.ɵɵFactoryDeclaration<HttpXhrBackend, never>;
  4221. static ɵprov: i0.ɵɵInjectableDeclaration<HttpXhrBackend>;
  4222. }
  4223. /**
  4224. * Retrieves the current XSRF token to use with the next outgoing request.
  4225. *
  4226. * @publicApi
  4227. */
  4228. declare abstract class HttpXsrfTokenExtractor {
  4229. /**
  4230. * Get the XSRF token to use with an outgoing request.
  4231. *
  4232. * Will be called for every request, so the token may change between requests.
  4233. */
  4234. abstract getToken(): string | null;
  4235. }
  4236. export { FetchBackend, HTTP_INTERCEPTORS, HTTP_TRANSFER_CACHE_ORIGIN_MAP, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, type HttpDownloadProgressEvent, HttpErrorResponse, type HttpEvent, HttpEventType, type HttpFeature, HttpFeatureKind, HttpHandler, type HttpHandlerFn, HttpHeaderResponse, HttpHeaders, type HttpInterceptor, type HttpInterceptorFn, type HttpParameterCodec, HttpParams, type HttpParamsOptions, type HttpProgressEvent, HttpRequest, type HttpResourceFn, type HttpResourceOptions, type HttpResourceRef, type HttpResourceRequest, HttpResponse, HttpResponseBase, type HttpSentEvent, HttpStatusCode, type HttpTransferCacheOptions, type HttpUploadProgressEvent, HttpUrlEncodingCodec, type HttpUserEvent, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, httpResource, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HTTP_ROOT_INTERCEPTOR_FNS as ɵHTTP_ROOT_INTERCEPTOR_FNS, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, REQUESTS_CONTRIBUTE_TO_STABILITY as ɵREQUESTS_CONTRIBUTE_TO_STABILITY, withHttpTransferCache as ɵwithHttpTransferCache };