A c# api client for riminder api.
dotnet add package riminder
To authenticate against the api, get your API SECRET KEY from your riminder dashboard:
Then create a new Riminder.Riminder
object with this key:
using Riminder;
// Authentification to api
var client = new Riminder("yoursecretkey");
// Finally you can use the api!!.
using System;
using Riminder;
var client = new Riminder("some-key");
// Let's retrieve a profile.
var profile = client.profile.get("source_id", profile_reference:"reference_for_a_profile");
// And print his name !
Console.WriteLine("This profile name is: ");
Console.WriteLine(profile.name");
If an error occurs while an operation an exception inherited from Riminder.exp.RiminderException
is raised.
The mentionned team is the team linked to your secret key.
When both *_id
and *_reference
arguments are requested only one is required.
For example client.filter.get()
can take a
filter_id
(client.filter.get(filter_id: var_filter_id)
)filter_reference
(client.filter.get(filter_reference: var_filter_reference
)
and work as well.
All methods return structures which attribute are public and match json keys. Only the data
field will be returned.
For example: {"code": 200, "message: "All green.", "data": {"name": "Natalie"}}
would become
public class ExampleStruct: IResponse
{
public string name;
}
For details and examples see our documentation.
- Get all filters from the team.
Riminder.response.FilterList resp = client.filter.list();
- Get a specific filter.
Riminder.response.Filter_get resp = client.filter.get(filter_id, filter_reference);
More details about filters are available here
- Retrieve the profiles information associated with specified source ids.
source_ids
(List<string>
) is required.date_start
anddate_end
type arelong
.page
,rating
andlimit
type areint
.
Riminder.response.ProfileList resp = client.profile.list(source_ids,
date_start, date_end,
page, limit , seniority,
filter_id, filter_reference,
stage, rating,
sort_by, order_by);
- Add a new profile to a source on the platform.
source_id
andfile_path
are requiredfile_path
is the path to the file to be uploaded.training_metadatas
type isresponse.TrainingMetadatas
(response/struct.cs
)
Riminder.response.Profile_post resp = client.profile.add(source_id, file_path, profile_reference, timestamp_reception, training_metadatas);
- Get a specific profile.
Riminder.response.Profile_get resp = client.profile.get(source_id, profile_id, profile_reference);
- Get attachements of a specific profile.
Riminder.response.ProfileDocument_list resp = client.profile.document.list(source_id, profile_id, profile_reference);
- Get parsing result of a specific profile.
Riminder.response.ProfileParsing resp = client.profile.parsing.get(source_id, profile_id, profile_reference);
- Get scoring result of a specific profile.
Riminder.response.ProfileScoringList resp = client.profile.scoring.list(source_id, profile_id, profile_reference);
- Reveal interpretability result of a specific profile with a specific filter.
Riminder.response.ProfileRevealing resp = client.profile.revealing.get(source_id: source_id, profile_id: profile_id, profile_reference: profile_reference, filter_id: filter_id, filter_reference: filter_reference);
- Set stage of a specific profile for a specified filter.
stage
is required.
Riminder.response.ProfileStage resp = client.profile.stage.set(source_id, stage, profile_id, profile_reference, filter_id, filter_reference);
- Set rating of a specific profile for a spcified filter.
rating
(int
) is required.
Riminder.response.ProfileRating resp = client.profile.stage.set(source_id, rating, profile_id, profile_reference, filter_id, filter_reference);
- Check if a parsed profile is valid.
profile_data
(Riminder.response.ProfileJson
) is the parsed profile you want to check, can be called "profile_json".training_metadata
type is (Riminder.response.TrainingMetadatas
)
Riminder.response.ProfileJsonCheck resp = client.json.check(profile_data, training_metadata);
- Add a parsed profile to a source on the platform.
profile_data
(Riminder.response.ProfileJson
) is the parsed profile you want to add, can be called "profile_json".training_metadata
type is (Riminder.response.TrainingMetadatas
)
Riminder.response.ProfileJson_post resp = client.json.add(source_id, profile_data, profile_reference, timestamp_reception, training_metadata);
More details about profiles are available here
- Get all source from the team.
Riminder.response.SourceList resp = client.source.list();
- Get a specific filter.
Riminder.response.Source_get resp = client.source.get(source_id);
More details about profiles are available here
Webhooks methods permit you handle webhook events.
- Check if team's webhook integration is working.
Riminder.response.WebhookCheck resp = client.webhooks.check();
- Set an handler for a specified webhook event.
handler
(Riminder.route.Webhook.WebhookHandler
) is a delegate of signature:void WebhookHandler(string eventName, response.IWebhookMessage webhook_data)
- data received by the webhook are store in
webhook_data
. webhook_data
struct follow the same rules as the responses.eventName
istype
field of the webhook.
- data received by the webhook are store in
client.webhooks.setHandler(Riminder.route.webhook.EventNames.PROFILE_PARSE_SUCCESS, handler);
- Check if there is an handler for a specified event
client.webhooks.isHandlerPresent(eventName);
- Remove the handler for an event
client.webhooks.removeHandler(eventName);
- Start the selected handler depending of the event given.
headers
is webhook request headers.signatureHeader
is webhook request "HTTP-RIMINDER-SIGNATURE" header value.- One them is required not both.
client.webhooks.handle(headers, signatureHeader)
Example:
using System;
using Riminder;
using Riminder.route;
public class Example
{
static void Main()
{
var client = new Riminder("apikey");
// Define an handler
var handler = delegate (string eventName, response.IWebhookMessage webhook_data) { /* something */};
// Set the handler for an event
client.webhooks.setHandler(Webhook.EventNames.PROFILE_PARSE_SUCCESS, handler);
// Get the header of the request by webhook
var rcvheaders = fct_that_get_webhook_request();
// Handle an event
client.webhooks.handle(headers: rcvheaders);
}
}
More details about webhooks are available here
Some tests are available. To run them follow these steps:
git clone git@github.com:Riminder/csharp-riminder-api.git
cd csharp-riminder-api/riminder.Tests
dotnet test
If you need some more details about the api methods and routes see Riminder API Docs.
If you need further explainations about how the api works see Riminder API Overview