JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.workspacePreferences.archive('section_id');import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.workspace_preferences.archive(
"section_id",
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.WorkspacePreferences.Archive(context.TODO(), "section_id")
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
client.workspacePreferences().archive("section_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.workspace_preferences.archive("section_id")
puts(result)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$result = $client->workspacePreferences->archive('section_id');
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.WorkspacePreferences;
CourierClient client = new();
WorkspacePreferenceArchiveParams parameters = new()
{
SectionID = "section_id"
};
await client.WorkspacePreferences.Archive(parameters);courier workspace-preferences archive \
--api-key 'My API Key' \
--section-id section_idcurl --request DELETE \
--url https://api.courier.com/preferences/sections/{section_id} \
--header 'Authorization: Bearer <token>'{
"message": "Example message text",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "Cannot delete a workspace preference that still contains topics"
}Workspace Preferences
Archive Workspace Preference
Archive a workspace preference. The workspace preference must be empty: delete its topics first, otherwise the request fails with 409.
DELETE
/
preferences
/
sections
/
{section_id}
JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.workspacePreferences.archive('section_id');import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.workspace_preferences.archive(
"section_id",
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.WorkspacePreferences.Archive(context.TODO(), "section_id")
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
client.workspacePreferences().archive("section_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.workspace_preferences.archive("section_id")
puts(result)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$result = $client->workspacePreferences->archive('section_id');
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.WorkspacePreferences;
CourierClient client = new();
WorkspacePreferenceArchiveParams parameters = new()
{
SectionID = "section_id"
};
await client.WorkspacePreferences.Archive(parameters);courier workspace-preferences archive \
--api-key 'My API Key' \
--section-id section_idcurl --request DELETE \
--url https://api.courier.com/preferences/sections/{section_id} \
--header 'Authorization: Bearer <token>'{
"message": "Example message text",
"type": "invalid_request_error"
}{
"type": "invalid_request_error",
"message": "Cannot delete a workspace preference that still contains topics"
}⌘I