Episode 5 - Adding resources to your Client

victoravelar profile image Victor Hugo Avelar ・1 min read

So after being at the Alps for some days, here we go again.

What is a resource?

According to https://restful-api-design.readthedocs.io a resource is described as follows:

The fundamental concept in any RESTful API is the resource. A resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. It is similar to an object instance in an object-oriented programming language, with the important difference that only a few standard methods are defined for the resource (corresponding to the standard HTTP GET, POST, PUT and DELETE methods), while an object instance typically has many methods.

This means that when adding a resource this will allow us to perform operations with our client on specific and well defined types.

How to add a resource to a client?

  1. We create a resource type to hold the methods to interact with articles, this will contain a pointer to our devto.Client implementation,
// articles.go

type ArticleResource struct{
    API *Client // this will receive a pointer to your client instance

And then we attach this using the client constructor

you can see a working example in the repository

GitHub logo VictorAvelar / devto-api-go

A go client for the dev.to API


A go client for the dev.to API

License: MIT

Travis CI

Build Status


Scrutinizer Build Status Scrutinizer Code Quality Code Coverage

Go ecosystem

Go Report Card GoDoc


  • Base client and configuration
  • Articles resource
  • CLI utility
  • Authentication resource
  • Extend the tests suite
  • Provide code examples


This library is not an official dev.to API library, but a friendly contribution to the dev.to community

From now on, we are up for the wtfutil part.

Posted on by:

victoravelar profile

Victor Hugo Avelar


Tech Lead - Independent Hotels Domain / Rates 28, Mexican living in Germany.


Editor guide