Recent

Author Topic: API calls, I extended the httpclient object  (Read 2339 times)

joostfra

  • Newbie
  • Posts: 3
API calls, I extended the httpclient object
« on: March 13, 2024, 08:38:44 pm »
For making API calls i used the httpclient opject.
Soon i missed a lot of call types.
So, i copied the fphttpclient, named it the jahttpclient and created the missing methods.
Now i can make the calls i want.
But maybe someone else has the same problem, therefore i attached the unit to this post.
If someone tries/uses it, just let us know if it works for you too,

Or perhaps i was looking totally in the wrong direction.... and can someone correct me.

rvk

  • Hero Member
  • *****
  • Posts: 6594
Re: API calls, I extended the httpclient object
« Reply #1 on: March 13, 2024, 08:46:55 pm »
Soon i missed a lot of call types.
...
Or perhaps i was looking totally in the wrong direction.... and can someone correct me.
Maybe you can explain and sum up the things you missed.

(That might be easier for us than puzzling on your changed code.)

joostfra

  • Newbie
  • Posts: 3
Re: API calls, I extended the httpclient object
« Reply #2 on: March 13, 2024, 09:36:06 pm »
You are right, i will give a summary.

I missed the Patch and SimplePatch methods, these i created in the same way as the existing.
Next to the FileFormPost and StreamFormPost i created the FilePost and the StreamPost (the original modifies the file content, the new does not)
The same way i created a FilePut and StreamPut and the FilePatch and StreamPatch for the same reason.

I did not change the existing code, only added methods in the public area.
And of course the implementation of the methods.

Thaddy

  • Hero Member
  • *****
  • Posts: 16201
  • Censorship about opinions does not belong here.
Re: API calls, I extended the httpclient object
« Reply #3 on: March 14, 2024, 12:24:11 pm »
Yes a patch.
Ask Michael for a review.
If I smell bad code it usually is bad code and that includes my own code.

joostfra

  • Newbie
  • Posts: 3
Re: API calls, I extended the httpclient object
« Reply #4 on: May 21, 2024, 08:53:17 pm »
Should i ask Michael for a review ?

@Michael: i added a couple of useful methods.
Maybe this is useful for more people.
A small summary is in this topic.

While i am new to this forum, just correct me if i am wrong.

TRon

  • Hero Member
  • *****
  • Posts: 3660
Re: API calls, I extended the httpclient object
« Reply #5 on: May 22, 2024, 09:41:27 am »
a quick patch/diff between 2 different file names attached (unified and ignoring case)

fwiw. It will not be accepted as such if only because of the the changes in formatting (they cloud a possible merge request)

edit: cleaned version attached as well. I can't seem to be able to add the additional3 to 4 superfluous spaces in my diff editor tool (it automatically removes any edit considering remotely stupid)
« Last Edit: May 22, 2024, 10:26:00 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018